1
0
mirror of https://github.com/mariadb-corporation/mariadb-connector-c.git synced 2025-08-08 14:02:17 +03:00

Merge branch '3.1' into 3.2-diego

# Conflicts:
#	.travis.yml
#	unittest/libmariadb/charset.c
#	unittest/libmariadb/connection.c
This commit is contained in:
kolzeq
2021-06-17 10:54:30 +02:00
26 changed files with 260 additions and 1301 deletions

View File

@@ -652,8 +652,12 @@ static int test_bug_54100(MYSQL *mysql)
while ((row= mysql_fetch_row(result)))
{
/* ignore ucs2 */
if (strcmp(row[0], "ucs2") && strcmp(row[0], "utf16le") && strcmp(row[0], "utf8mb4") &&
strcmp(row[0], "utf16") && strcmp(row[0], "utf32")) {
if (strcmp(row[0], "ucs2")
&& strcmp(row[0], "utf16le")
&& (strcmp(row[0], "utf8mb4") && mariadb_connection(mysql) && mysql_get_server_version(mysql) < 100600)
&& (strcmp(row[0], "utf8") && mariadb_connection(mysql) && mysql_get_server_version(mysql) >= 100600)
&& strcmp(row[0], "utf16")
&& strcmp(row[0], "utf32")) {
rc= mysql_set_character_set(mysql, row[0]);
check_mysql_rc(rc, mysql);
}
@@ -782,6 +786,7 @@ static int charset_auto(MYSQL *my __attribute__((unused)))
/* check if all server character sets are supported */
static int test_conc223(MYSQL *mysql)
{
SKIP_MYSQL(mysql);
int rc;
MYSQL_RES *res;
MYSQL_ROW row;

View File

@@ -1633,6 +1633,9 @@ static int test_conc351(MYSQL *unused __attribute__((unused)))
diag("Server doesn't support session tracking (cap=%lu)", mysql->server_capabilities);
return SKIP;
}
rc= mysql_query(mysql, "USE mysql");
check_mysql_rc(rc, mysql);
FAIL_IF(strcmp(mysql->db, "mysql"), "Expected new schema 'mysql'");
FAIL_IF(mysql_session_track_get_first(mysql, SESSION_TRACK_SCHEMA, &data, &len), "expected session track schema");
@@ -1712,8 +1715,11 @@ static int test_conc366(MYSQL *mysql)
return SKIP;
}
sprintf(query, "CREATE OR REPLACE USER 'ede'@'%s' IDENTIFIED VIA ed25519 USING 'vubFBzIrapbfHct1/J72dnUryz5VS7lA6XHH8sIx4TI'", this_host);
if (mysql_get_server_version(mysql) < 100400) {
sprintf(query, "CREATE OR REPLACE USER 'ede'@'%s' IDENTIFIED VIA ed25519 USING '6aW9C7ENlasUfymtfMvMZZtnkCVlcb1ssxOLJ0kj/AA'", this_host);
} else {
sprintf(query, "CREATE OR REPLACE USER 'ede'@'%s' IDENTIFIED VIA ed25519 USING PASSWORD('MySup8%rPassw@ord')", this_host);
}
rc= mysql_query(mysql, query);
check_mysql_rc(rc, mysql);
@@ -1724,7 +1730,7 @@ static int test_conc366(MYSQL *mysql)
my= mysql_init(NULL);
if (plugindir)
mysql_options(my, MYSQL_PLUGIN_DIR, plugindir);
if (!my_test_connect(my, hostname, "ede", "foo", schema, port, socketname, 0))
if (!my_test_connect(my, hostname, "ede", "MySup8%rPassw@ord", schema, port, socketname, 0))
{
diag("Error: %s", mysql_error(my));
return FAIL;
@@ -1743,6 +1749,7 @@ static int test_conc366(MYSQL *mysql)
static int test_conc392(MYSQL *mysql)
{
SKIP_MYSQL(mysql);
int rc;
const char *data;
size_t len;

View File

@@ -283,6 +283,7 @@ static int test_cursors_with_union(MYSQL *mysql)
static int test_cursors_with_procedure(MYSQL *mysql)
{
SKIP_MYSQL(mysql);
const char *queries[]=
{
"SELECT * FROM t1 procedure analyse()"
@@ -1493,19 +1494,16 @@ static int test_bug38486(MYSQL *mysql)
int rc;
unsigned long type= CURSOR_TYPE_READ_ONLY;
stmt= mysql_stmt_init(mysql);
rc= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*)&type);
check_stmt_rc(rc, stmt);
stmt_text= "CREATE TABLE t1 (a INT)";
rc= mysql_stmt_prepare(stmt, SL(stmt_text));
check_stmt_rc(rc, stmt);
rc= mysql_stmt_execute(stmt);
mysql_stmt_close(stmt);
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t10");
check_mysql_rc(rc, mysql);
rc= mysql_query(mysql, "CREATE TABLE t10 (a INT)");
check_mysql_rc(rc, mysql);
stmt= mysql_stmt_init(mysql);
rc= mysql_stmt_attr_set(stmt, STMT_ATTR_CURSOR_TYPE, (void*)&type);
check_stmt_rc(rc, stmt);
stmt_text= "INSERT INTO t1 VALUES (1)";
stmt_text= "INSERT INTO t10 VALUES (1)";
rc= mysql_stmt_prepare(stmt, SL(stmt_text));
check_stmt_rc(rc, stmt);
rc= mysql_stmt_execute(stmt);

View File

@@ -28,6 +28,9 @@ static int execute_direct(MYSQL *mysql)
rc= mariadb_stmt_execute_direct(stmt, "CREATE TABLE t1 (a int)", -1);
check_stmt_rc(rc, stmt);
rc= mysql_query(mysql, "FLUSH TABLES");
check_mysql_rc(rc, mysql);
memset(&bind, 0, sizeof(MYSQL_BIND));
bind.buffer= &i;
@@ -43,6 +46,9 @@ static int execute_direct(MYSQL *mysql)
rc= mariadb_stmt_execute_direct(stmt, "INSERT INTO t1 VALUES (?)", -1);
check_stmt_rc(rc, stmt);
rc= mysql_query(mysql, "START TRANSACTION");
check_mysql_rc(rc, mysql);
for (i=1; i < 1000; i++)
{
rc= mysql_stmt_execute(stmt);
@@ -58,6 +64,8 @@ static int execute_direct(MYSQL *mysql)
FAIL_IF(mysql_num_rows(res) != 1000, "Expected 1000 rows");
mysql_free_result(res);
rc= mysql_query(mysql, "COMMIT");
check_mysql_rc(rc, mysql);
rc= mysql_query(mysql, "DROP TABLE t1");
check_mysql_rc(rc, mysql);

View File

@@ -475,6 +475,9 @@ static int test_wl4166_2(MYSQL *mysql)
"alter table t1 change column c_int c_int varchar(11)");
check_mysql_rc(rc, mysql);
rc= mysql_query(mysql, "FLUSH TABLES");
check_mysql_rc(rc, mysql);
rc= mysql_stmt_execute(stmt);
check_stmt_rc(rc, stmt);
@@ -509,6 +512,9 @@ static int test_wl4166_2(MYSQL *mysql)
rc= mysql_query(mysql, "alter table t1 add column d_int int");
check_mysql_rc(rc, mysql);
rc= mysql_query(mysql, "FLUSH TABLES");
check_mysql_rc(rc, mysql);
rc= mysql_stmt_execute(stmt);
FAIL_IF(!rc, "Error expected");
@@ -769,11 +775,26 @@ static int test_wl4284_1(MYSQL *mysql)
static int test_bug49694(MYSQL *mysql)
{
int rc;
MYSQL_RES *res;
MYSQL_ROW row;
int i;
FILE *fp;
diag("Load local infile server : %ld", (mysql->server_capabilities & CLIENT_LOCAL_FILES));
diag("Load local infile client : %ld", (mysql->client_flag & CLIENT_LOCAL_FILES));
SKIP_LOAD_INFILE_DISABLE;
SKIP_SKYSQL;
rc= mysql_query(mysql, "select @@LOCAL_INFILE");
check_mysql_rc(rc, mysql);
res= mysql_store_result(mysql);
row= mysql_fetch_row(res);
if (atol(row[0]) == 0) {
diag("Load local infile disable");
return SKIP;
}
rc= mysql_query(mysql, "DROP TABLE IF EXISTS enclist");
check_mysql_rc(rc, mysql);
@@ -803,6 +824,7 @@ static int test_bug49694(MYSQL *mysql)
rc= mysql_query(mysql, "DROP TABLE enclist");
check_mysql_rc(rc, mysql);
mysql_free_result(res);
return OK;
}
@@ -810,12 +832,23 @@ static int test_conc49(MYSQL *mysql)
{
int rc;
MYSQL_RES *res;
MYSQL_ROW row;
int i;
FILE *fp;
SKIP_LOAD_INFILE_DISABLE;
SKIP_SKYSQL;
rc= mysql_query(mysql, "select @@LOCAL_INFILE");
check_mysql_rc(rc, mysql);
res= mysql_store_result(mysql);
row= mysql_fetch_row(res);
if (atol(row[0]) == 0) {
diag("Load local infile disable");
return SKIP;
}
fp= fopen("./sample.csv", "w");
for (i=1; i < 4; i++)
fprintf(fp, "\"%d\", \"%d\", \"%d\"\r\n", i, i, i);
@@ -848,6 +881,9 @@ static int test_ldi_path(MYSQL *mysql)
rc= mysql_query(mysql, "CREATE TABLE t1 (a int)");
check_mysql_rc(rc, mysql);
rc= mysql_query(mysql, "FLUSH TABLES");
check_mysql_rc(rc, mysql);
#ifdef _WIN32
rc= mysql_query(mysql, "LOAD DATA LOCAL INFILE 'X:/non_existing_path/data.csv' INTO TABLE t1 "
"FIELDS TERMINATED BY '.' LINES TERMINATED BY '\r\n'");
@@ -1028,6 +1064,8 @@ static int test_remote1(MYSQL *mysql)
{
int rc;
SKIP_SKYSQL;
MYSQL_RES *res;
MYSQL_ROW row;
remote_plugin= (void *)mysql_client_find_plugin(mysql, "remote_io", MARIADB_CLIENT_REMOTEIO_PLUGIN);
if (!remote_plugin)
@@ -1037,6 +1075,18 @@ static int test_remote1(MYSQL *mysql)
return SKIP;
}
SKIP_LOAD_INFILE_DISABLE;
rc= mysql_query(mysql, "select @@LOCAL_INFILE");
check_mysql_rc(rc, mysql);
res= mysql_store_result(mysql);
row= mysql_fetch_row(res);
if (atol(row[0]) == 0) {
diag("Load local infile disable");
return SKIP;
}
mysql_free_result(res);
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
check_mysql_rc(rc, mysql);

View File

@@ -73,7 +73,7 @@ if (IS_SKYSQL(hostname)) \
#define SKIP_NOTLS
#endif
#define IS_MAXSCALE() (getenv("MAXSCALE_TEST_DISABLE")!=NULL)
#define IS_MAXSCALE() (getenv("srv")!=NULL && (strcmp(getenv("srv"), "maxscale") == 0 || strcmp(getenv("srv"), "skysql-ha") == 0))
#define SKIP_MAXSCALE \
if (IS_MAXSCALE()) \
{ \
@@ -496,6 +496,8 @@ MYSQL *test_connect(struct my_tests_st *test)
}
mysql_options(mysql, MYSQL_REPORT_DATA_TRUNCATION, &truncation_report);
mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, &timeout);
if (plugindir)
mysql_options(mysql, MYSQL_PLUGIN_DIR, plugindir);
/* option handling */
if (test && test->options) {
@@ -554,7 +556,7 @@ static int reset_connection(MYSQL *mysql) {
void get_envvars() {
char *envvar;
if (getenv("MYSQL_TEST_TRAVIS"))
if (getenv("TRAVIS_JOB_ID"))
travis_test= 1;
if (!hostname && (envvar= getenv("MYSQL_TEST_HOST")))

View File

@@ -674,6 +674,7 @@ static int test_bug1500(MYSQL *mysql)
static int test_bug15510(MYSQL *mysql)
{
SKIP_MYSQL(mysql);
MYSQL_STMT *stmt;
int rc;
const char *query= "select 1 from dual where 1/0";
@@ -2070,7 +2071,7 @@ static int test_bug36004(MYSQL *mysql)
int rc, warning_count= 0;
MYSQL_STMT *stmt;
SKIP_MAXSCALE;
SKIP_MYSQL(mysql); // don't send expected warnings
if (mysql_get_server_version(mysql) < 60000) {
diag("Test requires MySQL Server version 6.0 or above");

View File

@@ -426,8 +426,7 @@ static int test_view_insert_fields(MYSQL *mysql)
"F7F8 double NOT NULL default '0',"
"F8F8 double NOT NULL default '0',"
"F9D8 decimal(8,2) NOT NULL default '0.00',"
"PRIMARY KEY (K1C4,K2C4,K3C4,K4N4)) "
"CHARSET=latin1 COLLATE latin1_bin");
"PRIMARY KEY (K1C4,K2C4,K3C4,K4N4))");
check_mysql_rc(rc, mysql);
rc= mysql_query(mysql,
"CREATE VIEW v1 AS select sql_no_cache "