diff options
author | unknown <magnus@neptunus.(none)> | 2004-04-15 09:14:14 +0200 |
---|---|---|
committer | unknown <magnus@neptunus.(none)> | 2004-04-15 09:14:14 +0200 |
commit | b43af929f871332335b0c1f2c4257aabca6b8a2f (patch) | |
tree | e8f88e89d865e1db6c1ca7d6c5fa4d85a090de4c /sql/sql_table.cc | |
parent | fd1d14a017fcbe86d641675c3de4788cefa8f28f (diff) | |
download | mariadb-git-b43af929f871332335b0c1f2c4257aabca6b8a2f.tar.gz |
Added NDB storage engine
include/my_base.h:
Added three new errorcodes to be returned by the handler
sql/Makefile.am:
Add new files discover.cc, ha_ndbcluster.cc and ha_ndbcluster.h
Add include path of NDB files
sql/handler.cc:
Added variable for keeping track of number of "discovers"
Added NDB to list of storage engines
Added calls to NDB for commit, rollback etc.
Added function ha_discover for discovering a table from handler
sql/handler.h:
Added NDB to list of storage engines
Added vbariable in transaction for keeping a ndb transaction handle
sql/lex.h:
Changed AND to AND_SYM and OR to OR_SYM to avoid nameclash
sql/mysql_priv.h:
Added prototypes for new functions readfrm, writefrm and create_table_from_handler
sql/mysqld.cc:
Added NDB support
Disable NDB with --skip-ndbcluster
sql/set_var.cc:
Add posibilty to show if NDB handler is supported
sql/ha_ndbcluster.cc:
Add ifdef for whole file for not compiling anything if NDB sholdn't be included
Updated timestamp handling to use new vars timestamp_default_now and timestamp_on_update_now
sql/sql_base.cc:
If frm file is not found on disk, ask handler if it knows about the table. Then retry the open.
This new functionality is called "discover" and can be used by any handler.
sql/sql_class.h:
Added variable for keeping a NDB connection handle
sql/sql_table.cc:
Before trying to create a table, ask handler if a table with that name already exists.
If user said CREATE TABLE IF NOT EXISTS, disocver the table from handler
sql/sql_yacc.yy:
Add NDBCLUSTER_SYM
Change AND to AND_SYM
Change OR to OR_SYM
sql/table.cc:
Fixe for probelm when NullS is returned from bas_ext of a handler.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index d5f77bf545d..c46a9823a52 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1148,6 +1148,35 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name, } } + /* + Check that table with given name does not already + exist in any storage engine. In such a case it should + be discovered and the error ER_TABLE_EXISTS_ERROR be returned + unless user specified CREATE TABLE IF EXISTS + The LOCK_open mutex has been locked to make sure no + one else is attempting to discover the table. Since + it's not on disk as a frm file, no one could be using it! + */ + if (!(create_info->options & HA_LEX_CREATE_TMP_TABLE)) + { + bool create_if_not_exists = + create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS; + if (!create_table_from_handler(db, table_name, + create_if_not_exists)) + { + DBUG_PRINT("info", ("Table already existed in handler")); + + if (create_if_not_exists) + { + create_info->table_existed= 1; // Mark that table existed + error= 0; + } + else + my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name); + goto end; + } + } + thd->proc_info="creating table"; create_info->table_existed= 0; // Mark that table is created |