[CONC-301] Using mysql_stmt_bind_result() in prepared queries Created: 2017-12-21  Updated: 2020-12-08  Resolved: 2017-12-22

Status: Closed
Project: MariaDB Connector/C
Component/s: None
Affects Version/s: 3.0.0, 3.0.1, 3.0.2, 2.3.4, 3.0.3
Fix Version/s: 3.0.3, 2.3.5

Type: Bug Priority: Major
Reporter: Kirill Müller Assignee: Georg Richter
Resolution: Fixed Votes: 0
Labels: Compatibility, tests
Environment:

Ubuntu 17.10, gcc 7, compiling from source


Issue Links:
Relates
relates to MDEV-17116 After upgrade from 10.1.35 to 10.3.9,... Closed
relates to CONC-281 mysql_stmt_fetch_column() should work... Closed

 Description   

The test for CONC-281 contains no call to mysql_stmt_bind_result(), adding it breaks the test: https://github.com/krlmlr/mariadb-connector-c/tree/b-test-string-constant. However, this seems to be the recommended way to find out the length of the data if it is not known beforehand: https://dev.mysql.com/doc/refman/5.7/en/mysql-stmt-fetch.html

The problem seems to be present in 2.3.4 and in the 3.0 branch, and it carries over to RMariaDB. I have a patch that removes the call to mysql_stmt_bind_result(), it works with the current master of Connector/C but fails with everything else:

1. master of RMariaDB:

  • works with libmysqlclient
  • works with libmariadbclient 2.3.4
  • breaks with current libmariadbclient 3.0.x

2. patched RMariaDB, https://github.com/r-dbi/RMariaDB/pull/81:

  • breaks with libmysqlclient
  • breaks with libmariadbclient 2.3.4
  • works with current libmariadbclient 3.0.x

I haven't found anything related to this change in the release notes. Please advise.

For the future: Would you consider adding tests for RMariaDB compiled against your latest development versions to your automated test system? This will ensure smooth operation of RMariaDB, and also adds another rich test suite for Connector/C.



 Comments   
Comment by Georg Richter [ 2017-12-22 ]

Hi Kirill,

issue confirmed:

The correct statement status (MYSQL_STMT_USER_FETCHING) is set after fetch_to_bind, so in case fetch_to_bind fails with truncation the status is not updated correctly and subsequent calls to mysql_stmt_fetch_column will fail.

Comment by Kirill Müller [ 2017-12-22 ]

Thanks for your very fast response. That's what I saw when casually stepping into libmariadb with the debugger.

Comment by Georg Richter [ 2017-12-22 ]

Fixed in 2.3.5 and 3.0.3

About integrating test framework: Let's discuss it after CONC-300 (travis integration) is closed.

Comment by Kirill Müller [ 2017-12-22 ]

Thanks, Georg. Confirmed that RMariaDB now works unchanged with current master.

RMariaDB is already tested on Travis, so adding a build matrix entry should be easy once you have your tests there.

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