Commit 22f908db authored by marko's avatar marko

Merge changes by MySQL AB to ha_innodb.cc:

WL#2257 REFERENTIAL_CONSTRAINTS view
WL#3201 pluggable storage engines
parent e8b80a5a
...@@ -42,6 +42,7 @@ have disables the InnoDB inlining in this file. */ ...@@ -42,6 +42,7 @@ have disables the InnoDB inlining in this file. */
#define MAX_ULONG_BIT ((ulong) 1 << (sizeof(ulong)*8-1)) #define MAX_ULONG_BIT ((ulong) 1 << (sizeof(ulong)*8-1))
#ifdef WITH_INNOBASE_STORAGE_ENGINE
#include "ha_innodb.h" #include "ha_innodb.h"
pthread_mutex_t innobase_share_mutex, /* to protect innobase_open_files */ pthread_mutex_t innobase_share_mutex, /* to protect innobase_open_files */
...@@ -204,11 +205,15 @@ static int innobase_savepoint(THD* thd, void *savepoint); ...@@ -204,11 +205,15 @@ static int innobase_savepoint(THD* thd, void *savepoint);
static int innobase_release_savepoint(THD* thd, void *savepoint); static int innobase_release_savepoint(THD* thd, void *savepoint);
static handler *innobase_create_handler(TABLE_SHARE *table); static handler *innobase_create_handler(TABLE_SHARE *table);
static const char innobase_hton_name[]= "InnoDB";
static const char innobase_hton_comment[]=
"Supports transactions, row-level locking, and foreign keys";
handlerton innobase_hton = { handlerton innobase_hton = {
MYSQL_HANDLERTON_INTERFACE_VERSION, MYSQL_HANDLERTON_INTERFACE_VERSION,
"InnoDB", innobase_hton_name,
SHOW_OPTION_YES, SHOW_OPTION_YES,
"Supports transactions, row-level locking, and foreign keys", innobase_hton_comment,
DB_TYPE_INNODB, DB_TYPE_INNODB,
innobase_init, innobase_init,
0, /* slot */ 0, /* slot */
...@@ -238,7 +243,7 @@ handlerton innobase_hton = { ...@@ -238,7 +243,7 @@ handlerton innobase_hton = {
NULL, /* Fill FILES table */ NULL, /* Fill FILES table */
HTON_NO_FLAGS, HTON_NO_FLAGS,
NULL, /* binlog_func */ NULL, /* binlog_func */
NULL, /* binlog_log_query */ NULL, /* binlog_log_query */
innobase_release_temporary_latches innobase_release_temporary_latches
}; };
...@@ -1840,7 +1845,6 @@ innobase_commit_complete( ...@@ -1840,7 +1845,6 @@ innobase_commit_complete(
return(0); return(0);
} }
/********************************************************************* /*********************************************************************
Rolls back a transaction or the latest SQL statement. */ Rolls back a transaction or the latest SQL statement. */
...@@ -5827,34 +5831,55 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list) ...@@ -5827,34 +5831,55 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
break; break;
} }
ulong length= 0; ulong length;
if (foreign->type == DICT_FOREIGN_ON_DELETE_CASCADE) { if (foreign->type & DICT_FOREIGN_ON_DELETE_CASCADE)
length=17; {
tmp_buff= "ON DELETE CASCADE"; length=7;
} tmp_buff= "CASCADE";
else if (foreign->type == DICT_FOREIGN_ON_DELETE_SET_NULL) { }
length=18; else if (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL)
tmp_buff= "ON DELETE SET NULL"; {
} length=8;
else if (foreign->type == DICT_FOREIGN_ON_DELETE_NO_ACTION) { tmp_buff= "SET NULL";
length=19; }
tmp_buff= "ON DELETE NO ACTION"; else if (foreign->type & DICT_FOREIGN_ON_DELETE_NO_ACTION)
} {
else if (foreign->type == DICT_FOREIGN_ON_UPDATE_CASCADE) { length=9;
length=17; tmp_buff= "NO ACTION";
tmp_buff= "ON UPDATE CASCADE"; }
} else
else if (foreign->type == DICT_FOREIGN_ON_UPDATE_SET_NULL) { {
length=18; length=8;
tmp_buff= "ON UPDATE SET NULL"; tmp_buff= "RESTRICT";
} }
else if (foreign->type == DICT_FOREIGN_ON_UPDATE_NO_ACTION) { f_key_info.delete_method= make_lex_string(thd, f_key_info.delete_method,
length=19; tmp_buff, length, 1);
tmp_buff= "ON UPDATE NO ACTION";
}
f_key_info.constraint_method= make_lex_string(thd, if (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE)
f_key_info.constraint_method, {
tmp_buff, length, 1); length=7;
tmp_buff= "CASCADE";
}
else if (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL)
{
length=8;
tmp_buff= "SET NULL";
}
else if (foreign->type & DICT_FOREIGN_ON_UPDATE_NO_ACTION)
{
length=9;
tmp_buff= "NO ACTION";
}
else
{
length=8;
tmp_buff= "RESTRICT";
}
f_key_info.update_method= make_lex_string(thd, f_key_info.update_method,
tmp_buff, length, 1);
FOREIGN_KEY_INFO *pf_key_info= ((FOREIGN_KEY_INFO *) FOREIGN_KEY_INFO *pf_key_info= ((FOREIGN_KEY_INFO *)
thd->memdup((gptr) &f_key_info, thd->memdup((gptr) &f_key_info,
...@@ -7432,3 +7457,20 @@ bool ha_innobase::check_if_incompatible_data( ...@@ -7432,3 +7457,20 @@ bool ha_innobase::check_if_incompatible_data(
return COMPATIBLE_DATA_YES; return COMPATIBLE_DATA_YES;
} }
mysql_declare_plugin(innobase)
{
MYSQL_STORAGE_ENGINE_PLUGIN,
&innobase_hton,
innobase_hton_name,
"Innobase OY",
innobase_hton_comment,
NULL, /* Plugin Init */
NULL, /* Plugin Deinit */
0x0100 /* 1.0 */,
0
}
mysql_declare_plugin_end;
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment