[CONC-660] MYSQL_TYPE_BIT column-wise binding crashes Created: 2023-08-14 Updated: 2023-08-18 Resolved: 2023-08-17 |
|
| Status: | Closed |
| Project: | MariaDB Connector/C |
| Component/s: | Prepared Statements |
| Affects Version/s: | 3.3.5 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Sharon He | Assignee: | Georg Richter |
| Resolution: | Not a Bug | Votes: | 0 |
| Labels: | None | ||
| Environment: |
MacOS |
||
| Attachments: |
|
| Description |
|
This is part of my code, but it crashes during execution. Please let me know if I made any mistake or this is a bug. MYSQL_BIND bind; ; bind.buffer_type = MYSQL_TYPE_BIT; mysql_stmt_attr_set(insertStmt, STMT_ATTR_ARRAY_SIZE, &numRows); mysql_stmt_execute(insertStmt); I also tried the same code except for having It did not crash, but I could not fetch the correct data back. |
| Comments |
| Comment by Georg Richter [ 2023-08-16 ] |
|
Please attach a complete test (including the table definition *and * proper error checking for each API call) which allows us to repeat the problem. |
| Comment by Sharon He [ 2023-08-16 ] |
|
My apologies. When I have bind.buffer_type=MYSQL_TYPE_BIT; and run mysql_stmt_execute, it doesn't crash, but throws an error: |
| Comment by Georg Richter [ 2023-08-17 ] |
|
As mentioned in my previous comment, you should always check the return code of API calls. In case there is an error, the program should not continue but handle the error properly. mysql_stmt_bind_param() should fail, since MYSQL_TYPE_BIT is not supported as parameter type (C doesn't have a bit type), instead use an integer (in your example tinyint). |
| Comment by Sharon He [ 2023-08-17 ] |
|
I tried bind.buffer_type = MYSQL_TYPE_TINY; Please see the code in the attachment. MYSQL_TYPE_BIT_error.c |
| Comment by Georg Richter [ 2023-08-18 ] |
|
Hi Sharon, please note that Jira is an issue tracker, but not a support forum. You're now getting a completly different error, which is totally unrelated to the initially reported problem, caused by errors in your code. |