1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

handler interface cleanups:

more logical table/index_flags
  return  HA_ERR_WRONG_COMMAND instead of abstract methods where appropriate
  max_keys and other limits renamed to max_supported_keys/etc
  max_keys/etc are now wrappers to max_supported_keys/etc 
  ha_index_init/ha_rnd_init/ha_index_end/ha_rnd_end are now wrappers to real {index,rnd}_{init,end} to enforce strict pairing


include/myisam.h:
  increasing myisam_max_temp_file_length
include/my_base.h:
  handler interface cleanup
myisam/mi_static.c:
  warning removed
mysql-test/Makefile.am:
  followup
mysql-test/r/fulltext.result:
  fulltext indexes are not ordered
mysql-test/r/rpl_user_variables.result:
  followup
sql/field.cc:
  index_flags
sql/filesort.cc:
  rnd_init -> ha_rnd_init
  rnd_end -> ha_rnd_end
sql/ha_berkeley.cc:
  cleanup
sql/ha_berkeley.h:
  table/index_flags revamped
sql/ha_heap.cc:
  ensure index is accessed only after index_init (esp. important for temp tables)
sql/ha_heap.h:
  table/index_flags revamped
sql/ha_innodb.cc:
  don't workaround MySQL sloppiness
sql/ha_innodb.h:
  table/index_flags revamped
sql/ha_isam.h:
  table/index_flags revamped
sql/ha_isammrg.h:
  table/index_flags revamped
sql/ha_myisam.cc:
  ensure index is accessed only after index_init (esp. important for temp tables)
sql/ha_myisam.h:
  table/index_flags revamped
sql/ha_myisammrg.h:
  table/index_flags revamped
sql/handler.cc:
  handler interface cleanups
sql/handler.h:
  handler interface cleanups:
    more logical table/index_flags
    return  HA_ERR_WRONG_COMMAND instead of abstract methods
    max_keys and other limits renamed to max_supported_keys/etc
    max_keys/etc are now wrappers to max_supported_keys/etc 
    ha_index_init/ha_rnd_init/ha_index_end/ha_rnd_end are now wrappers to enforce strict pairing
sql/item_subselect.cc:
  index_init/index_end/rnd_init/rnd_end strict pairing fixed
sql/lex.h:
  renamed to avoid conflicts
sql/opt_range.cc:
  index_init/index_end/rnd_init/rnd_end strict pairing fixed
  table/index_flags cleanup
sql/opt_range.h:
  index_init/index_end/rnd_init/rnd_end strict pairing fixed
sql/opt_sum.cc:
  index_init/index_end/rnd_init/rnd_end strict pairing fixed
  table/index_flags cleanup
sql/records.cc:
  index_init/index_end/rnd_init/rnd_end strict pairing fixed
sql/sql_acl.cc:
  index_init/index_end/rnd_init/rnd_end strict pairing fixed
sql/sql_cache.cc:
  cleanup
sql/sql_delete.cc:
  index_init/index_end/rnd_init/rnd_end strict pairing fixed
sql/sql_handler.cc:
  index_init/index_end/rnd_init/rnd_end strict pairing fixed
sql/sql_help.cc:
  index_init/index_end/rnd_init/rnd_end strict pairing fixed
sql/sql_insert.cc:
  table/index_flags cleanup
sql/sql_select.cc:
  index_init/index_end/rnd_init/rnd_end strict pairing fixed
  table/index_flags cleanup
sql/sql_table.cc:
  index_init/index_end/rnd_init/rnd_end strict pairing fixed
  table/index_flags cleanup
sql/sql_update.cc:
  index_init/index_end/rnd_init/rnd_end strict pairing fixed
sql/sql_yacc.yy:
  INDEX -> INDEX_SYM
sql/table.cc:
  table/index_flags cleanup
This commit is contained in:
unknown
2004-06-23 12:29:05 +02:00
parent 16c5f173e8
commit 9a554b4751
38 changed files with 562 additions and 660 deletions

View File

