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 from 3.0.0 fixes
This commit is contained in:
@@ -55,13 +55,17 @@ static int test_conc75(MYSQL *my)
|
||||
{
|
||||
ulong thread_id= mysql_thread_id(mysql);
|
||||
/* force reconnect */
|
||||
mysql->reconnect= 1;
|
||||
diag("killing connection");
|
||||
mysql_kill(my, thread_id);
|
||||
sleep(1);
|
||||
sleep(2);
|
||||
mysql_ping(mysql);
|
||||
rc= mysql_query(mysql, "load data local infile './nonexistingfile.csv' into table a (`a`)");
|
||||
FAIL_IF(!test(mysql->options.client_flag | CLIENT_LOCAL_FILES), "client_flags not correct");
|
||||
diag("thread1: %d %d", thread_id, mysql_thread_id(mysql));
|
||||
FAIL_IF(thread_id == mysql_thread_id(mysql), "new thread id expected");
|
||||
diag("cs: %s", mysql->charset->csname);
|
||||
FAIL_IF(strcmp(mysql->charset->csname, "utf8"), "wrong character set");
|
||||
//diag("cs: %s", mysql->charset->csname);
|
||||
//FAIL_IF(strcmp(mysql->charset->csname, "utf8"), "wrong character set");
|
||||
}
|
||||
mysql_close(mysql);
|
||||
return OK;
|
||||
@@ -76,7 +80,12 @@ static int test_conc74(MYSQL *my)
|
||||
mysql= mysql_init(NULL);
|
||||
|
||||
|
||||
mysql_real_connect(mysql, hostname, username, password, schema, port, socketname, 0| CLIENT_MULTI_RESULTS | CLIENT_REMEMBER_OPTIONS);
|
||||
if (!mysql_real_connect(mysql, hostname, username, password, schema, port, socketname, 0| CLIENT_MULTI_RESULTS | CLIENT_REMEMBER_OPTIONS))
|
||||
{
|
||||
diag("Error: %s", mysql_error(mysql));
|
||||
mysql_close(mysql);
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
rc= mysql_query(mysql, "DROP TABLE IF EXISTS a");
|
||||
check_mysql_rc(rc, mysql);
|
||||
@@ -128,7 +137,11 @@ static int test_conc70(MYSQL *my)
|
||||
int rc;
|
||||
MYSQL_RES *res;
|
||||
MYSQL_ROW row;
|
||||
MYSQL *mysql= mysql_init(NULL);
|
||||
MYSQL *mysql;
|
||||
|
||||
SKIP_CONNECTION_HANDLER;
|
||||
|
||||
mysql= mysql_init(NULL);
|
||||
|
||||
rc= mysql_query(my, "SET @a:=@@max_allowed_packet");
|
||||
check_mysql_rc(rc, my);
|
||||
@@ -148,6 +161,14 @@ static int test_conc70(MYSQL *my)
|
||||
rc= mysql_query(mysql, "INSERT INTO t1 VALUES (REPEAT('A', 1024 * 1024 * 20))");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
if (mysql_warning_count(mysql))
|
||||
{
|
||||
diag("server doesn't accept package size");
|
||||
return SKIP;
|
||||
}
|
||||
|
||||
sleep(20);
|
||||
|
||||
rc= mysql_query(mysql, "SELECT a FROM t1");
|
||||
check_mysql_rc(rc, mysql);
|
||||
|
||||
@@ -175,7 +196,11 @@ static int test_conc68(MYSQL *my)
|
||||
int rc;
|
||||
MYSQL_RES *res;
|
||||
MYSQL_ROW row;
|
||||
MYSQL *mysql= mysql_init(NULL);
|
||||
MYSQL *mysql;
|
||||
|
||||
SKIP_CONNECTION_HANDLER;
|
||||
|
||||
mysql= mysql_init(NULL);
|
||||
|
||||
rc= mysql_query(my, "SET @a:=@@max_allowed_packet");
|
||||
check_mysql_rc(rc, my);
|
||||
@@ -193,6 +218,11 @@ static int test_conc68(MYSQL *my)
|
||||
|
||||
rc= mysql_query(mysql, "INSERT INTO t1 VALUES (REPEAT('A', 1024 * 1024 * 20))");
|
||||
check_mysql_rc(rc, mysql);
|
||||
if (mysql_warning_count(mysql))
|
||||
{
|
||||
diag("server doesn't accept package size");
|
||||
return SKIP;
|
||||
}
|
||||
|
||||
rc= mysql_query(mysql, "SELECT a FROM t1");
|
||||
check_mysql_rc(rc, mysql);
|
||||
@@ -427,7 +457,7 @@ static int test_mysql_insert_id(MYSQL *mysql)
|
||||
FAIL_UNLESS(res == 400, "");
|
||||
|
||||
/* table with auto_increment column */
|
||||
rc= mysql_query(mysql, "create table t2 (f1 int not null primary key auto_increment, f2 varchar(255))");
|
||||
rc= mysql_query(mysql, "create table t2 (f1 int not null primary key auto_increment, f2 varchar(255)) engine=MyISAM");
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_query(mysql, "insert into t2 values (1,'a')");
|
||||
check_mysql_rc(rc, mysql);
|
||||
@@ -504,12 +534,13 @@ static int test_mysql_insert_id(MYSQL *mysql)
|
||||
according to the manual, this might be 20 or 300, but it looks like
|
||||
auto_increment column takes priority over last_insert_id().
|
||||
*/
|
||||
diag("res: %d", res);
|
||||
FAIL_UNLESS(res == 20, "");
|
||||
/* If first autogenerated number fails and 2nd works: */
|
||||
rc= mysql_query(mysql, "drop table t2");
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_query(mysql, "create table t2 (f1 int not null primary key "
|
||||
"auto_increment, f2 varchar(255), unique (f2))");
|
||||
"auto_increment, f2 varchar(255), unique (f2)) engine=MyISAM");
|
||||
check_mysql_rc(rc, mysql);
|
||||
rc= mysql_query(mysql, "insert into t2 values (null,'e')");
|
||||
res= mysql_insert_id(mysql);
|
||||
@@ -618,12 +649,9 @@ static int bug_conc1(MYSQL *mysql)
|
||||
{
|
||||
mysql_real_connect(mysql, hostname, username, password, schema,
|
||||
port, socketname, 0);
|
||||
diag("errno: %d", mysql_errno(mysql));
|
||||
FAIL_IF(mysql_errno(mysql) != CR_ALREADY_CONNECTED,
|
||||
"Expected errno=CR_ALREADY_CONNECTED");
|
||||
FAIL_IF(strcmp(mysql_error(mysql), ER(CR_ALREADY_CONNECTED)) != 0,
|
||||
"Wrong error message");
|
||||
FAIL_IF(strcmp(ER(CR_ALREADY_CONNECTED), "Can't connect twice. Already connected") != 0,
|
||||
"wrong error message");
|
||||
return OK;
|
||||
}
|
||||
|
||||
@@ -668,11 +696,14 @@ static int test_reconnect_maxpackage(MYSQL *my)
|
||||
{
|
||||
int rc;
|
||||
ulong max_packet= 0;
|
||||
MYSQL *mysql= mysql_init(NULL);
|
||||
MYSQL *mysql;
|
||||
MYSQL_RES *res;
|
||||
MYSQL_ROW row;
|
||||
char *query;
|
||||
|
||||
SKIP_CONNECTION_HANDLER;
|
||||
mysql= mysql_init(NULL);
|
||||
|
||||
FAIL_IF(!mysql_real_connect(mysql, hostname, username, password, schema,
|
||||
port, socketname,
|
||||
CLIENT_MULTI_STATEMENTS | CLIENT_MULTI_RESULTS), mysql_error(mysql));
|
||||
@@ -770,6 +801,8 @@ int main(int argc, char **argv)
|
||||
|
||||
get_envvars();
|
||||
|
||||
diag("user: %s", username);
|
||||
|
||||
run_tests(my_tests);
|
||||
|
||||
return(exit_status());
|
||||
|
Reference in New Issue
Block a user