Skip to content

Commit 3785ca6

Browse files
committed
Merge from 5.1 to 5.5
2 parents 2e1f259 + bb64579 commit 3785ca6

3 files changed

Lines changed: 24 additions & 7 deletions

File tree

sql/sql_prepare.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,14 @@ static bool insert_params_with_log(Prepared_statement *stmt, uchar *null_array,
875875
param->set_param_func(param, &read_pos, (uint) (data_end - read_pos));
876876
if (param->state == Item_param::NO_VALUE)
877877
DBUG_RETURN(1);
878+
879+
if (param->limit_clause_param && param->item_type != Item::INT_ITEM)
880+
{
881+
param->set_int(param->val_int(), MY_INT64_NUM_DECIMAL_DIGITS);
882+
param->item_type= Item::INT_ITEM;
883+
if (!param->unsigned_flag && param->value.integer < 0)
884+
DBUG_RETURN(1);
885+
}
878886
}
879887
}
880888
/*

tests/mysql_client_fw.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ static unsigned int opt_count= 0;
4848
static unsigned int iter_count= 0;
4949
static my_bool have_innodb= FALSE;
5050
static char *opt_plugin_dir= 0, *opt_default_auth= 0;
51+
static unsigned int opt_drop_db= 1;
5152

5253
static const char *opt_basedir= "./";
5354
static const char *opt_vardir= "mysql-test/var";
@@ -96,7 +97,7 @@ DBUG_PRINT("test", ("name: %s", str)); \
9697

9798
static void print_error(const char *msg);
9899
static void print_st_error(MYSQL_STMT *stmt, const char *msg);
99-
static void client_disconnect(MYSQL* mysql, my_bool drop_db);
100+
static void client_disconnect(MYSQL* mysql);
100101

101102

102103
/*
@@ -370,15 +371,15 @@ static MYSQL* client_connect(ulong flag, uint protocol, my_bool auto_reconnect)
370371

371372
/* Close the connection */
372373

373-
static void client_disconnect(MYSQL* mysql, my_bool drop_db)
374+
static void client_disconnect(MYSQL* mysql)
374375
{
375376
static char query[MAX_TEST_QUERY_LENGTH];
376377

377378
myheader_r("client_disconnect");
378379

379380
if (mysql)
380381
{
381-
if (drop_db)
382+
if (opt_drop_db)
382383
{
383384
if (!opt_silent)
384385
fprintf(stdout, "\n dropping the test database '%s' ...", current_db);
@@ -1162,6 +1163,8 @@ static struct my_option client_test_long_options[] =
11621163
&opt_count, 0, GET_UINT, REQUIRED_ARG, 1, 0, 0, 0, 0, 0},
11631164
{"database", 'D', "Database to use", &opt_db, &opt_db,
11641165
0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
1166+
{"do-not-drop-database", 'd', "Do not drop database while disconnecting",
1167+
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
11651168
{"debug", '#', "Output debug log", &default_dbug_option,
11661169
&default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0},
11671170
{"help", '?', "Display this help and exit", 0, 0, 0, GET_NO_ARG, NO_ARG, 0,
@@ -1265,6 +1268,9 @@ char *argument)
12651268
else
12661269
opt_silent++;
12671270
break;
1271+
case 'd':
1272+
opt_drop_db= 0;
1273+
break;
12681274
case 'A':
12691275
/*
12701276
When the embedded server is being tested, the test suite needs to be
@@ -1389,7 +1395,7 @@ int main(int argc, char **argv)
13891395
fprintf(stderr, "\n\nGiven test not found: '%s'\n", *argv);
13901396
fprintf(stderr, "See legal test names with %s -T\n\nAborting!\n",
13911397
my_progname);
1392-
client_disconnect(mysql, 1);
1398+
client_disconnect(mysql);
13931399
free_defaults(defaults_argv);
13941400
exit(1);
13951401
}
@@ -1402,7 +1408,7 @@ int main(int argc, char **argv)
14021408
/* End of tests */
14031409
}
14041410

1405-
client_disconnect(mysql, 1); /* disconnect from server */
1411+
client_disconnect(mysql); /* disconnect from server */
14061412

14071413
free_defaults(defaults_argv);
14081414
print_test_output();

tests/mysql_client_test.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17609,7 +17609,8 @@ static void test_bug43560(void)
1760917609
const char* values[] = {"eins", "zwei", "drei", "viele", NULL};
1761017610
const char insert_str[] = "INSERT INTO t1 (c2) VALUES (?)";
1761117611
unsigned long length;
17612-
17612+
const unsigned int drop_db= opt_drop_db;
17613+
1761317614
DBUG_ENTER("test_bug43560");
1761417615
myheader("test_bug43560");
1761517616

@@ -17674,9 +17675,11 @@ static void test_bug43560(void)
1767417675
rc= mysql_stmt_execute(stmt);
1767517676
DIE_UNLESS(rc && mysql_stmt_errno(stmt) == CR_SERVER_LOST);
1767617677

17677-
client_disconnect(conn, 0);
17678+
opt_drop_db= 0;
17679+
client_disconnect(conn);
1767817680
rc= mysql_query(mysql, "DROP TABLE t1");
1767917681
myquery(rc);
17682+
opt_drop_db= drop_db;
1768017683

1768117684
DBUG_VOID_RETURN;
1768217685
}

0 commit comments

Comments
 (0)