summaryrefslogtreecommitdiff
path: root/sql/examples
diff options
context:
space:
mode:
authormonty@mysql.com <>2005-11-23 22:45:02 +0200
committermonty@mysql.com <>2005-11-23 22:45:02 +0200
commite42c98096746bc675e0c6d6b45776937d7cfb05b (patch)
treeafbb980a4dee7a0c8ab8d00768780e383e0e50fe /sql/examples
parentb167a6679bbb8b66abf838d3c636bdefb6379a2f (diff)
downloadmariadb-git-e42c98096746bc675e0c6d6b45776937d7cfb05b.tar.gz
Table definition cache, part 2
The table opening process now works the following way: - Create common TABLE_SHARE object - Read the .frm file and unpack it into the TABLE_SHARE object - Create a TABLE object based on the information in the TABLE_SHARE object and open a handler to the table object Other noteworthy changes: - In TABLE_SHARE the most common strings are now LEX_STRING's - Better error message when table is not found - Variable table_cache is now renamed 'table_open_cache' - New variable 'table_definition_cache' that is the number of table defintions that will be cached - strxnmov() calls are now fixed to avoid overflows - strxnmov() will now always add one end \0 to result - engine objects are now created with a TABLE_SHARE object instead of a TABLE object. - After creating a field object one must call field->init(table) before using it - For a busy system this change will give you: - Less memory usage for table object - Faster opening of tables (if it's has been in use or is in table definition cache) - Allow you to cache many table definitions objects - Faster drop of table
Diffstat (limited to 'sql/examples')
-rw-r--r--sql/examples/ha_example.cc2
-rw-r--r--sql/examples/ha_example.h2
-rw-r--r--sql/examples/ha_tina.cc11
-rw-r--r--sql/examples/ha_tina.h2
4 files changed, 9 insertions, 8 deletions
diff --git a/sql/examples/ha_example.cc b/sql/examples/ha_example.cc
index 68aed7c6483..db7a811df78 100644
--- a/sql/examples/ha_example.cc
+++ b/sql/examples/ha_example.cc
@@ -219,7 +219,7 @@ static handler* example_create_handler(TABLE *table)
}
-ha_example::ha_example(TABLE *table_arg)
+ha_example::ha_example(TABLE_SHARE *table_arg)
:handler(&example_hton, table_arg)
{}
diff --git a/sql/examples/ha_example.h b/sql/examples/ha_example.h
index d2ec83a5837..139a50a3281 100644
--- a/sql/examples/ha_example.h
+++ b/sql/examples/ha_example.h
@@ -45,7 +45,7 @@ class ha_example: public handler
EXAMPLE_SHARE *share; /* Shared lock info */
public:
- ha_example(TABLE *table_arg);
+ ha_example(TABLE_SHARE *table_arg);
~ha_example()
{
}
diff --git a/sql/examples/ha_tina.cc b/sql/examples/ha_tina.cc
index 6bb883f91e0..1312577e126 100644
--- a/sql/examples/ha_tina.cc
+++ b/sql/examples/ha_tina.cc
@@ -55,7 +55,7 @@ TODO:
pthread_mutex_t tina_mutex;
static HASH tina_open_tables;
static int tina_init= 0;
-static handler* tina_create_handler(TABLE *table);
+static handler *tina_create_handler(TABLE_SHARE *table);
handlerton tina_hton= {
"CSV",
@@ -285,17 +285,17 @@ byte * find_eoln(byte *data, off_t begin, off_t end)
}
-static handler* tina_create_handler(TABLE *table)
+static handler *tina_create_handler(TABLE_SHARE *table)
{
return new ha_tina(table);
}
-ha_tina::ha_tina(TABLE *table_arg)
+ha_tina::ha_tina(TABLE_SHARE *table_arg)
:handler(&tina_hton, table_arg),
/*
- These definitions are found in hanler.h
- These are not probably completely right.
+ These definitions are found in handler.h
+ They are not probably completely right.
*/
current_position(0), next_position(0), chain_alloced(0),
chain_size(DEFAULT_CHAIN_LENGTH)
@@ -308,6 +308,7 @@ ha_tina::ha_tina(TABLE *table_arg)
/*
Encode a buffer into the quoted format.
*/
+
int ha_tina::encode_quote(byte *buf)
{
char attribute_buffer[1024];
diff --git a/sql/examples/ha_tina.h b/sql/examples/ha_tina.h
index 2de6d8c8257..eecdeeb5826 100644
--- a/sql/examples/ha_tina.h
+++ b/sql/examples/ha_tina.h
@@ -55,7 +55,7 @@ class ha_tina: public handler
uint32 chain_size;
public:
- ha_tina(TABLE *table_arg);
+ ha_tina(TABLE_SHARE *table_arg);
~ha_tina()
{
if (chain_alloced)