[MDEV-13287] Wrong sequence number when retrieving resultset for prepared statement Created: 2017-07-10  Updated: 2017-08-08  Resolved: 2017-08-08

Status: Closed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.1.24
Fix Version/s: N/A

Type: Bug Priority: Minor
Reporter: Rui Pacheco Assignee: Unassigned
Resolution: Not a Bug Votes: 0
Labels: None
Environment:

OSX



 Description   

I'm trying to implement a client for MariaDB in C++. I've gotten most of it done but came across a curious issue with prepared statements.

I have a local installation of the Sakila database. I prepare a statement using COM_STMT_PREPARE: "select * from actor where actor_id=?".

Once I parse the output of that, I issue a COM_STMT_EXECUTE, by passing the value 200 as actor_id.

This is where the bug seems to be. If you notice, what I labelled "Packet 07" and the following EOF seem to have the wrong sequence numbers, they jump from 6 to 10 and continue normally to 11.

I get the following byte array, which I broke down into what I believe are individual packets:

// Packet 01
[0] = '\x01'
[1] = '\0'
[2] = '\0'
[3] = '\x01'
[4] = '\x04'

// Packet 02
[5] = '6'
[6] = '\0'
[7] = '\0'
[8] = '\x02'
...

// Packet 03
[63] = ':'
[64] = '\0'
[65] = '\0'
[66] = '\x03'
...

// Packet 04
[125] = '8'
[126] = '\0'
[127] = '\0'
[128] = '\x04'
...

// Packet 05
[185] = '<'
[186] = '\0'
[187] = '\0'
[188] = '\x05'
...

// Packet 06
[249] = '\x05'
[250] = '\0'
[251] = '\0'
[252] = '\x06'
[253] = '\xfe'
[254] = '\0'
[255] = '\0'
[256] = '\x02'
[257] = '\0'

// Packet 07
[258] = '\x19'
[259] = '\0'
[260] = '\0'
[261] = '\a'
[262] = '\0'
[263] = '\0'
[264] = '\xc8'
[265] = '\0'
[266] = '\x05'
[267] = 'T'
[268] = 'H'
[269] = 'O'
[270] = 'R'
[271] = 'A'
[272] = '\x06'
[273] = 'T'
[274] = 'E'
[275] = 'M'
[276] = 'P'
[277] = 'L'
[278] = 'E'
[279] = '\a'
[280] = '\xd6'
[281] = '\a'
[282] = '\x02'
[283] = '\x0f'
[284] = '\x04'
[285] = '"'
[286] = '!'

[287] = '\x05'
[288] = '\0'
[289] = '\0'
[290] = '\b'
[291] = '\xfe'
[292] = '\0'
[293] = '\0'
[294] = '\x02'
[295] = '\0'



 Comments   
Comment by Daniel Black [ 2017-07-11 ]

What client library and versio n are you using? Are you able to provide your code?

Comment by Rui Pacheco [ 2017-07-11 ]

This seems to be caused by Xcode printing the wrong values to it's console. I used socat to listen to the socket between my program and the server and the hexadecimal values displayed are much saner.

Comment by Elena Stepanova [ 2017-08-08 ]

So, we can assume there is no problem on MariaDB side here, right?

Comment by Rui Pacheco [ 2017-08-08 ]

I tried closing this ticket but don't think I had permissions. The database works as expected.

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