Skip to content

Commit

Permalink
Fix for CONC-163: mysql->info returns garbage if no row was updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
9EOR9 committed Feb 23, 2016
1 parent d4241c4 commit ee10b55
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion include/mysql/plugin_auth.h
Expand Up @@ -25,7 +25,7 @@
#define MYSQL_PLUGIN_AUTH_COMMON_INCLUDED

/** the max allowed length for a user name */
#define MYSQL_USERNAME_LENGTH 48
#define MYSQL_USERNAME_LENGTH 512

/**
return values of the plugin authenticate_user() method.
Expand Down
2 changes: 1 addition & 1 deletion include/mysql/plugin_auth_common.h
Expand Up @@ -25,7 +25,7 @@
#define MYSQL_PLUGIN_AUTH_COMMON_INCLUDED

/** the max allowed length for a user name */
#define MYSQL_USERNAME_LENGTH 48
#define MYSQL_USERNAME_LENGTH 512

/**
return values of the plugin authenticate_user() method.
Expand Down
2 changes: 1 addition & 1 deletion include/mysql_com.h
Expand Up @@ -32,7 +32,7 @@
#define NAME_CHAR_LEN 64
#define NAME_LEN 256 /* Field/table name length */
#define HOSTNAME_LENGTH 60
#define SYSTEM_MB_MAX_CHAR_LENGTH 3
#define SYSTEM_MB_MAX_CHAR_LENGTH 4
#define USERNAME_CHAR_LENGTH 128
#define USERNAME_LENGTH USERNAME_CHAR_LENGTH * SYSTEM_MB_MAX_CHAR_LENGTH
#define SERVER_VERSION_LENGTH 60
Expand Down
1 change: 1 addition & 0 deletions libmariadb/libmariadb.c
Expand Up @@ -635,6 +635,7 @@ static void free_old_query(MYSQL *mysql)
init_alloc_root(&mysql->field_alloc,8192,0); /* Assume rowlength < 8192 */
mysql->fields=0;
mysql->field_count=0; /* For API */
mysql->info= 0;
DBUG_VOID_RETURN;
}

Expand Down
21 changes: 21 additions & 0 deletions unittest/libmariadb/connection.c
Expand Up @@ -738,8 +738,29 @@ static int test_wrong_bind_address(MYSQL *my)
return OK;
}

static int test_conc_163(MYSQL *mysql)
{
int rc;

rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
check_mysql_rc(rc,mysql);
rc= mysql_query(mysql, "CREATE TABLE t1 (a int)");
check_mysql_rc(rc,mysql);
rc= mysql_query(mysql, "INSERT INTO t1 VALUES (1),(2),(3)");
check_mysql_rc(rc,mysql);
diag("info: %s", mysql_info(mysql));
rc= mysql_query(mysql, "DROP TABLE IF EXISTS t1");
check_mysql_rc(rc,mysql);
diag("info: %s", mysql_info(mysql));
rc= mysql_query(mysql, "CREATE TABLE t1 (a int)");
check_mysql_rc(rc,mysql);
diag("info: %s", mysql_info(mysql));
return OK;
}


struct my_tests_st my_tests[] = {
{"test_conc_163", test_conc_163, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_bind_address", test_bind_address, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_wrong_bind_address", test_wrong_bind_address, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
{"test_conc118", test_conc118, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
Expand Down

0 comments on commit ee10b55

Please sign in to comment.