Commit 00398f5e authored by georg@lmy002.wdf.sap.corp's avatar georg@lmy002.wdf.sap.corp

Merge grichter@bk-internal.mysql.com:/home/bk/mysql-5.0

into lmy002.wdf.sap.corp:/home/georg/work/mysql-5.0
parents cd20ee43 8c4cd042
...@@ -1774,6 +1774,7 @@ static int stmt_read_row_unbuffered(MYSQL_STMT *stmt, unsigned char **row); ...@@ -1774,6 +1774,7 @@ static int stmt_read_row_unbuffered(MYSQL_STMT *stmt, unsigned char **row);
static int stmt_read_row_buffered(MYSQL_STMT *stmt, unsigned char **row); static int stmt_read_row_buffered(MYSQL_STMT *stmt, unsigned char **row);
static int stmt_read_row_from_cursor(MYSQL_STMT *stmt, unsigned char **row); static int stmt_read_row_from_cursor(MYSQL_STMT *stmt, unsigned char **row);
static int stmt_read_row_no_data(MYSQL_STMT *stmt, unsigned char **row); static int stmt_read_row_no_data(MYSQL_STMT *stmt, unsigned char **row);
static int stmt_read_row_no_result_set(MYSQL_STMT *stmt, unsigned char **row);
/* /*
This function is used in mysql_stmt_store_result if This function is used in mysql_stmt_store_result if
...@@ -2036,7 +2037,7 @@ mysql_stmt_init(MYSQL *mysql) ...@@ -2036,7 +2037,7 @@ mysql_stmt_init(MYSQL *mysql)
stmt->list.data= stmt; stmt->list.data= stmt;
stmt->state= MYSQL_STMT_INIT_DONE; stmt->state= MYSQL_STMT_INIT_DONE;
stmt->mysql= mysql; stmt->mysql= mysql;
stmt->read_row_func= stmt_read_row_no_data; stmt->read_row_func= stmt_read_row_no_result_set;
stmt->prefetch_rows= DEFAULT_PREFETCH_ROWS; stmt->prefetch_rows= DEFAULT_PREFETCH_ROWS;
/* The rest of statement members was bzeroed inside malloc */ /* The rest of statement members was bzeroed inside malloc */
...@@ -2778,6 +2779,13 @@ stmt_read_row_from_cursor(MYSQL_STMT *stmt, unsigned char **row) ...@@ -2778,6 +2779,13 @@ stmt_read_row_from_cursor(MYSQL_STMT *stmt, unsigned char **row)
static int static int
stmt_read_row_no_data(MYSQL_STMT *stmt __attribute__((unused)), stmt_read_row_no_data(MYSQL_STMT *stmt __attribute__((unused)),
unsigned char **row __attribute__((unused))) unsigned char **row __attribute__((unused)))
{
return MYSQL_NO_DATA;
}
static int
stmt_read_row_no_result_set(MYSQL_STMT *stmt __attribute__((unused)),
unsigned char **row __attribute__((unused)))
{ {
set_stmt_error(stmt, CR_NO_RESULT_SET, unknown_sqlstate); set_stmt_error(stmt, CR_NO_RESULT_SET, unknown_sqlstate);
return 1; return 1;
...@@ -4600,7 +4608,8 @@ int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt) ...@@ -4600,7 +4608,8 @@ int STDCALL mysql_stmt_fetch(MYSQL_STMT *stmt)
((rc= stmt_fetch_row(stmt, row)) && rc != MYSQL_DATA_TRUNCATED)) ((rc= stmt_fetch_row(stmt, row)) && rc != MYSQL_DATA_TRUNCATED))
{ {
stmt->state= MYSQL_STMT_PREPARE_DONE; /* XXX: this is buggy */ stmt->state= MYSQL_STMT_PREPARE_DONE; /* XXX: this is buggy */
stmt->read_row_func= stmt_read_row_no_data; stmt->read_row_func= (rc == MYSQL_NO_DATA) ?
stmt_read_row_no_data : stmt_read_row_no_result_set;
} }
else else
{ {
...@@ -4937,7 +4946,7 @@ static my_bool reset_stmt_handle(MYSQL_STMT *stmt, uint flags) ...@@ -4937,7 +4946,7 @@ static my_bool reset_stmt_handle(MYSQL_STMT *stmt, uint flags)
for (; param < param_end; param++) for (; param < param_end; param++)
param->long_data_used= 0; param->long_data_used= 0;
} }
stmt->read_row_func= stmt_read_row_no_data; stmt->read_row_func= stmt_read_row_no_result_set;
if (mysql) if (mysql)
{ {
if ((int) stmt->state > (int) MYSQL_STMT_PREPARE_DONE) if ((int) stmt->state > (int) MYSQL_STMT_PREPARE_DONE)
......
...@@ -13315,7 +13315,7 @@ static void test_bug9992() ...@@ -13315,7 +13315,7 @@ static void test_bug9992()
DIE_UNLESS(rc == 1); /* Got errors, as expected */ DIE_UNLESS(rc == 1); /* Got errors, as expected */
if (!opt_silent) if (!opt_silent)
fprintf(stdout, "Got error, sa expected:\n [%d] %s\n", fprintf(stdout, "Got error, as expected:\n [%d] %s\n",
mysql_errno(mysql1), mysql_error(mysql1)); mysql_errno(mysql1), mysql_error(mysql1));
mysql_close(mysql1); mysql_close(mysql1);
...@@ -13705,6 +13705,51 @@ static void test_bug11183() ...@@ -13705,6 +13705,51 @@ static void test_bug11183()
myquery(rc); myquery(rc);
} }
static void test_bug11037()
{
MYSQL_STMT *stmt;
int rc;
const char *stmt_text;
myheader("test_bug11037");
mysql_query(mysql, "drop table if exists t1");
rc= mysql_query(mysql, "create table t1 (id int not null)");
myquery(rc);
rc= mysql_query(mysql, "insert into t1 values (1)");
myquery(rc);
stmt_text= "select id FROM t1";
stmt= mysql_stmt_init(mysql);
rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
/* expected error */
rc = mysql_stmt_fetch(stmt);
DIE_UNLESS(rc==1);
if (!opt_silent)
fprintf(stdout, "Got error, as expected:\n [%d] %s\n",
mysql_stmt_errno(stmt), mysql_stmt_error(stmt));
rc = mysql_stmt_execute(stmt);
check_execute(stmt, rc);
rc = mysql_stmt_fetch(stmt);
DIE_UNLESS(rc==0);
rc = mysql_stmt_fetch(stmt);
DIE_UNLESS(rc==MYSQL_NO_DATA);
rc = mysql_stmt_fetch(stmt);
DIE_UNLESS(rc==MYSQL_NO_DATA);
mysql_stmt_close(stmt);
rc= mysql_query(mysql, "drop table t1");
myquery(rc);
}
/* /*
Read and parse arguments and MySQL options from my.cnf Read and parse arguments and MySQL options from my.cnf
*/ */
...@@ -13948,6 +13993,7 @@ static struct my_tests_st my_tests[]= { ...@@ -13948,6 +13993,7 @@ static struct my_tests_st my_tests[]= {
{ "test_bug10214", test_bug10214 }, { "test_bug10214", test_bug10214 },
{ "test_bug9735", test_bug9735 }, { "test_bug9735", test_bug9735 },
{ "test_bug11183", test_bug11183 }, { "test_bug11183", test_bug11183 },
{ "test_bug11037", test_bug11037 },
{ 0, 0 } { 0, 0 }
}; };
......
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