Skip to content

Commit

Permalink
Merge branch '3.1' into 3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
9EOR9 committed Jul 26, 2021
2 parents 1f320a6 + 9c651bd commit 61a2ae2
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 7 deletions.
12 changes: 6 additions & 6 deletions libmariadb/ma_stmt_codec.c
Expand Up @@ -1240,27 +1240,27 @@ void mysql_init_ps_subsystem(void)

mysql_ps_fetch_functions[MYSQL_TYPE_TINY].func = ps_fetch_int8;
mysql_ps_fetch_functions[MYSQL_TYPE_TINY].pack_len = 1;
mysql_ps_fetch_functions[MYSQL_TYPE_TINY].max_len = 4;
mysql_ps_fetch_functions[MYSQL_TYPE_TINY].max_len = 3;

mysql_ps_fetch_functions[MYSQL_TYPE_SHORT].func = ps_fetch_int16;
mysql_ps_fetch_functions[MYSQL_TYPE_SHORT].pack_len = 2;
mysql_ps_fetch_functions[MYSQL_TYPE_SHORT].max_len = 6;
mysql_ps_fetch_functions[MYSQL_TYPE_SHORT].max_len = 5;

mysql_ps_fetch_functions[MYSQL_TYPE_YEAR].func = ps_fetch_int16;
mysql_ps_fetch_functions[MYSQL_TYPE_YEAR].pack_len = 2;
mysql_ps_fetch_functions[MYSQL_TYPE_YEAR].max_len = 6;
mysql_ps_fetch_functions[MYSQL_TYPE_YEAR].max_len = 4;

mysql_ps_fetch_functions[MYSQL_TYPE_INT24].func = ps_fetch_int32;
mysql_ps_fetch_functions[MYSQL_TYPE_INT24].pack_len = 4;
mysql_ps_fetch_functions[MYSQL_TYPE_INT24].max_len = 9;
mysql_ps_fetch_functions[MYSQL_TYPE_INT24].max_len = 8;

mysql_ps_fetch_functions[MYSQL_TYPE_LONG].func = ps_fetch_int32;
mysql_ps_fetch_functions[MYSQL_TYPE_LONG].pack_len = 4;
mysql_ps_fetch_functions[MYSQL_TYPE_LONG].max_len = 11;
mysql_ps_fetch_functions[MYSQL_TYPE_LONG].max_len = 10;

mysql_ps_fetch_functions[MYSQL_TYPE_LONGLONG].func = ps_fetch_int64;
mysql_ps_fetch_functions[MYSQL_TYPE_LONGLONG].pack_len= 8;
mysql_ps_fetch_functions[MYSQL_TYPE_LONGLONG].max_len = 21;
mysql_ps_fetch_functions[MYSQL_TYPE_LONGLONG].max_len = 20;

mysql_ps_fetch_functions[MYSQL_TYPE_FLOAT].func = ps_fetch_float;
mysql_ps_fetch_functions[MYSQL_TYPE_FLOAT].pack_len = 4;
Expand Down
6 changes: 5 additions & 1 deletion unittest/libmariadb/misc.c
Expand Up @@ -846,7 +846,10 @@ static int test_conc49(MYSQL *mysql)
check_mysql_rc(rc, mysql);
res= mysql_store_result(mysql);
row= mysql_fetch_row(res);
if (atol(row[0]) == 0) {

i= !atol(row[0]);
mysql_free_result(res);
if (i) {
diag("Load local infile disable");
mysql_free_result(res);
return SKIP;
Expand Down Expand Up @@ -1069,6 +1072,7 @@ static int test_remote1(MYSQL *mysql)
int rc;
MYSQL_RES *res;
MYSQL_ROW row;
SKIP_SKYSQL;

SKIP_SKYSQL;

Expand Down
52 changes: 52 additions & 0 deletions unittest/libmariadb/ps.c
Expand Up @@ -5118,7 +5118,59 @@ static int test_conc349(MYSQL *mysql)
return OK;
}

static int test_conc565(MYSQL *mysql)
{
MYSQL_STMT *stmt= mysql_stmt_init(mysql);
MYSQL_FIELD *fields_binary, *fields_text;
MYSQL_RES *result;
int rc;
my_bool x=1;
my_bool error= 0;

rc= mysql_query(mysql, "CREATE TEMPORARY TABLE t1 (a year, b tinyint unsigned, c smallint unsigned, d mediumint unsigned, e int unsigned, f bigint unsigned)");
check_mysql_rc(rc, mysql);

rc= mysql_query(mysql, "INSERT INTO t1 VALUES (2020, 127, 0xFFFF, 0xFFFFFF, 0xFFFFFFFF, 0xFFFFFFFFFFFFFFFF)");
check_mysql_rc(rc, mysql);

rc= mysql_stmt_prepare(stmt, "select a,b,c,d,e,f from t1", -1);
check_stmt_rc(rc, stmt);

rc= mysql_stmt_attr_set(stmt, STMT_ATTR_UPDATE_MAX_LENGTH, (void *)&x);
check_stmt_rc(rc, stmt);

rc= mysql_stmt_execute(stmt);
check_stmt_rc(rc, stmt);

mysql_stmt_store_result(stmt);
fields_binary= mariadb_stmt_fetch_fields(stmt);

rc= mysql_query(mysql, "SELECT a,b,c,d,e,f FROM t1");
result= mysql_store_result(mysql);
fields_text= mysql_fetch_fields(result);

for (unsigned int i=0; i < mysql_field_count(mysql); i++)
{
if (fields_binary[i].length != fields_text[i].length ||
fields_binary[i].max_length != fields_text[i].max_length)
{
diag("Sizes differ for column %d (type= %d)", i, fields_binary[i].type);
diag("Binary (length=%ld max_length=%ld) != Text(length=%ld max_length=%ld",
fields_binary[i].length, fields_binary[i].max_length,
fields_text[i].length, fields_text[i].max_length);
error= 1;
goto end;
}
}
end:
mysql_free_result(result);
mysql_stmt_close(stmt);

return error ? FAIL : OK;
}

struct my_tests_st my_tests[] = {
{"test_conc565", test_conc565, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_conc349", test_conc349, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_prepare_error", test_prepare_error, TEST_CONNECTION_NEW, 0, NULL, NULL},
{"test_reexecute", test_reexecute, TEST_CONNECTION_NEW, 0, NULL, NULL},
Expand Down

0 comments on commit 61a2ae2

Please sign in to comment.