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
Merge branch '3.1' into 3.3
This commit is contained in:
@@ -2256,7 +2256,43 @@ static int test_status_callback(MYSQL *my __attribute__((unused)))
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int test_conc632(MYSQL *my __attribute__((unused)))
|
||||
{
|
||||
MYSQL *mysql= mysql_init(NULL);
|
||||
int rc;
|
||||
|
||||
if (!my_test_connect(mysql, hostname, username, password, schema, port, socketname, CLIENT_REMEMBER_OPTIONS))
|
||||
{
|
||||
diag("Connection failed. Error: %s", mysql_error(mysql));
|
||||
mysql_close(mysql);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
rc= mysql_query(mysql, "CREATE OR REPLACE PROCEDURE conc632() "
|
||||
"BEGIN "
|
||||
" SELECT 1;"
|
||||
" SELECT 2;"
|
||||
"END");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_query(mysql, "CALL conc632()");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_reset_connection(mysql);
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_ping(mysql);
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_query(mysql, "DROP PROCEDURE conc632");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
mysql_close(mysql);
|
||||
return OK;
|
||||
}
|
||||
|
||||
struct my_tests_st my_tests[] = {
|
||||
{"test_conc632", test_conc632, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||
{"test_status_callback", test_status_callback, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||
{"test_conc365", test_conc365, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||
{"test_conc365_reconnect", test_conc365_reconnect, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
|
@@ -5657,7 +5657,83 @@ static int test_conc627(MYSQL *mysql)
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int test_conc633(MYSQL *mysql)
|
||||
{
|
||||
MYSQL_STMT *stmt= mysql_stmt_init(mysql);
|
||||
MYSQL *my= mysql_init(NULL);
|
||||
int ret= FAIL;
|
||||
int rc;
|
||||
|
||||
if (!mariadb_stmt_execute_direct(stmt, SL("SÄLECT 1")))
|
||||
{
|
||||
diag("Syntax error expected");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (mysql_errno(mysql) != mysql_stmt_errno(stmt))
|
||||
{
|
||||
diag("Different error codes. mysql_errno= %d, mysql_stmt_errno=%d",
|
||||
mysql_errno(mysql), mysql_stmt_errno(stmt));
|
||||
goto end;
|
||||
}
|
||||
|
||||
if ((long)stmt->stmt_id != -1)
|
||||
{
|
||||
diag("Error: expected stmt_id=-1");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (!(my= test_connect(NULL)))
|
||||
{
|
||||
diag("Can establish connection (%s)", mysql_error(my));
|
||||
goto end;
|
||||
}
|
||||
|
||||
rc= mysql_query(my, "CREATE OR REPLACE TABLE conc633 (a int)");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_query(mysql, "SET @@lock_wait_timeout=3");
|
||||
|
||||
rc= mysql_query(my, "LOCK TABLES conc633 WRITE");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
rc= mysql_query(mysql, "SET @@lock_wait_timeout=3");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
if (!mariadb_stmt_execute_direct(stmt, SL("INSERT INTO conc633 VALUES (1)")))
|
||||
{
|
||||
diag("lock wait timeout error expected");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (stmt->state != MYSQL_STMT_PREPARED)
|
||||
{
|
||||
diag("Error: stmt hasn't prepared status");
|
||||
goto end;
|
||||
}
|
||||
|
||||
if ((long)stmt->stmt_id == -1)
|
||||
{
|
||||
diag("Error: no stmt_id assigned");
|
||||
goto end;
|
||||
}
|
||||
|
||||
rc= mysql_query(my, "UNLOCK TABLES");
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_query(my, "DROP TABLE conc633");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
ret= OK;
|
||||
|
||||
end:
|
||||
if (my)
|
||||
mysql_close(my);
|
||||
mysql_stmt_close(stmt);
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct my_tests_st my_tests[] = {
|
||||
{"test_conc633", test_conc633, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_conc623", test_conc623, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_conc627", test_conc627, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_mdev19838", test_mdev19838, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
|
Reference in New Issue
Block a user