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

mysql_stmt_fetch return code is wrong if buffer size is 1

    XMLWordPrintable

Details

    Description

      mysql_stmt_fetch() returns 0 instead of 101 when results are bound to a buffer of size 1 and the data is longer than 1.

      Output of the attached test case:

      $ ./test.sh 
      Client compile version: 80013
      Client runtime version: 8.0.13
      Server version: 80013
      Result: 00001
       
      Buffer length: 1
      mysql_stmt_fetch result: 101
      Result: 0 (prepared statement)
       
      Buffer length: 2
      mysql_stmt_fetch result: 101
      Result: 00 (prepared statement)
       
      Buffer length: 3
      mysql_stmt_fetch result: 101
      Result: 000 (prepared statement)
       
      Buffer length: 4
      mysql_stmt_fetch result: 101
      Result: 0000 (prepared statement)
       
      Buffer length: 5
      mysql_stmt_fetch result: 0
      Result: 00001 (prepared statement)
      Client compile version: 100311
      Client runtime version: 10.3.11
      Server version: 100311
      Result: 00001
       
      Buffer length: 1
      mysql_stmt_fetch result: 0
      Result: 1. (prepared statement)
       
      Buffer length: 2
      mysql_stmt_fetch result: 101
      Result: 00 (prepared statement)
       
      Buffer length: 3
      mysql_stmt_fetch result: 101
      Result: 000 (prepared statement)
       
      Buffer length: 4
      mysql_stmt_fetch result: 101
      Result: 0000 (prepared statement)
       
      Buffer length: 5
      mysql_stmt_fetch result: 0
      Result: 00001 (prepared statement)
      

      For buffer length 0..4 the expected result is 101 (MYSQL_DATA_TRUNCATED)
      For buffer length 5 the result should be 0

      Attachments

        1. mariadb103_prepare_zerofil.c
          2 kB
          Daniël van Eeden
        2. test.sh
          0.5 kB
          Daniël van Eeden

        Issue Links

          Activity

            People

              georg Georg Richter
              dveeden Daniël van Eeden
              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.