Commit 7d705799 authored by monty@mysql.com's avatar monty@mysql.com

Fixed failing tests for not 32 bit intel machines

Fixed bug in mysql_stmt_fetch() when retrieving rows to return
parent 834c47f3
drop table if exists t1,t2;
drop database if exists client_test_db;
create table t1
(
a int primary key,
......
......@@ -185,7 +185,7 @@ explain select st_a from t1 ignore index (st_a) where st_a=1 and st_b=1;
#
# Different value on 32 and 64 bit
--replace sta_swt12a sta_swt21a
--replace_result sta_swt12a sta_swt21a sta_swt12a, sta_swt12a,
explain select * from t1 where st_a=1 and swt1a=1 and swt2a=1;
explain select * from t1 where st_b=1 and swt1b=1 and swt2b=1;
......
......@@ -3,6 +3,9 @@
#
--disable_warnings
drop table if exists t1,t2;
# Avoid wrong warnings if mysql_client_test fails
drop database if exists client_test_db;
--enable_warnings
create table t1
......
......@@ -650,6 +650,7 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
NET *net= &mysql->net;
my_bool result= 1;
init_sigpipe_variables
DBUG_ENTER("cli_advanced_command");
/* Don't give sigpipe errors if the client doesn't want them */
set_sigpipe(mysql);
......@@ -657,13 +658,13 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
if (mysql->net.vio == 0)
{ /* Do reconnect if possible */
if (mysql_reconnect(mysql))
return 1;
DBUG_RETURN(1);
}
if (mysql->status != MYSQL_STATUS_READY)
{
DBUG_PRINT("error",("state: %d", mysql->status));
set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate);
return 1;
DBUG_RETURN(1);
}
net->last_error[0]=0;
......@@ -702,7 +703,8 @@ cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
1 : 0);
end:
reset_sigpipe(mysql);
return result;
DBUG_PRINT("exit",("result: %d", result));
DBUG_RETURN(result);
}
void free_old_query(MYSQL *mysql)
......@@ -2458,6 +2460,7 @@ get_info:
mysql->status= MYSQL_STATUS_GET_RESULT;
mysql->field_count= (uint) field_count;
mysql->warning_count= 0;
DBUG_PRINT("exit",("ok"));
DBUG_RETURN(0);
}
......
......@@ -1939,7 +1939,7 @@ void reset_stmt_for_execute(THD *thd, LEX *lex)
SYNOPSIS
reset_stmt_params()
stmt - prepared statement for which parameters should be reset
stmt prepared statement for which parameters should be reset
*/
static void reset_stmt_params(Prepared_statement *stmt)
......@@ -1955,6 +1955,7 @@ static void reset_stmt_params(Prepared_statement *stmt)
Executes previously prepared query.
If there is any parameters, then replace markers with the data supplied
from client, and then execute the query.
SYNOPSIS
mysql_stmt_execute()
thd Current thread
......@@ -2208,7 +2209,7 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
{
/* assume there is always place for 8-16 bytes */
ulong stmt_id= uint4korr(packet);
ulong num_rows= uint4korr(packet+=4);
ulong num_rows= uint4korr(packet+4);
Statement *stmt;
DBUG_ENTER("mysql_stmt_fetch");
......@@ -2266,7 +2267,6 @@ void mysql_stmt_reset(THD *thd, char *packet)
/* There is always space for 4 bytes in buffer */
ulong stmt_id= uint4korr(packet);
Prepared_statement *stmt;
DBUG_ENTER("mysql_stmt_reset");
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_reset")))
......
......@@ -1834,13 +1834,14 @@ Cursor::fetch(ulong num_rows)
THD *thd= join->thd;
JOIN_TAB *join_tab= join->join_tab + join->const_tables;
enum_nested_loop_state error= NESTED_LOOP_OK;
DBUG_ENTER("Cursor::fetch");
DBUG_PRINT("enter",("rows: %lu", num_rows));
/* save references to memory, allocated during fetch */
thd->set_n_backup_item_arena(this, &thd->stmt_backup);
join->fetch_limit+= num_rows;
error= sub_select(join, join_tab, 0);
if (error == NESTED_LOOP_OK || error == NESTED_LOOP_NO_MORE_ROWS)
error= sub_select(join,join_tab,1);
......@@ -1873,6 +1874,7 @@ Cursor::fetch(ulong num_rows)
else if (error != NESTED_LOOP_KILLED)
my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0));
}
DBUG_VOID_RETURN;
}
......
......@@ -71,7 +71,7 @@ static const char *embedded_server_groups[]= {
static time_t start_time, end_time;
static double total_time;
const char *default_dbug_option= "d:t:o,/tmp/client_test.trace";
const char *default_dbug_option= "d:t:o,/tmp/mysql_client_test.trace";
struct my_tests_st
{
......@@ -12942,6 +12942,7 @@ static void test_bug9478()
char a[6];
ulong a_len;
int rc, i;
DBUG_ENTER("test_bug9478");
myheader("test_bug9478");
......@@ -13014,6 +13015,7 @@ static void test_bug9478()
for (i= 0; i < 5; i++)
{
DBUG_PRINT("loop",("i: %d", i));
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
rc= mysql_stmt_fetch(stmt);
......@@ -13029,10 +13031,10 @@ static void test_bug9478()
*/
{
char buff[9];
bzero(buff, sizeof(buff));
/* Fill in the execute packet */
int4store(buff, stmt->stmt_id);
int4store(buff+5, 1);
buff[4]= 0; /* Flag */
int4store(buff+5, 1); /* Return 1 row */
rc= ((*mysql->methods->advanced_command)(mysql, COM_EXECUTE, buff,
sizeof(buff), 0,0,1) ||
(*mysql->methods->read_query_result)(mysql));
......@@ -13072,6 +13074,7 @@ static void test_bug9478()
rc= mysql_query(mysql, "drop table t1");
myquery(rc);
DBUG_VOID_RETURN;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment