From 8d7eb4a0e5b7d71e09c689fcc0318382c780302e Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 3 Jul 2003 20:57:51 +0500 Subject: Proposed fix for #751 Fields in key_expr (mysql_ha_read) wasn't linked to tables. Hmm. How did it work at all? mysql-test/r/alias.result: It's better to delete table after the test mysql-test/r/handler.result: appropriate result mysql-test/t/alias.test: it's better to drop table after test mysql-test/t/handler.test: test case for #751 sql/sql_handler.cc: fix_fields called --- sql/sql_handler.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'sql/sql_handler.cc') diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index a98b6c13a00..c80c0444cb5 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -193,6 +193,8 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, Item *item; for (key_len=0 ; (item=it_ke++) ; key_part++) { + if (item->fix_fields(thd, tables)) + return -1; item->save_in_field(key_part->field, 1); key_len+=key_part->store_length; } -- cgit v1.2.1 From 4b50f4f252bf28b628475339e320d7a927c90459 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 4 Jul 2003 12:55:25 +0200 Subject: handler should be used with constant expressions only (or rand) --- sql/sql_handler.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sql/sql_handler.cc') diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index c80c0444cb5..42cfcb51377 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -194,7 +194,12 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, for (key_len=0 ; (item=it_ke++) ; key_part++) { if (item->fix_fields(thd, tables)) - return -1; + goto err; + if (item->used_tables() & ~RAND_TABLE_BIT) + { + my_error(ER_WRONG_ARGUMENTS,MYF(0),"HANDLER ... READ"); + goto err; + } item->save_in_field(key_part->field, 1); key_len+=key_part->store_length; } -- cgit v1.2.1 From 30341167c50dd59ecdd11100b0d5e2fec14ca02b Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 4 Jul 2003 17:15:16 +0500 Subject: fix and test case for the bug #787: HANDLER without INDEX doesn't work with deleted rows mysql-test/r/handler.result: test case for the bug #787: HANDLER without INDEX doesn't work with deleted rows mysql-test/t/handler.test: test case for the bug #787: HANDLER without INDEX doesn't work with deleted rows sql/sql_handler.cc: fix for the bug #787: HANDLER without INDEX doesn't work with deleted rows --- sql/sql_handler.cc | 39 +++++++++++++++++---------------------- 1 file changed, 17 insertions(+), 22 deletions(-) (limited to 'sql/sql_handler.cc') diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index 42cfcb51377..e685ea3a059 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -219,6 +219,8 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, goto err; } + if (err == HA_ERR_RECORD_DELETED) + continue; if (err) { if (err != HA_ERR_KEY_NOT_FOUND && err != HA_ERR_END_OF_FILE) @@ -230,31 +232,24 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, } goto ok; } - if (cond) + if (cond && !cond->val_int()) + continue; + if (!err && num_rows >= offset_limit) { - err=err; - if (!cond->val_int()) - continue; - } - if (num_rows>=offset_limit) - { - if (!err) + String *packet = &thd->packet; + Item *item; + packet->length(0); + it.rewind(); + while ((item=it++)) { - String *packet = &thd->packet; - Item *item; - packet->length(0); - it.rewind(); - while ((item=it++)) - { - if (item->send(thd,packet)) - { - packet->free(); // Free used - my_error(ER_OUT_OF_RESOURCES,MYF(0)); - goto err; - } - } - my_net_write(&thd->net, (char*)packet->ptr(), packet->length()); + if (item->send(thd,packet)) + { + packet->free(); // Free used + my_error(ER_OUT_OF_RESOURCES,MYF(0)); + goto err; + } } + my_net_write(&thd->net, (char*)packet->ptr(), packet->length()); } num_rows++; } -- cgit v1.2.1 From 4e61b75d8b43a38f3cdf667780e000202137e4d9 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 4 Jul 2003 23:06:19 +0300 Subject: Remove compiler warnings Simple cleanup of previous pull sql/item_strfunc.cc: Removed compiler warning sql/sql_cache.cc: Indentation fix sql/sql_handler.cc: Simple ptimization sql/sql_parse.cc: Removed compiler warning sql/log_event.h: Indentation fix --- sql/sql_handler.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/sql_handler.cc') diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index e685ea3a059..b0d8b18dd17 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -234,7 +234,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, } if (cond && !cond->val_int()) continue; - if (!err && num_rows >= offset_limit) + if (num_rows >= offset_limit) { String *packet = &thd->packet; Item *item; -- cgit v1.2.1