You've already forked mariadb-connector-c
mirror of
https://github.com/mariadb-corporation/mariadb-connector-c.git
synced 2025-08-08 14:02:17 +03:00
Fix for unbuffered stmt fetch: increase number of rows
Added Test for CONC-24
This commit is contained in:
@@ -77,8 +77,6 @@ typedef enum mysql_stmt_state
|
|||||||
MYSQL_STMT_FETCH_DONE
|
MYSQL_STMT_FETCH_DONE
|
||||||
} enum_mysqlnd_stmt_state;
|
} enum_mysqlnd_stmt_state;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct st_mysql_bind
|
typedef struct st_mysql_bind
|
||||||
{
|
{
|
||||||
unsigned long *length; /* output length pointer */
|
unsigned long *length; /* output length pointer */
|
||||||
|
@@ -126,6 +126,7 @@ static int stmt_unbuffered_fetch(MYSQL_STMT *stmt, uchar **row)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
*row = stmt->mysql->net.read_pos;
|
*row = stmt->mysql->net.read_pos;
|
||||||
|
stmt->result.rows++;
|
||||||
DBUG_RETURN(0);
|
DBUG_RETURN(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -459,6 +459,7 @@ static int test_opt_reconnect(MYSQL *mysql)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int test_compress(MYSQL *mysql)
|
static int test_compress(MYSQL *mysql)
|
||||||
{
|
{
|
||||||
MYSQL_RES *res;
|
MYSQL_RES *res;
|
||||||
@@ -492,6 +493,44 @@ static int test_compress(MYSQL *mysql)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int test_reconnect(MYSQL *mysql)
|
||||||
|
{
|
||||||
|
my_bool my_true= TRUE;
|
||||||
|
MYSQL *mysql1;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
mysql1= mysql_init(NULL);
|
||||||
|
FAIL_IF(!mysql1, "not enough memory");
|
||||||
|
|
||||||
|
FAIL_UNLESS(mysql1->reconnect == 0, "reconnect != 0");
|
||||||
|
|
||||||
|
rc= mysql_options(mysql1, MYSQL_OPT_RECONNECT, &my_true);
|
||||||
|
check_mysql_rc(rc, mysql1);
|
||||||
|
|
||||||
|
FAIL_UNLESS(mysql1->reconnect == 1, "reconnect != 1");
|
||||||
|
|
||||||
|
if (!(mysql_real_connect(mysql1, hostname, username,
|
||||||
|
password, schema, port,
|
||||||
|
socketname, 0)))
|
||||||
|
{
|
||||||
|
diag("connection failed");
|
||||||
|
mysql_close(mysql);
|
||||||
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
FAIL_UNLESS(mysql1->reconnect == 1, "reconnect != 1");
|
||||||
|
|
||||||
|
diag("Thread_id before kill: %d", mysql_thread_id(mysql1));
|
||||||
|
mysql_kill(mysql, mysql_thread_id(mysql1));
|
||||||
|
|
||||||
|
rc= mysql_query(mysql1, "SELECT 1 FROM DUAL LIMIT 0");
|
||||||
|
check_mysql_rc(rc, mysql1);
|
||||||
|
diag("Thread_id after kill: %d", mysql_thread_id(mysql1));
|
||||||
|
|
||||||
|
mysql_close(mysql1);
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
||||||
struct my_tests_st my_tests[] = {
|
struct my_tests_st my_tests[] = {
|
||||||
{"test_bug20023", test_bug20023, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
{"test_bug20023", test_bug20023, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
||||||
{"test_bug31669", test_bug31669, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
{"test_bug31669", test_bug31669, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
||||||
@@ -499,6 +538,7 @@ struct my_tests_st my_tests[] = {
|
|||||||
{"test_change_user", test_change_user, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
{"test_change_user", test_change_user, TEST_CONNECTION_NEW, 0, NULL, NULL},
|
||||||
{"test_opt_reconnect", test_opt_reconnect, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
{"test_opt_reconnect", test_opt_reconnect, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||||
{"test_compress", test_compress, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
{"test_compress", test_compress, TEST_CONNECTION_NONE, 0, NULL, NULL},
|
||||||
|
{"test_reconnect", test_reconnect, TEST_CONNECTION_DEFAULT, 0, NULL, NULL},
|
||||||
{NULL, NULL, 0, 0, NULL, NULL}
|
{NULL, NULL, 0, 0, NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user