Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
2.3.7
-
None
-
None
-
linux ppc64/window10 x64
Description
Hi team,
I want to connect a drds database with library mariadb-connector-c-2.3.7-src. when i use mysql_commit function ,i got an error like this:
mysql_error:You have an error in you SQL syntax:Error occurs around this fragment : {COMMIT |
mysql_errno:1064
|
I found that the mysql_commit function uses the sizeof("commit") , the value is 7.
3363 my_bool STDCALL mysql_commit(MYSQL *mysql)
|
3364 {
|
3365 DBUG_ENTER("mysql_commit"); |
3366 DBUG_RETURN((my_bool)mysql_real_query(mysql, "COMMIT", sizeof("COMMIT"))); |
3367 }
|
3368
|
3369 my_bool STDCALL mysql_rollback(MYSQL *mysql)
|
3370 {
|
3371 DBUG_ENTER("mysql_rollback"); |
3372 DBUG_RETURN((my_bool)mysql_real_query(mysql, "ROLLBACK", sizeof("ROLLBACK"))); |
3373 }
|
and the libmysql.c in library mysql-5.5.37/libmysql ,the implement is
4745 my_bool STDCALL mysql_commit(MYSQL * mysql)
|
4746 {
|
4747 DBUG_ENTER("mysql_commit"); |
4748 DBUG_RETURN((my_bool) mysql_real_query(mysql, "commit", 6)); |
4749 }
|
when i use libmysql, the error is fixed.
the poco c++ library use length() function ,and the error is fixed too.
sql = "commit"; |
rc = mysql_real_query(hsession, sql.c_str(), static_cast<unsigned long>(sql.length())); |
if (rc != 0) |
{
|
print_mysql_error();
|
}
|
assert(rc == 0); |
I'm not sure if it's a bug, so I want to get an answer.