[MDEV-20212] Wrong stored procedure output BIT result format when using binary protocol Created: 2019-07-30  Updated: 2024-01-09

Status: Stalled
Project: MariaDB Server
Component/s: None
Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 10.9, 10.10, 10.11
Fix Version/s: 10.4, 10.5, 10.6, 10.11

Type: Bug Priority: Major
Reporter: Diego Dupin Assignee: Alexander Barkov
Resolution: Unresolved Votes: 0
Labels: CONNECTOR_RELATED

Issue Links:
Relates
relates to CONJ-720 CallableStatements with Boolean OUT p... Closed
relates to MDEV-32244 Wrong bit encoding using COALESCE Closed

 Description   

Store procedure output BIT format data are TEXT length encoded, not byte length encoded.

Example :

CREATE TABLE tt2(i BIT(7));
INSERT INTO tt2 VALUE (127);
create procedure other128 (OUT o_duplicate BIT(7))
begin
  SELECT * FROM tt2;
  SELECT i INTO o_duplicate FROM tt2;
end
 
CALL other128(?)

Exchanges will be :

 
23 00 00 02 03 64 65 66  05 74 65 73 74 6A 03 74     #....def.testj.t
74 32 03 74 74 32 01 69  01 69 0C 3F 00 07 00 00     t2.tt2.i.i.?....
00 10 20 00 00 00 00                                 .. ....             ==> data type = 10 = BIT
 
04 00 00 03 00 00 01 7F                              ........            => 01 7F = 127, byte length encoded
 
...
 
41 00 00 06 03 64 65 66  05 74 65 73 74 6A 08 6F    A....def.testj.o
74 68 65 72 31 32 38 08  6F 74 68 65 72 31 32 38    ther128.other128
0B 6F 5F 64 75 70 6C 69  63 61 74 65 0B 6F 5F 64    .o_duplicate.o_d
75 70 6C 69 63 61 74 65  0C 3F 00 07 00 00 00 10    uplicate.?......
20 00 00 00 00                                      ....                 ==> same data type = 10 = BIT
 
06 00 00 07 00 00 03 31  32 37                      .......127           => 03 31  32 37 = 127, string encoded 


Generated at Thu Feb 08 08:57:42 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.