You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-08 14:02:17 +03:00
Merge branch '3.3' into 3.4
This commit is contained in:
@@ -5809,9 +5809,124 @@ static int test_conc683(MYSQL *mysql)
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int test_conc702(MYSQL *ma)
|
||||
{
|
||||
MYSQL_STMT *stmt, *stmt2;
|
||||
|
||||
diag("Server info %s\nClient info: %s",
|
||||
mysql_get_server_info(ma), mysql_get_client_info());
|
||||
|
||||
mysql_query(ma, "DROP PROCEDURE IF EXISTS p1");
|
||||
|
||||
mysql_query(ma, "CREATE PROCEDURE p1() BEGIN"
|
||||
" SELECT 1 FROM DUAL; "
|
||||
"END");
|
||||
|
||||
stmt= mysql_stmt_init(ma);
|
||||
|
||||
FAIL_IF(!stmt, "Could not allocate stmt");
|
||||
|
||||
mysql_stmt_prepare(stmt, "CALL p1()", -1);
|
||||
mysql_stmt_execute(stmt);
|
||||
|
||||
|
||||
mysql_stmt_store_result(stmt);
|
||||
|
||||
// We've done everything w/ result and skip everything else
|
||||
|
||||
while (mysql_stmt_more_results(stmt)) {
|
||||
|
||||
mysql_stmt_next_result(stmt);
|
||||
// state at this moment is MYSQL_STMT_WAITING_USE_OR_STORE. But there is no result,
|
||||
// we can't store it. And there is no way to change it
|
||||
|
||||
}
|
||||
// Now we are not closing it, for later use. For example it's been put to the cache
|
||||
// Using connection freely - we haven't done anything wrong, "nothing is out of sync"
|
||||
|
||||
mysql_query(ma, "DROP PROCEDURE p1");
|
||||
mysql_query(ma, "DROP PROCEDURE IF EXISTS p2");
|
||||
mysql_query(ma, "CREATE PROCEDURE p2() "
|
||||
"BEGIN "
|
||||
" SELECT 'Marten' FROM DUAL; "
|
||||
" SELECT 'Zack' FROM DUAL; "
|
||||
"END");
|
||||
|
||||
stmt2= mysql_stmt_init(ma);
|
||||
|
||||
mysql_stmt_prepare(stmt2, "CALL p2()", -1);
|
||||
|
||||
mysql_stmt_execute(stmt2);
|
||||
|
||||
mysql_stmt_store_result(stmt2);
|
||||
|
||||
// I was initially wrong, this goes thru
|
||||
check_stmt_rc(mysql_stmt_next_result(stmt2), stmt2);
|
||||
|
||||
// But we get error"Out of sync" set, if check
|
||||
// check_stmt_rc(mysql_stmt_next_result(stmt2), stmt2);
|
||||
|
||||
check_stmt_rc(mysql_stmt_store_result(stmt2), stmt2);
|
||||
|
||||
mysql_stmt_close(stmt2);
|
||||
|
||||
mysql_stmt_close(stmt);
|
||||
return OK;
|
||||
}
|
||||
|
||||
static int test_conc739(MYSQL *mysql)
|
||||
{
|
||||
MYSQL_STMT *stmt;
|
||||
int rc;
|
||||
MYSQL_BIND bind[2];
|
||||
char buffer[2][100];
|
||||
MYSQL_ROW row;
|
||||
MYSQL_RES *result;
|
||||
uint8 i;
|
||||
|
||||
rc= mysql_query(mysql, "SELECT FROM_UNIXTIME('1922.1'), FROM_UNIXTIME('1922.0')");
|
||||
check_mysql_rc(rc, mysql);
|
||||
result= mysql_store_result(mysql);
|
||||
row= mysql_fetch_row(result);
|
||||
|
||||
stmt= mysql_stmt_init(mysql);
|
||||
|
||||
rc= mysql_stmt_prepare(stmt, SL("SELECT FROM_UNIXTIME('1922.1'), FROM_UNIXTIME('1922.0')"));
|
||||
check_stmt_rc(rc, stmt);
|
||||
|
||||
memset(bind, 0, 2 * sizeof(MYSQL_BIND));
|
||||
for (i=0; i < 2; i++)
|
||||
{
|
||||
bind[i].buffer_type= MYSQL_TYPE_STRING;
|
||||
bind[i].buffer= &buffer[i];
|
||||
bind[i].buffer_length= 100;
|
||||
}
|
||||
|
||||
rc= mysql_stmt_execute(stmt);
|
||||
check_stmt_rc(rc, stmt);
|
||||
|
||||
rc= mysql_stmt_bind_result(stmt, bind);
|
||||
check_stmt_rc(rc, stmt);
|
||||
|
||||
rc= mysql_stmt_fetch(stmt);
|
||||
check_stmt_rc(rc, stmt);
|
||||
|
||||
for (i=0; i < 2; i++)
|
||||
{
|
||||
diag("text: %s binary: %s", row[i], buffer[i]);
|
||||
FAIL_IF(strcmp(buffer[i], row[i]), "Different results (text/binary protocol)");
|
||||
}
|
||||
|
||||
mysql_stmt_close(stmt);
|
||||
mysql_free_result(result);
|
||||
return OK;
|
||||
}
|
||||
|
||||
struct my_tests_st my_tests[] = {
|
||||
{"test_conc683", test_conc683, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_conc667", test_conc667, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_conc702", test_conc702, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"test_conc739", test_conc739, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||
{"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},
|
||||
|
Reference in New Issue
Block a user