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

Test fixes:

for api functions which require string with length parameter (e.g.
  mysql_real_connect() or mysql_stmt_prepare() we now use the macro
  SL(string) which substitutes string and string length.
This commit is contained in:
Georg Richter
2018-02-16 13:05:35 +01:00
parent 5a30aed376
commit 83eef02ec8
19 changed files with 358 additions and 554 deletions

View File

@@ -248,7 +248,7 @@ static int test_frm_bug(MYSQL *mysql)
stmt= mysql_stmt_init(mysql);
FAIL_IF(!stmt, mysql_error(mysql));
rc= mysql_stmt_prepare(stmt, "show variables like 'datadir'", (unsigned long)strlen("show variables like 'datadir'"));
rc= mysql_stmt_prepare(stmt, SL("show variables like 'datadir'"));
check_stmt_rc(rc, stmt);
rc= mysql_stmt_execute(stmt);
@@ -341,7 +341,7 @@ static int test_wl4166_1(MYSQL *mysql)
FAIL_IF(!stmt, mysql_error(mysql));
query= "INSERT INTO table_4166(col1, col2, col3, col4, col5, col6, col7) "
"VALUES(?, ?, ?, ?, ?, ?, ?)";
rc= mysql_stmt_prepare(stmt, query, (unsigned long)strlen(query));
rc= mysql_stmt_prepare(stmt, SL(query));
check_stmt_rc(rc, stmt);
FAIL_IF(mysql_stmt_param_count(stmt) != 7, "param_count != 7");
@@ -453,7 +453,7 @@ static int test_wl4166_2(MYSQL *mysql)
stmt= mysql_stmt_init(mysql);
FAIL_IF(!stmt, mysql_error(mysql));
rc= mysql_stmt_prepare(stmt, "select * from t1", (unsigned long)strlen("select * from t1"));
rc= mysql_stmt_prepare(stmt, SL("select * from t1"));
check_stmt_rc(rc, stmt);
memset(bind_out, '\0', sizeof(bind_out));
@@ -552,7 +552,7 @@ static int test_wl4166_3(MYSQL *mysql)
stmt= mysql_stmt_init(mysql);
FAIL_IF(!stmt, mysql_error(mysql));
rc= mysql_stmt_prepare(stmt, "insert into t1 (year) values (?)", (unsigned long)strlen("insert into t1 (year) values (?)"));
rc= mysql_stmt_prepare(stmt, SL("insert into t1 (year) values (?)"));
check_stmt_rc(rc, stmt);
FAIL_IF(mysql_stmt_param_count(stmt) != 1, "param_count != 1");
@@ -644,7 +644,7 @@ static int test_wl4166_4(MYSQL *mysql)
stmt_text= "insert into t1 (c1, c2) values (?, ?)";
rc= mysql_stmt_prepare(stmt, stmt_text, (unsigned long)strlen(stmt_text));
rc= mysql_stmt_prepare(stmt, SL(stmt_text));
check_stmt_rc(rc, stmt);
mysql_stmt_bind_param(stmt, bind_array);
@@ -661,7 +661,7 @@ static int test_wl4166_4(MYSQL *mysql)
stmt_text= "select c1, c2 from t1";
/* c1 and c2 are binary so no conversion will be done on select */
rc= mysql_stmt_prepare(stmt, stmt_text, (unsigned long)strlen(stmt_text));
rc= mysql_stmt_prepare(stmt, SL(stmt_text));
check_stmt_rc(rc, stmt);
rc= mysql_stmt_execute(stmt);
@@ -1272,7 +1272,7 @@ static int test_wl6797(MYSQL *mysql)
stmt= mysql_stmt_init(mysql);
stmt_text= "INSERT INTO t1 VALUES (1), (2)";
rc= mysql_stmt_prepare(stmt, stmt_text, (ulong)strlen(stmt_text));
rc= mysql_stmt_prepare(stmt, SL(stmt_text));
check_mysql_rc(rc, mysql);
/* Execute the insert statement */