Commit 9ac7116b authored by unknown's avatar unknown

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

into serg.mylan:/usr/home/serg/Abk/mysql-5.0

parents 32e6e6aa e98ff24c
...@@ -4976,3 +4976,27 @@ c1 ...@@ -4976,3 +4976,27 @@ c1
4 4
5 5
DROP TABLE bug14672; DROP TABLE bug14672;
create table t1 (a int) engine=csv;
insert t1 values (1);
delete from t1;
affected rows: 1
delete from t1;
affected rows: 0
insert t1 values (1),(2);
delete from t1;
affected rows: 2
insert t1 values (1),(2),(3);
flush tables;
delete from t1;
affected rows: 3
insert t1 values (1),(2),(3),(4);
flush tables;
select count(*) from t1;
count(*)
4
delete from t1;
affected rows: 4
insert t1 values (1),(2),(3),(4),(5);
truncate table t1;
affected rows: 0
drop table t1;
...@@ -1352,3 +1352,35 @@ SELECT * FROM bug14672; ...@@ -1352,3 +1352,35 @@ SELECT * FROM bug14672;
DROP TABLE bug14672; DROP TABLE bug14672;
# End of 4.1 tests # End of 4.1 tests
#
# BUG#13406 - incorrect amount of "records deleted"
#
create table t1 (a int) engine=csv;
insert t1 values (1);
--enable_info
delete from t1; -- delete_row
delete from t1; -- delete_all_rows
--disable_info
insert t1 values (1),(2);
--enable_info
delete from t1; -- delete_all_rows
--disable_info
insert t1 values (1),(2),(3);
flush tables;
--enable_info
delete from t1; -- delete_row
--disable_info
insert t1 values (1),(2),(3),(4);
flush tables;
select count(*) from t1;
--enable_info
delete from t1; -- delete_all_rows
--disable_info
insert t1 values (1),(2),(3),(4),(5);
--enable_info
truncate table t1; -- truncate
--disable_info
drop table t1;
...@@ -274,7 +274,8 @@ ha_tina::ha_tina(TABLE *table_arg) ...@@ -274,7 +274,8 @@ ha_tina::ha_tina(TABLE *table_arg)
These definitions are found in hanler.h These definitions are found in hanler.h
These are not probably completely right. These are not probably completely right.
*/ */
current_position(0), next_position(0), chain_alloced(0), chain_size(DEFAULT_CHAIN_LENGTH) current_position(0), next_position(0), chain_alloced(0),
chain_size(DEFAULT_CHAIN_LENGTH), records_is_known(0)
{ {
/* Set our original buffers from pre-allocated memory */ /* Set our original buffers from pre-allocated memory */
buffer.set(byte_buffer, IO_SIZE, system_charset_info); buffer.set(byte_buffer, IO_SIZE, system_charset_info);
...@@ -504,6 +505,7 @@ int ha_tina::write_row(byte * buf) ...@@ -504,6 +505,7 @@ int ha_tina::write_row(byte * buf)
*/ */
if (get_mmap(share, 0) > 0) if (get_mmap(share, 0) > 0)
DBUG_RETURN(-1); DBUG_RETURN(-1);
records++;
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -668,6 +670,7 @@ int ha_tina::rnd_init(bool scan) ...@@ -668,6 +670,7 @@ int ha_tina::rnd_init(bool scan)
current_position= next_position= 0; current_position= next_position= 0;
records= 0; records= 0;
records_is_known= 0;
chain_ptr= chain; chain_ptr= chain;
#ifdef HAVE_MADVISE #ifdef HAVE_MADVISE
if (scan) if (scan)
...@@ -745,7 +748,7 @@ void ha_tina::info(uint flag) ...@@ -745,7 +748,7 @@ void ha_tina::info(uint flag)
{ {
DBUG_ENTER("ha_tina::info"); DBUG_ENTER("ha_tina::info");
/* This is a lie, but you don't want the optimizer to see zero or 1 */ /* This is a lie, but you don't want the optimizer to see zero or 1 */
if (records < 2) if (!records_is_known && records < 2)
records= 2; records= 2;
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
...@@ -780,6 +783,8 @@ int ha_tina::rnd_end() ...@@ -780,6 +783,8 @@ int ha_tina::rnd_end()
{ {
DBUG_ENTER("ha_tina::rnd_end"); DBUG_ENTER("ha_tina::rnd_end");
records_is_known= 1;
/* First position will be truncate position, second will be increment */ /* First position will be truncate position, second will be increment */
if ((chain_ptr - chain) > 0) if ((chain_ptr - chain) > 0)
{ {
...@@ -824,17 +829,21 @@ int ha_tina::rnd_end() ...@@ -824,17 +829,21 @@ int ha_tina::rnd_end()
} }
/* /*
Truncate table and others of its ilk call this. DELETE without WHERE calls it
*/ */
int ha_tina::delete_all_rows() int ha_tina::delete_all_rows()
{ {
DBUG_ENTER("ha_tina::delete_all_rows"); DBUG_ENTER("ha_tina::delete_all_rows");
if (!records_is_known)
return (my_errno=HA_ERR_WRONG_COMMAND);
int rc= my_chsize(share->data_file, 0, 0, MYF(MY_WME)); int rc= my_chsize(share->data_file, 0, 0, MYF(MY_WME));
if (get_mmap(share, 0) > 0) if (get_mmap(share, 0) > 0)
DBUG_RETURN(-1); DBUG_RETURN(-1);
records=0;
DBUG_RETURN(rc); DBUG_RETURN(rc);
} }
......
...@@ -48,6 +48,7 @@ class ha_tina: public handler ...@@ -48,6 +48,7 @@ class ha_tina: public handler
tina_set *chain_ptr; tina_set *chain_ptr;
byte chain_alloced; byte chain_alloced;
uint32 chain_size; uint32 chain_size;
bool records_is_known;
public: public:
ha_tina(TABLE *table_arg); ha_tina(TABLE *table_arg);
......
...@@ -3003,15 +3003,15 @@ ER_CANT_OPEN_LIBRARY ...@@ -3003,15 +3003,15 @@ ER_CANT_OPEN_LIBRARY
swe "Kan inte ppna det dynamiska biblioteket '%-.64s' (Felkod: %d %s)" swe "Kan inte ppna det dynamiska biblioteket '%-.64s' (Felkod: %d %s)"
ukr " צ Ħ ¦̦ '%-.64s' (: %d %-.64s)" ukr " צ Ħ ¦̦ '%-.64s' (: %d %-.64s)"
ER_CANT_FIND_DL_ENTRY ER_CANT_FIND_DL_ENTRY
cze "Nemohu naj-Bt funkci '%-.64s' v knihovn'" cze "Nemohu naj-Bt funkci '%-.64s' v knihovn"
dan "Kan ikke finde funktionen '%-.64s' i bibliotek'" dan "Kan ikke finde funktionen '%-.64s' i bibliotek"
nla "Kan functie '%-.64s' niet in library vinden" nla "Kan functie '%-.64s' niet in library vinden"
eng "Can't find function '%-.64s' in library'" eng "Can't find function '%-.64s' in library"
jps "function '%-.64s' Cu[Ɍt鎖ł܂", jps "function '%-.64s' Cu[Ɍt鎖ł܂",
est "Ei leia funktsiooni '%-.64s' antud teegis" est "Ei leia funktsiooni '%-.64s' antud teegis"
fre "Impossible de trouver la fonction '%-.64s' dans la bibliothque'" fre "Impossible de trouver la fonction '%-.64s' dans la bibliothque"
ger "Kann Funktion '%-.64s' in der Library nicht finden" ger "Kann Funktion '%-.64s' in der Library nicht finden"
greek " '%-.64s' '" greek " '%-.64s' "
hun "A(z) '%-.64s' fuggveny nem talalhato a konyvtarban" hun "A(z) '%-.64s' fuggveny nem talalhato a konyvtarban"
ita "Impossibile trovare la funzione '%-.64s' nella libreria" ita "Impossibile trovare la funzione '%-.64s' nella libreria"
jpn "function '%-.64s' 饤֥꡼˸դǤޤ" jpn "function '%-.64s' 饤֥꡼˸դǤޤ"
...@@ -3020,10 +3020,10 @@ ER_CANT_FIND_DL_ENTRY ...@@ -3020,10 +3020,10 @@ ER_CANT_FIND_DL_ENTRY
rum "Nu pot gasi functia '%-.64s' in libraria" rum "Nu pot gasi functia '%-.64s' in libraria"
rus " '%-.64s' " rus " '%-.64s' "
serbian "Ne mogu da pronadjem funkciju '%-.64s' u biblioteci" serbian "Ne mogu da pronadjem funkciju '%-.64s' u biblioteci"
slo "Nemem njs funkciu '%-.64s' v kninici'" slo "Nemem njs funkciu '%-.64s' v kninici"
spa "No puedo encontrar funcin '%-.64s' en libraria'" spa "No puedo encontrar funcin '%-.64s' en libraria"
swe "Hittar inte funktionen '%-.64s' in det dynamiska biblioteket" swe "Hittar inte funktionen '%-.64s' in det dynamiska biblioteket"
ukr " æ '%-.64s' ¦̦æ'" ukr " æ '%-.64s' ¦̦æ"
ER_FUNCTION_NOT_DEFINED ER_FUNCTION_NOT_DEFINED
cze "Funkce '%-.64s' nen-B definovna" cze "Funkce '%-.64s' nen-B definovna"
dan "Funktionen '%-.64s' er ikke defineret" dan "Funktionen '%-.64s' er ikke defineret"
......
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