Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-13287

Wrong sequence number when retrieving resultset for prepared statement

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Minor
    • Resolution: Not a Bug
    • 10.1.24
    • N/A
    • Server
    • None
    • 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'

      Attachments

        Activity

          People

            Unassigned Unassigned
            lapinrigolo Rui Pacheco
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.