diff options
author | monty@mysql.com <> | 2005-01-06 16:59:29 +0200 |
---|---|---|
committer | monty@mysql.com <> | 2005-01-06 16:59:29 +0200 |
commit | ef74d8d89880fe5c76971f5cc22a11184445f6d6 (patch) | |
tree | 52613241dc7c0cb3ac99bd8da61be5bf2aa09faa | |
parent | bda0a781841d340fe559432ed91707e66b73d484 (diff) | |
download | mariadb-git-ef74d8d89880fe5c76971f5cc22a11184445f6d6.tar.gz |
Fixed a bug in prepared statements error handling
After merge fixes
-rw-r--r-- | libmysql/libmysql.c | 7 | ||||
-rw-r--r-- | mysql-test/r/delayed.result | 3 | ||||
-rw-r--r-- | mysql-test/t/delayed.test | 4 | ||||
-rw-r--r-- | sql/sql_base.cc | 6 | ||||
-rw-r--r-- | sql/sql_prepare.cc | 4 |
5 files changed, 16 insertions, 8 deletions
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index 209dcf5756a..29c6f469098 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -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; diff --git a/mysql-test/r/delayed.result b/mysql-test/r/delayed.result index ceb511a7891..e9766622cf6 100644 --- a/mysql-test/r/delayed.result +++ b/mysql-test/r/delayed.result @@ -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 diff --git a/mysql-test/t/delayed.test b/mysql-test/t/delayed.test index 40bd7a912f3..513de990165 100644 --- a/mysql-test/t/delayed.test +++ b/mysql-test/t/delayed.test @@ -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; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index f915fc68bd9..405d95bf456 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -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 { diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 3afe810321e..6364d5ae039 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -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); } |