summaryrefslogtreecommitdiff
path: root/sql/ha_partition.cc
diff options
context:
space:
mode:
authorunknown <acurtis@xiphis.org>2005-12-21 10:18:40 -0800
committerunknown <acurtis@xiphis.org>2005-12-21 10:18:40 -0800
commit613dd50a33ac3e64073abdbdae66ce3a93e69e30 (patch)
treed777ca5871199d389af93e8cbe06e1bdbc16a10b /sql/ha_partition.cc
parent9c81773b37a5ec1a689632e3161ae6b9d1fdeb46 (diff)
downloadmariadb-git-613dd50a33ac3e64073abdbdae66ce3a93e69e30.tar.gz
Finalize storage engine plugins
Give BerkeleyDB savepoints Remove "enum db_type" from most of the code storage/example/ha_example.h: Rename: sql/examples/ha_example.h -> storage/example/ha_example.h storage/csv/ha_tina.h: Rename: sql/examples/ha_tina.h -> storage/csv/ha_tina.h config/ac-macros/storage.m4: if hton name is "no", then we don't install it as a builtin configure.in: pluggable changes include/plugin.h: version field mysql-test/r/bdb.result: savepoint results copied from innodb test mysql-test/r/information_schema.result: PLUGINS information schema mysql-test/r/information_schema_db.result: PLUGINS information schema mysql-test/t/bdb.test: savepoint test copied from innodb test sql/Makefile.am: tina and example are not here anymore sql/authors.h: minor tweek sql/ha_archive.cc: remove unwanted handlerton entries sql/ha_berkeley.cc: remove unwanted handlerton entries support for savepoints changes to show logs sql/ha_blackhole.cc: remove unwanted handlerton entries sql/ha_federated.cc: remove unwanted handlerton entries sql/ha_heap.cc: remove unwanted handlerton entries sql/ha_innodb.cc: remove unwanted handlerton entries changes for show status sql/ha_myisam.cc: remove unwanted handlerton entries sql/ha_myisammrg.cc: remove unwanted handlerton entries sql/ha_ndbcluster.cc: remove unwanted handlerton entries changes to stat_print sql/ha_partition.cc: remove unwanted handlerton entries bye bye enum db_type sql/ha_partition.h: bye bye enum db_type sql/handler.cc: remove unwanted handlerton entries bye bye enum db_type sql/handler.h: remove unwanted handlerton entries bye bye enum db_type changes to stat_print_fn sql/item_sum.cc: bye bye enum db_type sql/log.cc: remove unwanted handlerton entries sql/mysql_priv.h: bye bye enum db_type sql/mysqld.cc: bye bye enum db_type reorder plugin initialization sql/set_var.cc: bye bye enum db_type sql/set_var.h: bye bye enum db_type sql/sql_base.cc: bye bye enum db_type sql/sql_cache.cc: bye bye enum db_type sql/sql_class.h: bye bye enum db_type sql/sql_delete.cc: bye bye enum db_type sql/sql_insert.cc: bye bye enum db_type sql/sql_lex.h: show plugin sql/sql_parse.cc: bye bye enum db_type sql/sql_partition.cc: bye bye enum db_type sql/sql_plugin.cc: loadable storage engines sql/sql_plugin.h: loadable storage engines sql/sql_rename.cc: bye bye enum db_type sql/sql_select.cc: bye bye enum db_type sql/sql_show.cc: SHOW PLUGIN PLUGINS information schema changes to show engines sql/sql_table.cc: bye bye enum db_type sql/sql_view.cc: bye bye enum db_type sql/sql_view.h: bye bye enum db_type sql/sql_yacc.yy: bye bye enum db_type sql/table.cc: bye bye enum db_type sql/table.h: bye bye enum db_type sql/unireg.cc: bye bye enum db_type storage/csv/ha_tina.cc: make tina into a loadable plugin storage/example/ha_example.cc: make into a plugin storage/csv/Makefile.am: New BitKeeper file ``storage/csv/Makefile.am'' storage/example/Makefile.am: New BitKeeper file ``storage/example/Makefile.am''
Diffstat (limited to 'sql/ha_partition.cc')
-rw-r--r--sql/ha_partition.cc26
1 files changed, 15 insertions, 11 deletions
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 650830832cb..2c6fde77abd 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -69,6 +69,7 @@ static PARTITION_SHARE *get_share(const char *table_name, TABLE * table);
static handler *partition_create_handler(TABLE_SHARE *share);
handlerton partition_hton = {
+ MYSQL_HANDLERTON_INTERFACE_VERSION,
"partition",
SHOW_OPTION_YES,
"Partition Storage Engine Helper", /* A comment used by SHOW to describe an engine */
@@ -92,12 +93,9 @@ handlerton partition_hton = {
partition_create_handler, /* Create a new handler */
NULL, /* Drop a database */
NULL, /* Panic call */
- NULL, /* Release temporary latches */
- NULL, /* Update Statistics */
NULL, /* Start Consistent Snapshot */
NULL, /* Flush logs */
NULL, /* Show status */
- NULL, /* Replication Report Sent Binlog */
HTON_NOT_USER_SELECTABLE
};
@@ -697,6 +695,7 @@ bool ha_partition::create_handler_file(const char *name)
void ha_partition::clear_handler_file()
{
my_free((char*) m_file_buffer, MYF(MY_ALLOW_ZERO_PTR));
+ my_free((char*) m_engine_array, MYF(MY_ALLOW_ZERO_PTR));
m_file_buffer= NULL;
m_name_buffer_ptr= NULL;
m_engine_array= NULL;
@@ -715,18 +714,19 @@ bool ha_partition::create_handlers()
for (i= 0; i < m_tot_parts; i++)
{
if (!(m_file[i]= get_new_handler(table_share, current_thd->mem_root,
- (enum db_type) m_engine_array[i])))
+ m_engine_array[i])))
DBUG_RETURN(TRUE);
DBUG_PRINT("info", ("engine_type: %u", m_engine_array[i]));
}
m_file[m_tot_parts]= 0;
/* For the moment we only support partition over the same table engine */
- if (m_engine_array[0] == (uchar) DB_TYPE_MYISAM)
+ if (m_engine_array[0] == &myisam_hton)
{
DBUG_PRINT("info", ("MyISAM"));
m_myisam= TRUE;
}
- else if (m_engine_array[0] == (uchar) DB_TYPE_INNODB)
+ /* INNODB may not be compiled in... */
+ else if (ha_legacy_type(m_engine_array[0]) == DB_TYPE_INNODB)
{
DBUG_PRINT("info", ("InnoDB"));
m_innodb= TRUE;
@@ -761,7 +761,7 @@ bool ha_partition::new_handlers_from_part_info()
if (!(m_file[i]= get_new_handler(table_share, thd->mem_root,
part_elem->engine_type)))
goto error;
- DBUG_PRINT("info", ("engine_type: %u", (uint) part_elem->engine_type));
+ DBUG_PRINT("info", ("engine_type: %u", (uint) ha_legacy_type(part_elem->engine_type)));
if (m_is_sub_partitioned)
{
for (j= 0; j < m_part_info->no_subparts; j++)
@@ -769,11 +769,11 @@ bool ha_partition::new_handlers_from_part_info()
if (!(m_file[i]= get_new_handler(table_share, thd->mem_root,
part_elem->engine_type)))
goto error;
- DBUG_PRINT("info", ("engine_type: %u", (uint) part_elem->engine_type));
+ DBUG_PRINT("info", ("engine_type: %u", (uint) ha_legacy_type(part_elem->engine_type)));
}
}
} while (++i < m_part_info->no_parts);
- if (part_elem->engine_type == DB_TYPE_MYISAM)
+ if (part_elem->engine_type == &myisam_hton)
{
DBUG_PRINT("info", ("MyISAM"));
m_myisam= TRUE;
@@ -795,7 +795,7 @@ bool ha_partition::get_from_handler_file(const char *name)
char buff[FN_REFLEN], *address_tot_name_len;
File file;
char *file_buffer, *name_buffer_ptr;
- uchar *engine_array;
+ handlerton **engine_array;
uint i, len_bytes, len_words, tot_partition_words, tot_name_words, chksum;
DBUG_ENTER("ha_partition::get_from_handler_file");
DBUG_PRINT("enter", ("table name: '%s'", name));
@@ -824,7 +824,11 @@ bool ha_partition::get_from_handler_file(const char *name)
goto err2;
m_tot_parts= uint4korr((file_buffer) + 8);
tot_partition_words= (m_tot_parts + 3) / 4;
- engine_array= (uchar *) ((file_buffer) + 12);
+ if (!(engine_array= (handlerton **) my_malloc(m_tot_parts * sizeof(handlerton*),MYF(0))))
+ goto err2;
+ for (i= 0; i < m_tot_parts; i++)
+ engine_array[i]= ha_resolve_by_legacy_type(current_thd,
+ (enum legacy_db_type) *(uchar *) ((file_buffer) + 12 + i));
address_tot_name_len= file_buffer + 12 + 4 * tot_partition_words;
tot_name_words= (uint4korr(address_tot_name_len) + 3) / 4;
if (len_words != (tot_partition_words + tot_name_words + 4))