summaryrefslogtreecommitdiff
path: root/sql/examples
diff options
context:
space:
mode:
authorunknown <brian@zim.(none)>2005-10-02 19:44:28 -0700
committerunknown <brian@zim.(none)>2005-10-02 19:44:28 -0700
commit5655d31d5ff64ecea103be523985fa755586673b (patch)
tree72eb47c02b43069ea929c5d757efd985ed319a7b /sql/examples
parenta5dd3d5d8f8e67cb74403f8265b9c61daf9d5ccd (diff)
downloadmariadb-git-5655d31d5ff64ecea103be523985fa755586673b.tar.gz
Next big patch for loadable storage engines!
Handlerton array is now created instead of using sys_table_types_st. All storage engines can now have inits and giant ifdef's are now gone for startup. No compeltely clean yet, handlertons will next be merged with sys_table_types. Federated and archive now have real cleanup if their inits fail. sql/examples/ha_archive.cc: Modifications for new ha_init code. The init method now checks for errors and will not start up if the errors occur. sql/examples/ha_archive.h: Change for new init method. sql/examples/ha_example.cc: New handlerton pieces. sql/examples/ha_tina.cc: New handlerton pieces. sql/ha_berkeley.cc: New handlerton pieces, plus changes for ha_init changes. I'm not happy with our current "skip" setup. sql/ha_berkeley.h: Change in init return. sql/ha_blackhole.cc: Changes for new handlerton pieces. sql/ha_federated.cc: Changes for new handlerton and true cleanup code. sql/ha_heap.cc: Changes for new handlerton returns. sql/ha_innodb.cc: Changes for handlerton code. sql/ha_innodb.h: Change in init. sql/ha_myisam.cc: Changes for additional handlerton bits. sql/ha_myisammrg.cc: Changes for new handlerton bits. sql/ha_ndbcluster.cc: Changes for new handlerton bits. sql/ha_ndbcluster.h: Changes for handlerton bits. sql/handler.cc: Changes for ditching show_table_type_st types, and collapsing it into a handlerton array. The ha_init now just loops through all handlers to init (much cleaner...). handlertons and sys_table_types should be merged next. sql/handler.h: Additions for sys_table_types sql/log.cc: Clean up of binlog for changes in handlerton sql/mysql_priv.h: Removed unneeded define for binlog_init sql/sql_show.cc: Changes for change in handlerton to sys_table_types
Diffstat (limited to 'sql/examples')
-rw-r--r--sql/examples/ha_archive.cc31
-rw-r--r--sql/examples/ha_archive.h2
-rw-r--r--sql/examples/ha_example.cc6
-rw-r--r--sql/examples/ha_tina.cc4
4 files changed, 33 insertions, 10 deletions
diff --git a/sql/examples/ha_archive.cc b/sql/examples/ha_archive.cc
index 7a0c957e5c3..91e8c5d5eee 100644
--- a/sql/examples/ha_archive.cc
+++ b/sql/examples/ha_archive.cc
@@ -116,7 +116,7 @@
*/
/* If the archive storage engine has been inited */
-static bool archive_inited= 0;
+static bool archive_inited= FALSE;
/* Variables for archive share methods */
pthread_mutex_t archive_mutex;
static HASH archive_open_tables;
@@ -138,6 +138,10 @@ static HASH archive_open_tables;
/* dummy handlerton - only to have something to return from archive_db_init */
handlerton archive_hton = {
"archive",
+ SHOW_OPTION_YES,
+ "Archive storage engine",
+ DB_TYPE_ARCHIVE_DB,
+ archive_db_init,
0, /* slot */
0, /* savepoint size. */
NULL, /* close_connection */
@@ -176,18 +180,29 @@ static byte* archive_get_key(ARCHIVE_SHARE *share,uint *length,
void
RETURN
- &archive_hton OK
- 0 Error
+ FALSE OK
+ TRUE Error
*/
-handlerton *archive_db_init()
+bool archive_db_init()
{
- archive_inited= 1;
- VOID(pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST));
+ DBUG_ENTER("archive_db_init");
+ if (pthread_mutex_init(&archive_mutex, MY_MUTEX_INIT_FAST))
+ goto error;
if (hash_init(&archive_open_tables, system_charset_info, 32, 0, 0,
(hash_get_key) archive_get_key, 0, 0))
- return 0;
- return &archive_hton;
+ {
+ VOID(pthread_mutex_destroy(&archive_mutex));
+ }
+ else
+ {
+ archive_inited= TRUE;
+ DBUG_RETURN(FALSE);
+ }
+error:
+ have_archive_db= SHOW_OPTION_DISABLED; // If we couldn't use handler
+ archive_hton.state= SHOW_OPTION_DISABLED;
+ DBUG_RETURN(TRUE);
}
/*
diff --git a/sql/examples/ha_archive.h b/sql/examples/ha_archive.h
index e2d8aa49add..849b5b5bd6c 100644
--- a/sql/examples/ha_archive.h
+++ b/sql/examples/ha_archive.h
@@ -105,6 +105,6 @@ public:
enum thr_lock_type lock_type);
};
-handlerton *archive_db_init(void);
+bool archive_db_init(void);
bool archive_db_end(void);
diff --git a/sql/examples/ha_example.cc b/sql/examples/ha_example.cc
index cc4ad3eb535..85497ecf9b4 100644
--- a/sql/examples/ha_example.cc
+++ b/sql/examples/ha_example.cc
@@ -74,7 +74,11 @@
handlerton example_hton= {
- "CSV",
+ "EXAMPLE",
+ SHOW_OPTION_YES,
+ "Example storage engine",
+ DB_TYPE_EXAMPLE_DB,
+ NULL, /* We do need to write one! */
0, /* slot */
0, /* savepoint size. */
NULL, /* close_connection */
diff --git a/sql/examples/ha_tina.cc b/sql/examples/ha_tina.cc
index 5663cd829bd..27d1a94271b 100644
--- a/sql/examples/ha_tina.cc
+++ b/sql/examples/ha_tina.cc
@@ -56,6 +56,10 @@ static int tina_init= 0;
handlerton tina_hton= {
"CSV",
+ SHOW_OPTION_YES,
+ "CSV storage engine",
+ DB_TYPE_CSV_DB,
+ NULL, /* One needs to be written! */
0, /* slot */
0, /* savepoint size. */
NULL, /* close_connection */