Commit 2d350a1d authored by ram@mysql.r18.ru's avatar ram@mysql.r18.ru

Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1

into mysql.r18.ru:/usr/home/ram/work/4.1
parents 110b497c 2927f2a2
...@@ -148,3 +148,22 @@ alter table t1 type=MyISAM; ...@@ -148,3 +148,22 @@ alter table t1 type=MyISAM;
handler t2 read first; handler t2 read first;
ERROR 42S02: Unknown table 't2' in HANDLER ERROR 42S02: Unknown table 't2' in HANDLER
drop table t1; drop table t1;
create table t1 (a int);
insert into t1 values (1),(2),(3),(4),(5),(6);
delete from t1 limit 2;
handler t1 open;
handler t1 read first;
a
3
handler t1 read first limit 1,1;
a
4
handler t1 read first limit 2,2;
a
5
6
delete from t1 limit 3;
handler t1 read first;
a
6
drop table t1;
...@@ -85,3 +85,17 @@ alter table t1 type=MyISAM; ...@@ -85,3 +85,17 @@ alter table t1 type=MyISAM;
handler t2 read first; handler t2 read first;
drop table t1; drop table t1;
#
# test case for the bug #787
#
create table t1 (a int);
insert into t1 values (1),(2),(3),(4),(5),(6);
delete from t1 limit 2;
handler t1 open;
handler t1 read first;
handler t1 read first limit 1,1;
handler t1 read first limit 2,2;
delete from t1 limit 3;
handler t1 read first;
drop table t1;
...@@ -222,6 +222,8 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, ...@@ -222,6 +222,8 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
goto err; goto err;
} }
if (err == HA_ERR_RECORD_DELETED)
continue;
if (err) if (err)
{ {
if (err != HA_ERR_KEY_NOT_FOUND && err != HA_ERR_END_OF_FILE) if (err != HA_ERR_KEY_NOT_FOUND && err != HA_ERR_END_OF_FILE)
...@@ -233,31 +235,24 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables, ...@@ -233,31 +235,24 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
} }
goto ok; goto ok;
} }
if (cond) if (cond && !cond->val_int())
continue;
if (!err && num_rows >= offset_limit)
{ {
err=err; String *packet = &thd->packet;
if (!cond->val_int()) Item *item;
continue; protocol->prepare_for_resend();
} it.rewind();
if (num_rows >= offset_limit) while ((item=it++))
{
if (!err)
{ {
String *packet = &thd->packet; if (item->send(thd->protocol, &buffer))
Item *item; {
protocol->prepare_for_resend(); protocol->free(); // Free used
it.rewind(); my_error(ER_OUT_OF_RESOURCES,MYF(0));
while ((item=it++)) goto err;
{ }
if (item->send(thd->protocol, &buffer))
{
protocol->free(); // Free used
my_error(ER_OUT_OF_RESOURCES,MYF(0));
goto err;
}
}
protocol->write();
} }
protocol->write();
} }
num_rows++; num_rows++;
} }
......
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