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

Replace SET_CLIENT_STMT_ERROR by stmt_set_error().

This commit is contained in:
Georg Richter
2023-04-11 18:31:19 +02:00
parent 5a94570b39
commit 2000b06183
4 changed files with 54 additions and 57 deletions

View File

@@ -810,16 +810,16 @@ static int test_conc624(MYSQL *mysql)
MYSQL_STMT *stmt= mysql_stmt_init(mysql);
char errmsg[MYSQL_ERRMSG_SIZE];
SET_CLIENT_STMT_ERROR(stmt, 9000, SQLSTATE_UNKNOWN, 0);
stmt_set_error(stmt, 9000, SQLSTATE_UNKNOWN, 0);
snprintf(errmsg, MYSQL_ERRMSG_SIZE, ER_UNKNOWN_ERROR_CODE, 9000);
diag("stmt_error: %s", mysql_stmt_error(stmt));
FAIL_IF(strcmp(mysql_stmt_error(stmt), errmsg), "expected undefined error 9000");
SET_CLIENT_STMT_ERROR(stmt, 0, SQLSTATE_UNKNOWN, 0);
stmt_set_error(stmt, 0, SQLSTATE_UNKNOWN, 0);
snprintf(errmsg, MYSQL_ERRMSG_SIZE, ER_UNKNOWN_ERROR_CODE, 0);
FAIL_IF(strcmp(mysql_stmt_error(stmt), errmsg), "expected undefined error 0");
SET_CLIENT_STMT_ERROR(stmt, 4999, SQLSTATE_UNKNOWN, 0);
stmt_set_error(stmt, 4999, SQLSTATE_UNKNOWN, 0);
snprintf(errmsg, MYSQL_ERRMSG_SIZE, ER_UNKNOWN_ERROR_CODE, 4999);
FAIL_IF(strcmp(mysql_stmt_error(stmt), errmsg), "expected undefined error 4999");
@@ -835,8 +835,8 @@ static int test_conc624(MYSQL *mysql)
snprintf(errmsg, MYSQL_ERRMSG_SIZE, ER_UNKNOWN_ERROR_CODE, 9000);
FAIL_IF(strcmp(mysql_error(mysql), errmsg), "expected undefined error 9000");
/* test if SET_CLIENT_STMT_ERROR works with variadic arguments */
SET_CLIENT_STMT_ERROR(stmt, CR_STMT_CLOSED, SQLSTATE_UNKNOWN, 0, "foobar");
/* test if stmt_set_error works with variadic arguments */
stmt_set_error(stmt, CR_STMT_CLOSED, SQLSTATE_UNKNOWN, 0, "foobar");
snprintf(errmsg, MYSQL_ERRMSG_SIZE, ER(CR_STMT_CLOSED), "foobar");
FAIL_IF(strcmp(mysql_stmt_error(stmt), errmsg), "error when passing variadic arguments to prepared stmt error function");