You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-07 02:42:49 +03:00
Fix for CONC-179:
- Fixed offset for warning_count in ps protocol - Added new api function mysql_stmt_warning_count - For backwards compatibility we also update the value for mysql_warning_count function
This commit is contained in:
@@ -590,6 +590,7 @@ int STDCALL mysql_next_result_start(int *ret, MYSQL *mysql);
|
|||||||
int STDCALL mysql_next_result_cont(int *ret, MYSQL *mysql, int status);
|
int STDCALL mysql_next_result_cont(int *ret, MYSQL *mysql, int status);
|
||||||
int STDCALL mysql_select_db_start(int *ret, MYSQL *mysql, const char *db);
|
int STDCALL mysql_select_db_start(int *ret, MYSQL *mysql, const char *db);
|
||||||
int STDCALL mysql_select_db_cont(int *ret, MYSQL *mysql, int ready_status);
|
int STDCALL mysql_select_db_cont(int *ret, MYSQL *mysql, int ready_status);
|
||||||
|
int STDCALL mysql_stmt_warning_count(MYSQL_STMT *stmt);
|
||||||
int STDCALL mysql_stmt_next_result_start(int *ret, MYSQL_STMT *stmt);
|
int STDCALL mysql_stmt_next_result_start(int *ret, MYSQL_STMT *stmt);
|
||||||
int STDCALL mysql_stmt_next_result_cont(int *ret, MYSQL_STMT *stmt, int status);
|
int STDCALL mysql_stmt_next_result_cont(int *ret, MYSQL_STMT *stmt, int status);
|
||||||
|
|
||||||
|
@@ -130,6 +130,7 @@ SET(MARIADB_LIB_SYMBOLS
|
|||||||
mysql_stmt_send_long_data
|
mysql_stmt_send_long_data
|
||||||
mysql_stmt_sqlstate
|
mysql_stmt_sqlstate
|
||||||
mysql_stmt_store_result
|
mysql_stmt_store_result
|
||||||
|
mysql_stmt_warning_count
|
||||||
mysql_store_result
|
mysql_store_result
|
||||||
mysql_thread_end
|
mysql_thread_end
|
||||||
mysql_thread_id
|
mysql_thread_id
|
||||||
|
@@ -1183,11 +1183,12 @@ my_bool mthd_stmt_read_prepare_response(MYSQL_STMT *stmt)
|
|||||||
stmt->field_count= uint2korr(p);
|
stmt->field_count= uint2korr(p);
|
||||||
p+= 2;
|
p+= 2;
|
||||||
stmt->param_count= uint2korr(p);
|
stmt->param_count= uint2korr(p);
|
||||||
|
p+= 2;
|
||||||
|
|
||||||
/* filler */
|
/* filler */
|
||||||
p++;
|
p++;
|
||||||
stmt->upsert_status.warning_count= uint2korr(p);
|
/* for backward compatibility we also update mysql->warning_count */
|
||||||
|
stmt->mysql->warning_count= stmt->upsert_status.warning_count= uint2korr(p);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1216,6 +1217,11 @@ my_bool mthd_stmt_get_result_metadata(MYSQL_STMT *stmt)
|
|||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int STDCALL mysql_stmt_warning_count(MYSQL_STMT *stmt)
|
||||||
|
{
|
||||||
|
return stmt->upsert_status.warning_count;
|
||||||
|
}
|
||||||
|
|
||||||
int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, size_t length)
|
int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query, size_t length)
|
||||||
{
|
{
|
||||||
MYSQL *mysql= stmt->mysql;
|
MYSQL *mysql= stmt->mysql;
|
||||||
|
@@ -4191,7 +4191,32 @@ static int test_conc177(MYSQL *mysql)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int test_conc179(MYSQL *mysql)
|
||||||
|
{
|
||||||
|
MYSQL_STMT *stmt;
|
||||||
|
int rc;
|
||||||
|
char *stmtstr= "CREATE TABLE t1 (`blurb_id` int NOT NULL DEFAULT 0, `blurb` text default '', PRIMARY KEY (blurb_id)) ENGINE='FEDERATED' DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:$SLAVE_MYPORT/test/t1'";
|
||||||
|
|
||||||
|
rc= mysql_query(mysql, "set sql_mode=''");
|
||||||
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
|
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
|
||||||
|
check_mysql_rc(rc, mysql);
|
||||||
|
|
||||||
|
stmt= mysql_stmt_init(mysql);
|
||||||
|
rc= mysql_stmt_prepare(stmt, stmtstr, strlen(stmtstr));
|
||||||
|
check_stmt_rc(rc, stmt);
|
||||||
|
|
||||||
|
FAIL_IF(mysql_warning_count(mysql) != 3, "expected 3 warnings");
|
||||||
|
FAIL_IF(mysql_stmt_warning_count(stmt) != 3, "expected 3 warnings");
|
||||||
|
|
||||||
|
mysql_stmt_close(stmt);
|
||||||
|
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
struct my_tests_st my_tests[] = {
|
struct my_tests_st my_tests[] = {
|
||||||
|
{"test_conc179", test_conc179, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
{"test_conc177", test_conc177, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
{"test_conc177", test_conc177, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
{"test_conc167", test_conc167, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
{"test_conc167", test_conc167, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
{"test_conc168", test_conc168, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
{"test_conc168", test_conc168, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
|
Reference in New Issue
Block a user