WL#3914: Additonal accessors required to compile InnoDB as a plugin storage engine

Add more accessors to MySQL internals in mysql/plugin.h, for storage
engine plugins.

Add some accessors specific to the InnoDB storage engine, to allow
InnoDB to be compiled as a plugin (without MYSQL_SERVER).  InnoDB
has additional requirements, due to its foreign key support, etc.
parent e5a21644
......@@ -246,17 +246,17 @@ extern size_t my_snprintf(char *to, size_t n, const char *fmt, ...)
/*
LEX_STRING -- a pair of a C-string and its length.
NOTE: this exactly form of declaration is required for some C-compilers
(for one, Sun C 5.7 2005/01/07). Unfortunately with such declaration
LEX_STRING can not be forward declared.
*/
typedef struct
#ifndef _my_plugin_h
/* This definition must match the one given in mysql/plugin.h */
struct st_mysql_lex_string
{
char *str;
size_t length;
} LEX_STRING;
};
#endif
typedef struct st_mysql_lex_string LEX_STRING;
#define STRING_WITH_LEN(X) (X), ((size_t) (sizeof(X) - 1))
#define USTRING_WITH_LEN(X) ((uchar*) X), ((size_t) (sizeof(X) - 1))
......
......@@ -23,6 +23,17 @@
#define HAVE_EXTERNAL_CLIENT
#endif
/*
InnoDB depends on some MySQL internals which other plugins should not
need. This is because of InnoDB's foreign key support, "safe" binlog
truncation, and other similar legacy features.
We define accessors for these internals unconditionally, but do not
expose them in mysql/plugin.h. They are declared in ha_innodb.h for
InnoDB's use.
*/
#define INNODB_COMPATIBILITY_HOOKS
#ifdef __CYGWIN__
/* We use a Unix API, so pretend it's not Windows */
#undef WIN
......
......@@ -24,6 +24,32 @@ class Item;
#define MYSQL_THD void*
#endif
#ifndef _m_string_h
/* This definition must match the one given in m_string.h */
struct st_mysql_lex_string
{
char *str;
unsigned int length;
};
#endif /* _m_string_h */
typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
#define MYSQL_XIDDATASIZE 128
/**
struct st_mysql_xid is binary compatible with the XID structure as
in the X/Open CAE Specification, Distributed Transaction Processing:
The XA Specification, X/Open Company Ltd., 1991.
http://www.opengroup.org/bookstore/catalog/c193.htm
@see XID in sql/handler.h
*/
struct st_mysql_xid {
long formatID;
long gtrid_length;
long bqual_length;
char data[MYSQL_XIDDATASIZE]; /* Not \0-terminated */
};
typedef struct st_mysql_xid MYSQL_XID;
/*************************************************************************
Plugin API. Common for all plugin types.
......@@ -658,6 +684,103 @@ char *thd_security_context(MYSQL_THD thd, char *buffer, unsigned int length,
/* Increments the row counter, see THD::row_count */
void thd_inc_row_count(MYSQL_THD thd);
/**
Create a temporary file.
@details
The temporary file is created in a location specified by the mysql
server configuration (--tmpdir option). The caller does not need to
delete the file, it will be deleted automatically.
@param prefix prefix for temporary file name
@retval -1 error
@retval >= 0 a file handle that can be passed to dup or my_close
*/
int mysql_tmpfile(const char *prefix);
/**
Check the killed state of a connection
@details
In MySQL support for the KILL statement is cooperative. The KILL
statement only sets a "killed" flag. This function returns the value
of that flag. A thread should check it often, especially inside
time-consuming loops, and gracefully abort the operation if it is
non-zero.
@param thd user thread connection handle
@retval 0 the connection is active
@retval 1 the connection has been killed
*/
int thd_killed(const MYSQL_THD thd);
/**
Allocate memory in the connection's local memory pool
@details
When properly used in place of @c my_malloc(), this can significantly
improve concurrency. Don't use this or related functions to allocate
large chunks of memory. Use for temporary storage only. The memory
will be freed automatically at the end of the statement; no explicit
code is required to prevent memory leaks.
@see alloc_root()
*/
void *thd_alloc(MYSQL_THD thd, unsigned int size);
/**
@see thd_alloc()
*/
void *thd_calloc(MYSQL_THD thd, unsigned int size);
/**
@see thd_alloc()
*/
char *thd_strdup(MYSQL_THD thd, const char *str);
/**
@see thd_alloc()
*/
char *thd_strmake(MYSQL_THD thd, const char *str, unsigned int size);
/**
@see thd_alloc()
*/
void *thd_memdup(MYSQL_THD thd, const void* str, unsigned int size);
/**
Create a LEX_STRING in this connection's local memory pool
@param thd user thread connection handle
@param lex_str pointer to LEX_STRING object to be initialized
@param str initializer to be copied into lex_str
@param length length of str, in bytes
@param allocate_lex_string flag: if TRUE, allocate new LEX_STRING object,
instead of using lex_str value
@return NULL on failure, or pointer to the LEX_STRING object
@see thd_alloc()
*/
MYSQL_LEX_STRING *thd_make_lex_string(MYSQL_THD thd, MYSQL_LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string);
/**
Get the XID for this connection's transaction
@param thd user thread connection handle
@param xid location where identifier is stored
*/
void thd_get_xid(const MYSQL_THD thd, MYSQL_XID *xid);
/**
Invalidate the query cache for a given table.
@param thd user thread connection handle
@param key databasename\0tablename\0
@param key_length length of key in bytes, including the NUL bytes
@param using_trx flag: TRUE if using transactions, FALSE otherwise
*/
void mysql_query_cache_invalidate4(MYSQL_THD thd,
const char *key, unsigned int key_length,
int using_trx);
#ifdef __cplusplus
}
#endif
......
......@@ -328,13 +328,21 @@ typedef ulonglong my_xid; // this line is the same as in log_event.h
#define MYSQL_XID_OFFSET (MYSQL_XID_PREFIX_LEN+sizeof(server_id))
#define MYSQL_XID_GTRID_LEN (MYSQL_XID_OFFSET+sizeof(my_xid))
#define XIDDATASIZE 128
#define XIDDATASIZE MYSQL_XIDDATASIZE
#define MAXGTRIDSIZE 64
#define MAXBQUALSIZE 64
#define COMPATIBLE_DATA_YES 0
#define COMPATIBLE_DATA_NO 1
/**
struct xid_t is binary compatible with the XID structure as
in the X/Open CAE Specification, Distributed Transaction Processing:
The XA Specification, X/Open Company Ltd., 1991.
http://www.opengroup.org/bookstore/catalog/c193.htm
@see MYSQL_XID in mysql/plugin.h
*/
struct xid_t {
long formatID;
long gtrid_length;
......
......@@ -5245,6 +5245,29 @@ err1:
return 1;
}
#ifdef INNODB_COMPATIBILITY_HOOKS
/**
Get the file name of the MySQL binlog.
@return the name of the binlog file
*/
extern "C"
const char* mysql_bin_log_file_name(void)
{
return mysql_bin_log.get_log_fname();
}
/**
Get the current position of the MySQL binlog.
@return byte offset from the beginning of the binlog
*/
extern "C"
ulonglong mysql_bin_log_file_pos(void)
{
return (ulonglong) mysql_bin_log.get_log_file()->pos_in_file;
}
#endif /* INNODB_COMPATIBILITY_HOOKS */
struct st_mysql_storage_engine binlog_storage_engine=
{ MYSQL_HANDLERTON_INTERFACE_VERSION };
......
......@@ -1182,7 +1182,11 @@ bool mysqld_show_open_tables(THD *thd,const char *wild);
bool mysqld_show_logs(THD *thd);
void append_identifier(THD *thd, String *packet, const char *name,
uint length);
#endif /* MYSQL_SERVER */
#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
int get_quote_char_for_identifier(THD *thd, const char *name, uint length);
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
#ifdef MYSQL_SERVER
void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild);
int mysqld_dump_create_info(THD *thd, TABLE_LIST *table_list, int fd);
bool mysqld_show_create(THD *thd, TABLE_LIST *table_list);
......@@ -1211,9 +1215,6 @@ void reset_status_vars();
/* information schema */
extern LEX_STRING INFORMATION_SCHEMA_NAME;
extern const LEX_STRING partition_keywords[];
LEX_STRING *make_lex_string(THD *thd, LEX_STRING *lex_str,
const char* str, uint length,
bool allocate_lex_string);
ST_SCHEMA_TABLE *find_schema_table(THD *thd, const char* table_name);
ST_SCHEMA_TABLE *get_schema_table(enum enum_schema_tables schema_table_idx);
int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
......@@ -1691,9 +1692,14 @@ extern int creating_table; // How many mysql_create_table() are running
*/
extern time_t server_start_time;
#endif /* MYSQL_SERVER */
#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
extern uint mysql_data_home_len;
extern char *mysql_data_home,server_version[SERVER_VERSION_LENGTH],
mysql_real_data_home[], *opt_mysql_tmpdir, mysql_charsets_dir[],
mysql_real_data_home[];
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
#ifdef MYSQL_SERVER
extern char *opt_mysql_tmpdir, mysql_charsets_dir[],
def_ft_boolean_syntax[sizeof(ft_boolean_syntax)];
#define mysql_tmpdir (my_tmpdir(&mysql_tmpdir_list))
extern MY_TMPDIR mysql_tmpdir_list;
......@@ -1710,8 +1716,13 @@ extern Gt_creator gt_creator;
extern Lt_creator lt_creator;
extern Ge_creator ge_creator;
extern Le_creator le_creator;
extern char language[FN_REFLEN], reg_ext[FN_EXTLEN];
extern char language[FN_REFLEN];
#endif /* MYSQL_SERVER */
#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
extern char reg_ext[FN_EXTLEN];
extern uint reg_ext_length;
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
#ifdef MYSQL_SERVER
extern char glob_hostname[FN_REFLEN], mysql_home[FN_REFLEN];
extern char pidfile_name[FN_REFLEN], system_time_zone[30], *opt_init_file;
extern char log_error_file[FN_REFLEN], *opt_tc_log_file;
......@@ -1740,17 +1751,32 @@ extern ulong max_binlog_size, max_relay_log_size;
extern ulong opt_binlog_rows_event_max_size;
extern ulong rpl_recovery_rank, thread_cache_size, thread_pool_size;
extern ulong back_log;
extern ulong specialflag, current_pid;
#endif /* MYSQL_SERVER */
#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
extern ulong specialflag;
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
#ifdef MYSQL_SERVER
extern ulong current_pid;
extern ulong expire_logs_days, sync_binlog_period, sync_binlog_counter;
extern ulong opt_tc_log_size, tc_log_max_pages_used, tc_log_page_size;
extern ulong tc_log_page_waits;
extern my_bool relay_log_purge, opt_innodb_safe_binlog, opt_innodb;
extern uint test_flags,select_errors,ha_open_options;
extern uint protocol_version, mysqld_port, dropping_tables;
extern uint delay_key_write_options, lower_case_table_names;
extern uint delay_key_write_options;
#endif /* MYSQL_SERVER */
#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
extern uint lower_case_table_names;
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
#ifdef MYSQL_SERVER
extern bool opt_endinfo, using_udf_functions;
extern my_bool locked_in_memory;
extern bool opt_using_transactions, mysqld_embedded;
extern bool opt_using_transactions;
#endif /* MYSQL_SERVER */
#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
extern bool mysqld_embedded;
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
#ifdef MYSQL_SERVER
extern bool using_update_log, opt_large_files, server_id_supplied;
extern bool opt_update_log, opt_bin_log, opt_error_log;
extern my_bool opt_log, opt_slow_log;
......@@ -1774,8 +1800,12 @@ extern uint opt_crash_binlog_innodb;
extern char *shared_memory_base_name, *mysqld_unix_port;
extern my_bool opt_enable_shared_memory;
extern char *default_tz_name;
#endif /* MYSQL_SERVER */
#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
extern my_bool opt_large_pages;
extern uint opt_large_page_size;
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
#ifdef MYSQL_SERVER
extern char *opt_logname, *opt_slow_logname;
extern const char *log_output_str;
......@@ -1811,7 +1841,11 @@ extern MY_BITMAP temp_pool;
extern String my_empty_string;
extern const String my_null_string;
extern SHOW_VAR status_vars[];
#endif /* MYSQL_SERVER */
#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
extern struct system_variables global_system_variables;
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
#ifdef MYSQL_SERVER
extern struct system_variables max_system_variables;
extern struct system_status_var global_status_var;
extern struct rand_struct sql_rand;
......@@ -2009,10 +2043,14 @@ int wild_case_compare(CHARSET_INFO *cs, const char *str,const char *wildstr);
char *fn_rext(char *name);
/* Conversion functions */
#endif /* MYSQL_SERVER */
#if defined MYSQL_SERVER || defined INNODB_COMPATIBILITY_HOOKS
uint strconvert(CHARSET_INFO *from_cs, const char *from,
CHARSET_INFO *to_cs, char *to, uint to_length, uint *errors);
uint filename_to_tablename(const char *from, char *to, uint to_length);
uint tablename_to_filename(const char *from, char *to, uint to_length);
#endif /* MYSQL_SERVER || INNODB_COMPATIBILITY_HOOKS */
#ifdef MYSQL_SERVER
uint build_table_filename(char *buff, size_t bufflen, const char *db,
const char *table, const char *ext, uint flags);
......
......@@ -765,6 +765,18 @@ void query_cache_invalidate_by_MyISAM_filename(const char *filename)
}
/*
The following function forms part of the C plugin API
*/
extern "C"
void mysql_query_cache_invalidate4(THD *thd,
const char *key, unsigned key_length,
int using_trx)
{
query_cache.invalidate(thd, key, (uint32) key_length, (my_bool) using_trx);
}
/*****************************************************************************
Query_cache methods
*****************************************************************************/
......
......@@ -207,6 +207,31 @@ Open_tables_state::Open_tables_state(ulong version_arg)
The following functions form part of the C plugin API
*/
extern "C" int mysql_tmpfile(const char *prefix)
{
char filename[FN_REFLEN];
File fd = create_temp_file(filename, mysql_tmpdir, prefix,
#ifdef __WIN__
O_BINARY | O_TRUNC | O_SEQUENTIAL |
O_SHORT_LIVED |
#endif /* __WIN__ */
O_CREAT | O_EXCL | O_RDWR | O_TEMPORARY,
MYF(MY_WME));
if (fd >= 0) {
#ifndef __WIN__
/*
This can be removed once the following bug is fixed:
Bug #28903 create_temp_file() doesn't honor O_TEMPORARY option
(file not removed) (Unix)
*/
unlink(filename);
#endif /* !__WIN__ */
}
return fd;
}
extern "C"
int thd_in_lock_tables(const THD *thd)
{
......@@ -488,6 +513,49 @@ void THD::pop_internal_handler()
m_internal_handler= NULL;
}
extern "C"
void *thd_alloc(MYSQL_THD thd, unsigned int size)
{
return thd->alloc(size);
}
extern "C"
void *thd_calloc(MYSQL_THD thd, unsigned int size)
{
return thd->calloc(size);
}
extern "C"
char *thd_strdup(MYSQL_THD thd, const char *str)
{
return thd->strdup(str);
}
extern "C"
char *thd_strmake(MYSQL_THD thd, const char *str, unsigned int size)
{
return thd->strmake(str, size);
}
extern "C"
LEX_STRING *thd_make_lex_string(THD *thd, LEX_STRING *lex_str,
const char *str, unsigned int size,
int allocate_lex_string)
{
return thd->make_lex_string(lex_str, str, size,
(bool) allocate_lex_string);
}
extern "C"
void *thd_memdup(MYSQL_THD thd, const void* str, unsigned int size)
{
return thd->memdup(str, size);
}
void thd_get_xid(const MYSQL_THD thd, MYSQL_XID *xid)
{
*xid = *(MYSQL_XID *) &thd->transaction.xid_state.xid;
}
/*
Init common variables that has to be reset on start and on change_user
......@@ -856,6 +924,30 @@ void THD::cleanup_after_query()
}
/**
Create a LEX_STRING in this connection
@param lex_str pointer to LEX_STRING object to be initialized
@param str initializer to be copied into lex_str
@param length length of str, in bytes
@param allocate_lex_string if TRUE, allocate new LEX_STRING object,
instead of using lex_str value
@return NULL on failure, or pointer to the LEX_STRING object
*/
LEX_STRING *THD::make_lex_string(LEX_STRING *lex_str,
const char* str, uint length,
bool allocate_lex_string)
{
if (allocate_lex_string)
if (!(lex_str= (LEX_STRING *)alloc(sizeof(LEX_STRING))))
return 0;
if (!(lex_str->str= strmake_root(mem_root, str, length)))
return 0;
lex_str->length= length;
return lex_str;
}
/*
Convert a string to another character set
......@@ -2441,7 +2533,43 @@ void THD::restore_backup_open_tables_state(Open_tables_state *backup)
DBUG_VOID_RETURN;
}
/**
Check the killed state of a user thread
@param thd user thread
@retval 0 the user thread is active
@retval 1 the user thread has been killed
*/
extern "C" int thd_killed(const MYSQL_THD thd)
{
return(thd->killed);
}
#ifdef INNODB_COMPATIBILITY_HOOKS
extern "C" struct charset_info_st *thd_charset(MYSQL_THD thd)
{
return(thd->charset());
}
extern "C" char **thd_query(MYSQL_THD thd)
{
return(&thd->query);
}
extern "C" int thd_slave_thread(const MYSQL_THD thd)
{
return(thd->slave_thread);
}
extern "C" int thd_non_transactional_update(const MYSQL_THD thd)
{
return(thd->no_trans_update.all);
}
extern "C" int thd_binlog_format(const THD *thd)
{
return (int) thd->variables.binlog_format;
}
#endif // INNODB_COMPATIBILITY_HOOKS */
/****************************************************************************
Handling of statement states in functions and triggers.
......
......@@ -490,13 +490,6 @@ public:
{ return strdup_root(mem_root,str); }
inline char *strmake(const char *str, size_t size)
{ return strmake_root(mem_root,str,size); }
inline bool LEX_STRING_make(LEX_STRING *lex_str, const char *str,
size_t size)
{
return ((lex_str->str=
strmake_root(mem_root, str, (lex_str->length= size)))) == 0;
}
inline void *memdup(const void *str, size_t size)
{ return memdup_root(mem_root,str,size); }
inline void *memdup_w_gap(const void *str, size_t size, uint gap)
......@@ -1594,6 +1587,10 @@ public:
return alloc_root(&transaction.mem_root,size);
}
LEX_STRING *make_lex_string(LEX_STRING *lex_str,
const char* str, uint length,
bool allocate_lex_string);
bool convert_string(LEX_STRING *to, CHARSET_INFO *to_cs,
const char *from, uint from_length,
CHARSET_INFO *from_cs);
......
......@@ -1025,8 +1025,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
HA_CREATE_INFO create_info;
status_var_increment(thd->status_var.com_stat[SQLCOM_CREATE_DB]);
if (thd->LEX_STRING_make(&db, packet, packet_length -1) ||
thd->LEX_STRING_make(&alias, db.str, db.length) ||
if (thd->make_lex_string(&db, packet, packet_length - 1, FALSE) ||
thd->make_lex_string(&alias, db.str, db.length, FALSE) ||
check_db_name(&db))
{
my_error(ER_WRONG_DB_NAME, MYF(0), db.str ? db.str : "NULL");
......@@ -1046,7 +1046,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
status_var_increment(thd->status_var.com_stat[SQLCOM_DROP_DB]);
LEX_STRING db;
if (thd->LEX_STRING_make(&db, packet, packet_length - 1) ||
if (thd->make_lex_string(&db, packet, packet_length - 1, FALSE) ||
check_db_name(&db))
{
my_error(ER_WRONG_DB_NAME, MYF(0), db.str ? db.str : "NULL");
......
......@@ -2175,20 +2175,6 @@ void calc_sum_of_all_status(STATUS_VAR *to)
}
LEX_STRING *make_lex_string(THD *thd, LEX_STRING *lex_str,
const char* str, uint length,
bool allocate_lex_string)
{
MEM_ROOT *mem= thd->mem_root;
if (allocate_lex_string)
if (!(lex_str= (LEX_STRING *)thd->alloc(sizeof(LEX_STRING))))
return 0;
lex_str->str= strmake_root(mem, str, length);
lex_str->length= length;
return lex_str;
}
/* INFORMATION_SCHEMA name */
LEX_STRING INFORMATION_SCHEMA_NAME= { C_STRING_WITH_LEN("information_schema")};
......@@ -5194,10 +5180,10 @@ int make_schema_select(THD *thd, SELECT_LEX *sel,
We have to make non const db_name & table_name
because of lower_case_table_names
*/
make_lex_string(thd, &db, INFORMATION_SCHEMA_NAME.str,
INFORMATION_SCHEMA_NAME.length, 0);
make_lex_string(thd, &table, schema_table->table_name,
strlen(schema_table->table_name), 0);
thd->make_lex_string(&db, INFORMATION_SCHEMA_NAME.str,
INFORMATION_SCHEMA_NAME.length, 0);
thd->make_lex_string(&table, schema_table->table_name,
strlen(schema_table->table_name), 0);
if (schema_table->old_format(thd, schema_table) || /* Handle old syntax */
!sel->add_table_to_list(thd, new Table_ident(thd, db, table, 0),
0, 0, TL_READ))
......
......@@ -5909,8 +5909,8 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
while (tmp_buff[i] != '/')
i++;
tmp_buff+= i + 1;
f_key_info.forein_id= make_lex_string(thd, 0, tmp_buff,
(uint) strlen(tmp_buff), 1);
f_key_info.forein_id = thd_make_lex_string(thd, 0,
tmp_buff, (uint) strlen(tmp_buff), 1);
tmp_buff= foreign->referenced_table_name;
/* Database name */
......@@ -5922,22 +5922,23 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
}
db_name[i]= 0;
ulen= filename_to_tablename(db_name, uname, sizeof(uname));
f_key_info.referenced_db= make_lex_string(thd, 0, uname, ulen, 1);
f_key_info.referenced_db = thd_make_lex_string(thd, 0,
uname, ulen, 1);
/* Table name */
tmp_buff+= i + 1;
ulen= filename_to_tablename(tmp_buff, uname, sizeof(uname));
f_key_info.referenced_table= make_lex_string(thd, 0, uname,
ulen, 1);
f_key_info.referenced_table = thd_make_lex_string(thd, 0,
uname, ulen, 1);
for (i= 0;;) {
tmp_buff= foreign->foreign_col_names[i];
name= make_lex_string(thd, name, tmp_buff,
(uint) strlen(tmp_buff), 1);
name = thd_make_lex_string(thd, name,
tmp_buff, (uint) strlen(tmp_buff), 1);
f_key_info.foreign_fields.push_back(name);
tmp_buff= foreign->referenced_col_names[i];
name= make_lex_string(thd, name, tmp_buff,
(uint) strlen(tmp_buff), 1);
name = thd_make_lex_string(thd, name,
tmp_buff, (uint) strlen(tmp_buff), 1);
f_key_info.referenced_fields.push_back(name);
if (++i >= foreign->n_fields)
break;
......@@ -5964,8 +5965,8 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
length=8;
tmp_buff= "RESTRICT";
}
f_key_info.delete_method= make_lex_string(thd, f_key_info.delete_method,
tmp_buff, length, 1);
f_key_info.delete_method = thd_make_lex_string(
thd, f_key_info.delete_method, tmp_buff, length, 1);
if (foreign->type & DICT_FOREIGN_ON_UPDATE_CASCADE)
......@@ -5988,15 +5989,15 @@ ha_innobase::get_foreign_key_list(THD *thd, List<FOREIGN_KEY_INFO> *f_key_list)
length=8;
tmp_buff= "RESTRICT";
}
f_key_info.update_method= make_lex_string(thd, f_key_info.update_method,
tmp_buff, length, 1);
f_key_info.update_method = thd_make_lex_string(
thd, f_key_info.update_method, tmp_buff, length, 1);
if (foreign->referenced_index &&
foreign->referenced_index->name)
{
f_key_info.referenced_key_name=
make_lex_string(thd, f_key_info.referenced_key_name,
foreign->referenced_index->name,
strlen(foreign->referenced_index->name), 1);
f_key_info.referenced_key_name = thd_make_lex_string(
thd, f_key_info.referenced_key_name,
foreign->referenced_index->name,
strlen(foreign->referenced_index->name), 1);
}
FOREIGN_KEY_INFO *pf_key_info= ((FOREIGN_KEY_INFO *)
......
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