summaryrefslogtreecommitdiff
path: root/sql/examples
diff options
context:
space:
mode:
authorunknown <brian@brian-akers-computer.local>2004-04-12 21:01:45 -0700
committerunknown <brian@brian-akers-computer.local>2004-04-12 21:01:45 -0700
commit01bff53c4f71b9d204bc42b654e73d4ec6e6a941 (patch)
tree686ebbc1135999578321bffc95e6f3aec84ad720 /sql/examples
parent83c2292bb5617128bd5c0eaa69663072363b38c7 (diff)
downloadmariadb-git-01bff53c4f71b9d204bc42b654e73d4ec6e6a941.tar.gz
All changes are to allow someone to compile the example storage engine and use it.
acconfig.h: Default undef for example storage engine. acinclude.m4: Build macro additions for example engine. configure.in: Configure changes for it to be listed in --help sql/Makefile.am: Added in paths to build example. sql/examples/ha_example.cc: Correction in indention and a few minor other corrections. It now lets you create/open/drop example engine. sql/handler.cc: Added definition for the example storage engine. Added case for it to be created. sql/handler.h: Added example storage engine type. sql/mysql_priv.h: Added flag for optional build of example storage engine. sql/mysqld.cc: Pieces to build example storage engine.
Diffstat (limited to 'sql/examples')
-rw-r--r--sql/examples/ha_example.cc22
1 files changed, 12 insertions, 10 deletions
diff --git a/sql/examples/ha_example.cc b/sql/examples/ha_example.cc
index 40942ef55d8..e2463761e67 100644
--- a/sql/examples/ha_example.cc
+++ b/sql/examples/ha_example.cc
@@ -18,11 +18,12 @@
#pragma implementation // gcc: Class implementation
#endif
-#include "mysql_priv.h"
+#include <mysql_priv.h>
+
+#ifdef HAVE_EXAMPLE_DB
#include "ha_example.h"
/* Variables for example share methods */
-extern pthread_mutex_t LOCK_mysql_create_db;
pthread_mutex_t example_mutex;
static HASH example_open_tables;
static int example_init= 0;
@@ -62,7 +63,8 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table)
if (!(share=(EXAMPLE_SHARE*) hash_search(&example_open_tables,
(byte*) table_name,
- length))){
+ length)))
+ {
if (!(share=(EXAMPLE_SHARE *)
my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
&share, sizeof(*share),
@@ -81,9 +83,6 @@ static EXAMPLE_SHARE *get_share(const char *table_name, TABLE *table)
goto error;
thr_lock_init(&share->lock);
pthread_mutex_init(&share->mutex,MY_MUTEX_INIT_FAST);
-
- if (get_mmap(share, 0) > 0)
- goto error2;
}
share->use_count++;
pthread_mutex_unlock(&example_mutex);
@@ -224,7 +223,7 @@ void ha_example::position(const byte *record)
int ha_example::rnd_pos(byte * buf, byte *pos)
{
DBUG_ENTER("ha_example::rnd_pos");
- DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED));
+ DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
}
void ha_example::info(uint flag)
@@ -271,7 +270,8 @@ THR_LOCK_DATA **ha_example::store_lock(THD *thd,
int ha_example::delete_table(const char *name)
{
DBUG_ENTER("ha_example::delete_table");
- DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
+ /* This is not implemented but we want someone to be able that it works. */
+ DBUG_RETURN(0);
}
int ha_example::rename_table(const char * from, const char * to)
@@ -287,12 +287,14 @@ ha_rows ha_example::records_in_range(int inx,
enum ha_rkey_function end_search_flag)
{
DBUG_ENTER("ha_example::records_in_range ");
- DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
+ DBUG_RETURN(records); // HA_ERR_NOT_IMPLEMENTED
}
int ha_example::create(const char *name, TABLE *table_arg, HA_CREATE_INFO *create_info)
{
DBUG_ENTER("ha_example::create");
- DBUG_RETURN(HA_ERR_NOT_IMPLEMENTED);
+ /* This is not implemented but we want someone to be able that it works. */
+ DBUG_RETURN(0);
}
+#endif /* HAVE_EXAMPLE_DB */