Commit ef74d8d8 authored by monty@mysql.com's avatar monty@mysql.com

Fixed a bug in prepared statements error handling

After merge fixes
parent bda0a781
......@@ -1864,12 +1864,13 @@ void set_stmt_errmsg(MYSQL_STMT * stmt, const char *err, int errcode,
my_bool cli_read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
{
uchar *pos;
uint field_count, param_count, packet_length;
uint field_count, param_count;
ulong packet_length;
MYSQL_DATA *fields_data;
DBUG_ENTER("read_prepare_result");
DBUG_ENTER("cli_read_prepare_result");
mysql= mysql->last_used_con;
if ((packet_length=net_safe_read(mysql)) == packet_error)
if ((packet_length= net_safe_read(mysql)) == packet_error)
DBUG_RETURN(1);
mysql->warning_count= 0;
......
......@@ -22,6 +22,9 @@ insert delayed into t1 values (null,"c");
insert delayed into t1 values (3,"d"),(null,"e");
insert delayed into t1 values (3,"this will give an","error");
ERROR 21S01: Column count doesn't match value count at row 1
show status like 'not_flushed_delayed_rows';
Variable_name Value
Not_flushed_delayed_rows 0
select * from t1;
a b
1 b
......
......@@ -31,6 +31,8 @@ insert delayed into t1 values (null,"c");
insert delayed into t1 values (3,"d"),(null,"e");
--error 1136
insert delayed into t1 values (3,"this will give an","error");
--sleep 2
# 2 was not enough for --ps-protocol
--sleep 4
show status like 'not_flushed_delayed_rows';
select * from t1;
drop table t1;
......@@ -2323,8 +2323,10 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
bool found_table=0;
for (; tables; tables= tables->next_local)
{
/* TODO; Ensure that db and tables->db always points to something ! */
if (!my_strcasecmp(table_alias_charset, tables->alias, table_name) &&
(!db || !tables->db || !tables->db[0] || !strcmp(db,tables->db)))
(!db || !db[0] || !tables->db || !tables->db[0] ||
!strcmp(db,tables->db)))
{
found_table=1;
Field *find= find_field_in_table(thd, tables, name, item->name,
......@@ -3039,7 +3041,7 @@ insert_fields(THD *thd, TABLE_LIST *tables, const char *db_name,
iterator= &view_iter;
view= 1;
alias_used= my_strcasecmp(table_alias_charset,
tables->real_name, tables->alias);
tables->table_name, tables->alias);
}
else
{
......
......@@ -935,7 +935,7 @@ static bool mysql_test_insert(Prepared_statement *stmt,
{
my_error(ER_ILLEGAL_HA, MYF(0), (table_list->view ?
table_list->view_name.str :
table_list->real_name));
table_list->table_name));
goto error;
}
while ((values= its++))
......@@ -1445,7 +1445,7 @@ static bool mysql_insert_select_prepare_tester(THD *thd)
and item_list belong to SELECT
*/
first_select->resolve_mode= SELECT_LEX::SELECT_MODE;
mysql_insert_select_prepare(thd);
return mysql_insert_select_prepare(thd);
}
......
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