summaryrefslogtreecommitdiff
path: root/sql/handler.cc
diff options
context:
space:
mode:
authorunknown <acurtis@pcgem.rdg.cyberkinetica.com>2004-11-10 16:05:58 +0000
committerunknown <acurtis@pcgem.rdg.cyberkinetica.com>2004-11-10 16:05:58 +0000
commite862a42d7f17e2505b850d3df7fe727d4fc5eaa7 (patch)
treee93181a553099abf896916852eb0ce1c3f04e2e1 /sql/handler.cc
parente4293968357477a96fb14105361f8cec6fd5b74c (diff)
parent97af0a0e8f3353cc849b33bf5b733764da7cb202 (diff)
downloadmariadb-git-e862a42d7f17e2505b850d3df7fe727d4fc5eaa7.tar.gz
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into pcgem.rdg.cyberkinetica.com:/usr/home/acurtis/work/bug6031
Diffstat (limited to 'sql/handler.cc')
-rw-r--r--sql/handler.cc56
1 files changed, 56 insertions, 0 deletions
diff --git a/sql/handler.cc b/sql/handler.cc
index f7a1a6ef0bf..2c274c7989e 100644
--- a/sql/handler.cc
+++ b/sql/handler.cc
@@ -109,6 +109,8 @@ const char *tx_isolation_names[] =
TYPELIB tx_isolation_typelib= {array_elements(tx_isolation_names)-1,"",
tx_isolation_names, NULL};
+static TYPELIB known_extensions= {0,"known_exts", NULL, NULL};
+
enum db_type ha_resolve_by_name(const char *name, uint namelen)
{
THD *thd=current_thd;
@@ -1633,3 +1635,57 @@ int handler::index_read_idx(byte * buf, uint index, const byte * key,
return error;
}
+/*
+ Returns a list of all known extensions.
+
+ SYNOPSIS
+ ha_known_exts()
+
+ NOTES
+ No mutexes, worst case race is a minor surplus memory allocation
+
+ RETURN VALUE
+ pointer pointer to TYPELIB structure
+*/
+TYPELIB *ha_known_exts(void)
+{
+ if (!known_extensions.type_names)
+ {
+ show_table_type_st *types;
+ List<char> found_exts;
+ List_iterator_fast<char> it(found_exts);
+ const char *e, **ext;
+
+ found_exts.push_back(".db");
+ for (types= sys_table_types; types->type; types++)
+ {
+ if (*types->value == SHOW_OPTION_YES)
+ {
+ handler *file= get_new_handler(0,(enum db_type) types->db_type);
+ for (ext= file->bas_ext(); *ext; ext++)
+ {
+ while (e=it++)
+ if (e == *ext)
+ break;
+
+ if (!e)
+ found_exts.push_back((char *)*ext);
+
+ it.rewind();
+ }
+ delete file;
+ }
+ }
+ ext= (const char **)my_once_alloc(sizeof(char *)*
+ (found_exts.elements+1), MYF(MY_WME));
+
+ DBUG_ASSERT(ext);
+ for (uint i=0; e=it++; i++)
+ ext[i]= e;
+ ext[found_exts.elements]= 0;
+
+ known_extensions.count= found_exts.elements;
+ known_extensions.type_names= ext;
+ }
+ return &known_extensions;
+}