@@ -37,8 +37,6 @@
#endif
#ifdef HAVE_INNOBASE_DB
#include "ha_innodb.h"
#else
#define innobase_query_caching_of_table_permitted(X,Y,Z) 1
#endif
#ifdef HAVE_NDBCLUSTER_DB
#include "ha_ndbcluster.h"
@@ -210,6 +208,18 @@ handler *get_new_handler(TABLE *table, enum db_type db_type)
}
}
bool ha_caching_allowed(THD* thd, char* table_key,
uint key_length, uint8 cache_type)
{
#ifdef HAVE_INNOBASE_DB
if (cache_type == HA_CACHE_TBL_ASKTRANSACT)
return innobase_query_caching_of_table_permitted(thd, table_key,
key_length);
else
#endif
return 1;
}
int ha_init()
{
int error= 0;
@@ -856,46 +866,6 @@ int handler::ha_open(const char *name, int mode, int test_if_locked)
DBUG_RETURN(error);
}
int handler::check(THD* thd, HA_CHECK_OPT* check_opt)
{
return HA_ADMIN_NOT_IMPLEMENTED;
}
int handler::backup(THD* thd, HA_CHECK_OPT* check_opt)
{
return HA_ADMIN_NOT_IMPLEMENTED;
}
int handler::restore(THD* thd, HA_CHECK_OPT* check_opt)
{
return HA_ADMIN_NOT_IMPLEMENTED;
}
int handler::repair(THD* thd, HA_CHECK_OPT* check_opt)
{
return HA_ADMIN_NOT_IMPLEMENTED;
}
int handler::optimize(THD* thd, HA_CHECK_OPT* check_opt)
{
return HA_ADMIN_NOT_IMPLEMENTED;
}
int handler::analyze(THD* thd, HA_CHECK_OPT* check_opt)
{
return HA_ADMIN_NOT_IMPLEMENTED;
}
int handler::assign_to_keycache(THD* thd, HA_CHECK_OPT* check_opt)
{
return HA_ADMIN_NOT_IMPLEMENTED;
}
int handler::preload_keys(THD* thd, HA_CHECK_OPT* check_opt)
{
return HA_ADMIN_NOT_IMPLEMENTED;
}
/*
Read first row (only) from a table
This is never called for InnoDB or BDB tables, as these table types
@@ -913,35 +883,23 @@ int handler::read_first_row(byte * buf, uint primary_key)
If there is very few deleted rows in the table, find the first row by
scanning the table.
*/
if (deleted < 10 || primary_key >= MAX_KEY ||
!(index_flags(primary_key) & HA_READ_ORDER))
if (deleted < 10 || primary_key >= MAX_KEY)
{
(void) rnd_init();
(void) ha_rnd_init(1);
while ((error= rnd_next(buf)) == HA_ERR_RECORD_DELETED) ;
(void) rnd_end();
(void) ha_rnd_end();
}
else
{
/* Find the first row through the primary key */
(void) index_init(primary_key);
(void) ha_index_init(primary_key);
error=index_first(buf);
(void) index_end();
(void) ha_index_end();
}
DBUG_RETURN(error);
}
/*
The following function is only needed for tables that may be temporary tables
during joins
*/
int handler::restart_rnd_next(byte *buf, byte *pos)
{
return HA_ERR_WRONG_COMMAND;
}
/* Set a timestamp in record */
void handler::update_timestamp(byte *record)
@@ -1156,7 +1114,7 @@ void handler::print_error(int error, myf errflag)
bool handler::get_error_message(int error, String* buf)
{
return false;
return FALSE;
}
@@ -1225,28 +1183,6 @@ int handler::index_next_same(byte *buf, const byte *key, uint keylen)
}
/*
This is called to delete all rows in a table
If the handler don't support this, then this function will
return HA_ERR_WRONG_COMMAND and MySQL will delete the rows one
by one.
*/
int handler::delete_all_rows()
{
return (my_errno=HA_ERR_WRONG_COMMAND);
}
bool handler::caching_allowed(THD* thd, char* table_key,
uint key_length, uint8 cache_type)
{
if (cache_type == HA_CACHE_TBL_ASKTRANSACT)
return innobase_query_caching_of_table_permitted(thd, table_key,
key_length);
else
return 1;
}
/****************************************************************************
** Some general functions that isn't in the handler class
****************************************************************************/
@@ -1269,8 +1205,6 @@ int ha_create_table(const char *name, HA_CREATE_INFO *create_info,
if (update_create_info)
{
update_create_info_from_table(create_info, &table);
if (table.file->table_flags() & HA_DROP_BEFORE_CREATE)
table.file->delete_table(name);
}
if (lower_case_table_names == 2 &&
!(table.file->table_flags() & HA_FILE_BASED))
@@ -1527,3 +1461,15 @@ int handler::compare_key(key_range *range)
cmp= key_compare_result_on_equal;
return cmp;
}
int handler::index_read_idx(byte * buf, uint index, const byte * key,
uint key_len, enum ha_rkey_function find_flag)
{
int error= ha_index_init(index);
if (!error)
error= index_read(buf, key, key_len, find_flag);
if (!error)
error= ha_index_end();
return error;
}