diff options
author | unknown <monty@mysql.com> | 2005-11-24 02:56:12 +0200 |
---|---|---|
committer | unknown <monty@mysql.com> | 2005-11-24 02:56:12 +0200 |
commit | 81b2bbac056f21b0783f21a5830c07aba4850d85 (patch) | |
tree | 586e1c8d17361d92a7ddb4190893e1d6527e6fc9 /sql/examples | |
parent | fe245ed8ba1258e1f3920e449338ea92e3a3a96e (diff) | |
parent | 97bfd41fe1382ff33a9fc458c0bd092342b217e5 (diff) | |
download | mariadb-git-81b2bbac056f21b0783f21a5830c07aba4850d85.tar.gz |
Merge mysql.com:/home/my/mysql-5.0
into mysql.com:/home/my/mysql-5.1
BitKeeper/etc/ignore:
auto-union
include/my_global.h:
Auto merged
mysql-test/mysql-test-run.pl:
Auto merged
mysql-test/r/grant.result:
Auto merged
sql/ha_federated.cc:
Auto merged
sql/mysql_priv.h:
Auto merged
sql/slave.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_class.cc:
Auto merged
sql/examples/ha_tina.h:
Auto merged
sql/sql_insert.cc:
Auto merged
sql/sql_parse.cc:
Auto merged
sql/sql_udf.cc:
Auto merged
sql/tztime.cc:
Auto merged
sql/unireg.h:
Auto merged
sql/examples/ha_tina.cc:
manual merge
sql/share/errmsg.txt:
manual merge
Diffstat (limited to 'sql/examples')
-rw-r--r-- | sql/examples/ha_tina.cc | 18 | ||||
-rw-r--r-- | sql/examples/ha_tina.h | 1 |
2 files changed, 15 insertions, 4 deletions
diff --git a/sql/examples/ha_tina.cc b/sql/examples/ha_tina.cc index 6bb883f91e0..16815a9705b 100644 --- a/sql/examples/ha_tina.cc +++ b/sql/examples/ha_tina.cc @@ -298,7 +298,7 @@ ha_tina::ha_tina(TABLE *table_arg) These are not probably completely right. */ current_position(0), next_position(0), chain_alloced(0), - chain_size(DEFAULT_CHAIN_LENGTH) + chain_size(DEFAULT_CHAIN_LENGTH), records_is_known(0) { /* Set our original buffers from pre-allocated memory */ buffer.set(byte_buffer, IO_SIZE, system_charset_info); @@ -534,6 +534,7 @@ int ha_tina::write_row(byte * buf) */ if (get_mmap(share, 0) > 0) DBUG_RETURN(-1); + records++; DBUG_RETURN(0); } @@ -700,6 +701,7 @@ int ha_tina::rnd_init(bool scan) current_position= next_position= 0; records= 0; + records_is_known= 0; chain_ptr= chain; #ifdef HAVE_MADVISE if (scan) @@ -781,7 +783,7 @@ void ha_tina::info(uint flag) { DBUG_ENTER("ha_tina::info"); /* 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; DBUG_VOID_RETURN; } @@ -818,6 +820,8 @@ int ha_tina::rnd_end() { DBUG_ENTER("ha_tina::rnd_end"); + records_is_known= 1; + /* First position will be truncate position, second will be increment */ if ((chain_ptr - chain) > 0) { @@ -862,18 +866,24 @@ int ha_tina::rnd_end() DBUG_RETURN(0); } -/* - Truncate table and others of its ilk call this. + +/* + DELETE without WHERE calls this */ + int 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)); if (get_mmap(share, 0) > 0) DBUG_RETURN(-1); + records=0; DBUG_RETURN(rc); } diff --git a/sql/examples/ha_tina.h b/sql/examples/ha_tina.h index 2de6d8c8257..eab8c01c9ec 100644 --- a/sql/examples/ha_tina.h +++ b/sql/examples/ha_tina.h @@ -53,6 +53,7 @@ class ha_tina: public handler tina_set *chain_ptr; byte chain_alloced; uint32 chain_size; + bool records_is_known; public: ha_tina(TABLE *table_arg); |