summaryrefslogtreecommitdiff
path: root/storage/example
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2013-04-15 15:09:22 +0200
committerSergei Golubchik <sergii@pisem.net>2013-04-15 15:09:22 +0200
commita9035be5b7a7b3865ddb4ef34a5d0cfc65dfc254 (patch)
treea9df7341e91623f62fe37cd47fce139d8888fc95 /storage/example
parent3a1c91d87d69ef243b3e78be6089102cafef0a8e (diff)
parentf57ecb7786177e0af3b1e3ec94302720b2e0f967 (diff)
downloadmariadb-git-a9035be5b7a7b3865ddb4ef34a5d0cfc65dfc254.tar.gz
10.0-base merge
Diffstat (limited to 'storage/example')
-rw-r--r--storage/example/ha_example.cc61
-rw-r--r--storage/example/ha_example.h5
2 files changed, 33 insertions, 33 deletions
diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc
index 98968d0b5b5..588cf11f641 100644
--- a/storage/example/ha_example.cc
+++ b/storage/example/ha_example.cc
@@ -118,6 +118,8 @@ static HASH example_open_tables;
/* The mutex used to init the hash; variable for example share methods */
mysql_mutex_t example_mutex;
+static MYSQL_THDVAR_ULONG(varopt_default, PLUGIN_VAR_RQCMDARG,
+ "default value of the VAROPT table option", NULL, NULL, 5, 0, 100, 0);
/**
Structure for CREATE TABLE options (table options).
@@ -133,6 +135,7 @@ struct ha_table_option_struct
ulonglong ullparam;
uint enumparam;
bool boolparam;
+ ulonglong varparam;
};
@@ -179,6 +182,12 @@ ha_create_table_option example_table_option_list[]=
The default is 1, that is true, yes, on.
*/
HA_TOPTION_BOOL("YESNO", boolparam, 1),
+ /*
+ one option defined by the system variable. The type, the range, or
+ a list of allowed values is the same as for the system variable.
+ */
+ HA_TOPTION_SYSVAR("VAROPT", varparam, varopt_default),
+
HA_TOPTION_END
};
@@ -229,6 +238,27 @@ static void init_example_psi_keys()
#endif
+/**
+ @brief
+ If frm_error() is called then we will use this to determine
+ the file extensions that exist for the storage engine. This is also
+ used by the default rename_table and delete_table method in
+ handler.cc and by the default discover_many method.
+
+ For engines that have two file name extentions (separate meta/index file
+ and data file), the order of elements is relevant. First element of engine
+ file name extentions array should be meta/index file extention. Second
+ element - data file extention. This order is assumed by
+ prepare_for_repair() when REPAIR TABLE ... USE_FRM is issued.
+
+ @see
+ rename_table method in handler.cc and
+ delete_table method in handler.cc
+*/
+
+static const char *ha_example_exts[] = {
+ NullS
+};
static int example_init_func(void *p)
{
DBUG_ENTER("example_init_func");
@@ -247,6 +277,7 @@ static int example_init_func(void *p)
example_hton->flags= HTON_CAN_RECREATE;
example_hton->table_options= example_table_option_list;
example_hton->field_options= example_field_option_list;
+ example_hton->tablefile_extensions= ha_example_exts;
DBUG_RETURN(0);
}
@@ -355,33 +386,6 @@ ha_example::ha_example(handlerton *hton, TABLE_SHARE *table_arg)
/**
@brief
- If frm_error() is called then we will use this to determine
- the file extensions that exist for the storage engine. This is also
- used by the default rename_table and delete_table method in
- handler.cc.
-
- For engines that have two file name extentions (separate meta/index file
- and data file), the order of elements is relevant. First element of engine
- file name extentions array should be meta/index file extention. Second
- element - data file extention. This order is assumed by
- prepare_for_repair() when REPAIR TABLE ... USE_FRM is issued.
-
- @see
- rename_table method in handler.cc and
- delete_table method in handler.cc
-*/
-
-static const char *ha_example_exts[] = {
- NullS
-};
-
-const char **ha_example::bas_ext() const
-{
- return ha_example_exts;
-}
-
-/**
- @brief
Used for opening tables. The name will be the name of the file.
@details
@@ -1092,6 +1096,7 @@ static MYSQL_SYSVAR_ULONG(
static struct st_mysql_sys_var* example_system_variables[]= {
MYSQL_SYSVAR(enum_var),
MYSQL_SYSVAR(ulong_var),
+ MYSQL_SYSVAR(varopt_default),
NULL
};
@@ -1110,7 +1115,7 @@ static int show_func_example(MYSQL_THD thd, struct st_mysql_show_var *var,
static struct st_mysql_show_var func_status[]=
{
- {"example_func_example", (char *)show_func_example, SHOW_SIMPLE_FUNC},
+ {"func_example", (char *)show_func_example, SHOW_SIMPLE_FUNC},
{0,0,SHOW_UNDEF}
};
diff --git a/storage/example/ha_example.h b/storage/example/ha_example.h
index 9be370edfe3..d3d31893781 100644
--- a/storage/example/ha_example.h
+++ b/storage/example/ha_example.h
@@ -73,11 +73,6 @@ public:
const char *index_type(uint inx) { return "HASH"; }
/** @brief
- The file extensions.
- */
- const char **bas_ext() const;
-
- /** @brief
This is a list of flags that indicate what functionality the storage engine
implements. The current table flags are documented in handler.h
*/