Use sql_mode_t for sql_mode.

This fixed several cases where we where using just ulong for sql_mode
This commit is contained in:
Monty 2016-10-02 16:39:40 +03:00
parent 8be53a389c
commit 7b96416f3c
33 changed files with 88 additions and 59 deletions

View File

@ -37,13 +37,12 @@
#include <sslopt-vars.h>
/* That one is necessary for defines of OPTION_NO_FOREIGN_KEY_CHECKS etc */
#include "sql_priv.h"
#include "sql_basic_types.h"
#include "log_event.h"
#include "compat56.h"
#include "sql_common.h"
#include "my_dir.h"
#include <welcome_copyright_notice.h> // ORACLE_WELCOME_COPYRIGHT_NOTICE
#include "sql_string.h" // needed for Rpl_filter
#include "sql_list.h" // needed for Rpl_filter
#include "rpl_filter.h"

View File

@ -18,6 +18,7 @@
#ifdef HAVE_QUERY_CACHE
#include <mysql.h>
#include "sql_basic_types.h"
#include "emb_qcache.h"
#include "embedded_priv.h"
#include "sql_class.h" // THD

View File

@ -32,10 +32,11 @@
#define MYSQL_SERVER
#endif
#include <sql_cache.h>
#include <my_global.h>
#include <sql_parse.h> // check_global_access
#include <sql_acl.h> // PROCESS_ACL
#include <sql_class.h> // THD
#include <sql_cache.h>
#include <table.h> // ST_SCHEMA_TABLE
#include <set_var.h> // sql_mode_string_representation
#include <tztime.h>

View File

@ -132,7 +132,7 @@ public:
ulonglong created;
ulonglong modified;
ulong sql_mode;
sql_mode_t sql_mode;
class Stored_program_creation_ctx *creation_ctx;
LEX_STRING body_utf8;
@ -158,7 +158,7 @@ public:
LEX_STRING definer_user;
LEX_STRING definer_host;
ulong sql_mode;
sql_mode_t sql_mode;
class Stored_program_creation_ctx *creation_ctx;

View File

@ -202,7 +202,7 @@ mysql_event_fill_row(THD *thd,
TABLE *table,
Event_parse_data *et,
sp_head *sp,
ulonglong sql_mode,
sql_mode_t sql_mode,
my_bool is_update)
{
CHARSET_INFO *scs= system_charset_info;
@ -658,7 +658,7 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data,
int ret= 1;
TABLE *table= NULL;
sp_head *sp= thd->lex->sphead;
ulonglong saved_mode= thd->variables.sql_mode;
sql_mode_t saved_mode= thd->variables.sql_mode;
/*
Take a savepoint to release only the lock on mysql.event
table at the end but keep the global read lock and
@ -787,7 +787,7 @@ Event_db_repository::update_event(THD *thd, Event_parse_data *parse_data,
CHARSET_INFO *scs= system_charset_info;
TABLE *table= NULL;
sp_head *sp= thd->lex->sphead;
ulonglong saved_mode= thd->variables.sql_mode;
sql_mode_t saved_mode= thd->variables.sql_mode;
/*
Take a savepoint to release only the lock on mysql.event
table at the end but keep the global read lock and

View File

@ -25,7 +25,9 @@
#pragma interface /* gcc class implementation */
#endif
#include <my_global.h> /* For handlers */
#include "sql_const.h"
#include "sql_basic_types.h"
#include "mysqld.h" /* server_id */
#include "sql_plugin.h" /* plugin_ref, st_plugin_int, plugin */
#include "thr_lock.h" /* thr_lock_type, THR_LOCK_DATA */

View File

@ -1388,7 +1388,7 @@ int Item::save_in_field_no_warnings(Field *field, bool no_conversions)
THD *thd= table->in_use;
enum_check_fields tmp= thd->count_cuted_fields;
my_bitmap_map *old_map= dbug_tmp_use_all_columns(table, table->write_set);
ulonglong sql_mode= thd->variables.sql_mode;
sql_mode_t sql_mode= thd->variables.sql_mode;
thd->variables.sql_mode&= ~(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE);
thd->variables.sql_mode|= MODE_INVALID_DATES;
thd->count_cuted_fields= CHECK_FIELD_IGNORE;

View File

@ -413,7 +413,7 @@ static bool convert_const_to_int(THD *thd, Item_field *field_item,
if ((*item)->const_item() && !(*item)->is_expensive())
{
TABLE *table= field->table;
ulonglong orig_sql_mode= thd->variables.sql_mode;
sql_mode_t orig_sql_mode= thd->variables.sql_mode;
enum_check_fields orig_count_cuted_fields= thd->count_cuted_fields;
my_bitmap_map *old_maps[2];
ulonglong UNINIT_VAR(orig_field_val); /* original field value if valid */

View File

@ -6279,7 +6279,7 @@ Item *create_temporal_literal(THD *thd,
MYSQL_TIME_STATUS status;
MYSQL_TIME ltime;
Item *item= NULL;
ulonglong flags= sql_mode_for_dates(thd);
sql_mode_t flags= sql_mode_for_dates(thd);
switch(type)
{

View File

@ -529,7 +529,7 @@ public:
class Item_temporal_func: public Item_func
{
ulonglong sql_mode;
sql_mode_t sql_mode;
public:
Item_temporal_func(THD *thd): Item_func(thd) {}
Item_temporal_func(THD *thd, Item *a): Item_func(thd, a) {}

View File

@ -3591,7 +3591,7 @@ Query_log_event::Query_log_event(const char* buf, uint event_len,
{
CHECK_SPACE(pos, end, 8);
sql_mode_inited= 1;
sql_mode= (ulong) uint8korr(pos); // QQ: Fix when sql_mode is ulonglong
sql_mode= (sql_mode_t) uint8korr(pos);
DBUG_PRINT("info",("In Query_log_event, read sql_mode: %llu", sql_mode));
pos+= 8;
break;
@ -4073,8 +4073,9 @@ void Query_log_event::print_query_header(IO_CACHE* file,
(unlikely(print_event_info->sql_mode != sql_mode ||
!print_event_info->sql_mode_inited)))
{
my_b_printf(file,"SET @@session.sql_mode=%lu%s\n",
(ulong)sql_mode, print_event_info->delimiter);
char llbuff[22];
my_b_printf(file,"SET @@session.sql_mode=%s%s\n",
ullstr(sql_mode, llbuff), print_event_info->delimiter);
print_event_info->sql_mode= sql_mode;
print_event_info->sql_mode_inited= 1;
}
@ -4304,8 +4305,8 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
*/
if (sql_mode_inited)
thd->variables.sql_mode=
(ulong) ((thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE) |
(sql_mode & ~(ulong) MODE_NO_DIR_IN_CREATE));
(sql_mode_t) ((thd->variables.sql_mode & MODE_NO_DIR_IN_CREATE) |
(sql_mode & ~(ulong) MODE_NO_DIR_IN_CREATE));
if (charset_inited)
{
rpl_sql_thread_info *sql_info= thd->system_thread_info.rpl_sql_info;
@ -10042,7 +10043,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
extra columns on the slave. In that case, do not force
MODE_NO_AUTO_VALUE_ON_ZERO.
*/
ulonglong saved_sql_mode= thd->variables.sql_mode;
sql_mode_t saved_sql_mode= thd->variables.sql_mode;
if (!is_auto_inc_in_extra_columns())
thd->variables.sql_mode= MODE_NO_AUTO_VALUE_ON_ZERO;

View File

@ -754,7 +754,7 @@ typedef struct st_print_event_info
bool flags2_inited;
uint32 flags2;
bool sql_mode_inited;
ulonglong sql_mode; /* must be same as THD.variables.sql_mode */
sql_mode_t sql_mode; /* must be same as THD.variables.sql_mode */
ulong auto_increment_increment, auto_increment_offset;
bool charset_inited;
char charset[6]; // 3 variables, each of them storable in 2 bytes
@ -1951,8 +1951,7 @@ public:
bool charset_inited;
uint32 flags2;
/* In connections sql_mode is 32 bits now but will be 64 bits soon */
ulonglong sql_mode;
sql_mode_t sql_mode;
ulong auto_increment_increment, auto_increment_offset;
char charset[6];
uint time_zone_len; /* 0 means uninited */

View File

@ -17,7 +17,8 @@
#ifndef MYSQLD_INCLUDED
#define MYSQLD_INCLUDED
#include "my_global.h" /* MYSQL_PLUGIN_IMPORT, FN_REFLEN, FN_EXTLEN */
#include <my_global.h> /* MYSQL_PLUGIN_IMPORT, FN_REFLEN, FN_EXTLEN */
#include "sql_basic_types.h" /* query_id_t */
#include "sql_bitmap.h" /* Bitmap */
#include "my_decimal.h" /* my_decimal */
#include "mysql_com.h" /* SERVER_VERSION_LENGTH */
@ -698,7 +699,6 @@ enum enum_query_type
/* query_id */
typedef int64 query_id_t;
extern query_id_t global_query_id;
void unireg_end(void) __attribute__((noreturn));

View File

@ -410,7 +410,7 @@ inline bool IS_SYSVAR_AUTOSIZE(void *ptr)
bool fix_delay_key_write(sys_var *self, THD *thd, enum_var_type type);
ulonglong expand_sql_mode(ulonglong sql_mode);
sql_mode_t expand_sql_mode(sql_mode_t sql_mode);
bool sql_mode_string_representation(THD *thd, sql_mode_t sql_mode, LEX_STRING *ls);
int default_regex_flags_pcre(const THD *thd);

View File

@ -41,7 +41,7 @@
static int
db_load_routine(THD *thd, stored_procedure_type type, sp_name *name,
sp_head **sphp,
ulonglong sql_mode, const char *params, const char *returns,
sql_mode_t sql_mode, const char *params, const char *returns,
const char *body, st_sp_chistics &chistics,
LEX_STRING *definer_user_name, LEX_STRING *definer_host_name,
longlong created, longlong modified,
@ -539,7 +539,7 @@ db_find_routine(THD *thd, stored_procedure_type type, sp_name *name,
char buff[65];
String str(buff, sizeof(buff), &my_charset_bin);
bool saved_time_zone_used= thd->time_zone_used;
ulonglong sql_mode, saved_mode= thd->variables.sql_mode;
sql_mode_t sql_mode, saved_mode= thd->variables.sql_mode;
Open_tables_backup open_tables_state_backup;
Stored_program_creation_ctx *creation_ctx;
char definer_user_name_holder[USERNAME_LENGTH + 1];
@ -727,11 +727,11 @@ Silence_deprecated_warning::handle_condition(
@retval 0 error
*/
static sp_head *sp_compile(THD *thd, String *defstr, ulonglong sql_mode,
static sp_head *sp_compile(THD *thd, String *defstr, sql_mode_t sql_mode,
Stored_program_creation_ctx *creation_ctx)
{
sp_head *sp;
ulonglong old_sql_mode= thd->variables.sql_mode;
sql_mode_t old_sql_mode= thd->variables.sql_mode;
ha_rows old_select_limit= thd->variables.select_limit;
sp_rcontext *old_spcont= thd->spcont;
Silence_deprecated_warning warning_handler;
@ -810,7 +810,7 @@ Bad_db_error_handler::handle_condition(THD *thd,
static int
db_load_routine(THD *thd, stored_procedure_type type,
sp_name *name, sp_head **sphp,
ulonglong sql_mode, const char *params, const char *returns,
sql_mode_t sql_mode, const char *params, const char *returns,
const char *body, st_sp_chistics &chistics,
LEX_STRING *definer_user_name, LEX_STRING *definer_host_name,
longlong created, longlong modified,
@ -1024,7 +1024,7 @@ sp_create_routine(THD *thd, stored_procedure_type type, sp_head *sp)
TABLE *table;
char definer_buf[USER_HOST_BUFF_SIZE];
LEX_STRING definer;
ulonglong saved_mode= thd->variables.sql_mode;
sql_mode_t saved_mode= thd->variables.sql_mode;
MDL_key::enum_mdl_namespace mdl_type= type == TYPE_ENUM_FUNCTION ?
MDL_key::FUNCTION : MDL_key::PROCEDURE;
@ -2212,9 +2212,9 @@ show_create_sp(THD *thd, String *buf,
st_sp_chistics *chistics,
const LEX_STRING *definer_user,
const LEX_STRING *definer_host,
ulonglong sql_mode)
sql_mode_t sql_mode)
{
ulonglong old_sql_mode= thd->variables.sql_mode;
sql_mode_t old_sql_mode= thd->variables.sql_mode;
/* Make some room to begin with */
if (buf->alloc(100 + dblen + 1 + namelen + paramslen + returnslen + bodylen +
chistics->comment.length + 10 /* length of " DEFINER= "*/ +
@ -2301,7 +2301,8 @@ show_create_sp(THD *thd, String *buf,
sp_head *
sp_load_for_information_schema(THD *thd, TABLE *proc_table, String *db,
String *name, ulong sql_mode, stored_procedure_type type,
String *name, sql_mode_t sql_mode,
stored_procedure_type type,
const char *returns, const char *params,
bool *free_sp_head)
{

View File

@ -200,7 +200,8 @@ TABLE *open_proc_table_for_read(THD *thd, Open_tables_backup *backup);
sp_head *
sp_load_for_information_schema(THD *thd, TABLE *proc_table, String *db,
String *name, ulong sql_mode, stored_procedure_type type,
String *name, sql_mode_t sql_mode,
stored_procedure_type type,
const char *returns, const char *params,
bool *free_sp_head);
@ -228,5 +229,5 @@ bool show_create_sp(THD *thd, String *buf,
st_sp_chistics *chistics,
const LEX_STRING *definer_user,
const LEX_STRING *definer_host,
ulonglong sql_mode);
sql_mode_t sql_mode);
#endif /* _SP_H_ */

View File

@ -2413,7 +2413,7 @@ sp_head::do_cont_backpatch()
void
sp_head::set_info(longlong created, longlong modified,
st_sp_chistics *chistics, ulonglong sql_mode)
st_sp_chistics *chistics, sql_mode_t sql_mode)
{
m_created= created;
m_modified= modified;

View File

@ -182,7 +182,7 @@ public:
const char *m_tmp_query; ///< Temporary pointer to sub query string
st_sp_chistics *m_chistics;
ulonglong m_sql_mode; ///< For SHOW CREATE and execution
sql_mode_t m_sql_mode; ///< For SHOW CREATE and execution
LEX_STRING m_qname; ///< db.name
bool m_explicit_name; ///< Prepend the db name? */
LEX_STRING m_db;
@ -421,7 +421,7 @@ public:
Column_definition *field_def);
void set_info(longlong created, longlong modified,
st_sp_chistics *chistics, ulonglong sql_mode);
st_sp_chistics *chistics, sql_mode_t sql_mode);
void set_definer(const char *definer, uint definerlen);
void set_definer(const LEX_STRING *user_name, const LEX_STRING *host_name);

View File

@ -1196,7 +1196,7 @@ static bool acl_load(THD *thd, TABLE_LIST *tables)
bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
char tmp_name[SAFE_NAME_LEN+1];
int password_length;
ulonglong old_sql_mode= thd->variables.sql_mode;
sql_mode_t old_sql_mode= thd->variables.sql_mode;
DBUG_ENTER("acl_load");
thd->variables.sql_mode&= ~MODE_PAD_CHAR_TO_FULL_LENGTH;
@ -6600,7 +6600,7 @@ static bool grant_load(THD *thd, TABLE_LIST *tables)
TABLE *t_table, *c_table, *p_table;
bool check_no_resolve= specialflag & SPECIAL_NO_RESOLVE;
MEM_ROOT *save_mem_root= thd->mem_root;
ulonglong old_sql_mode= thd->variables.sql_mode;
sql_mode_t old_sql_mode= thd->variables.sql_mode;
DBUG_ENTER("grant_load");
thd->variables.sql_mode&= ~MODE_PAD_CHAR_TO_FULL_LENGTH;
@ -9643,7 +9643,7 @@ bool mysql_drop_user(THD *thd, List <LEX_USER> &list, bool handle_as_role)
List_iterator <LEX_USER> user_list(list);
TABLE_LIST tables[TABLES_MAX];
bool binlog= false;
ulonglong old_sql_mode= thd->variables.sql_mode;
sql_mode_t old_sql_mode= thd->variables.sql_mode;
DBUG_ENTER("mysql_drop_user");
DBUG_PRINT("entry", ("Handle as %s", handle_as_role ? "role" : "user"));

25
sql/sql_basic_types.h Normal file
View File

@ -0,0 +1,25 @@
/*
Copyright (c) 2000, 2016, Oracle and/or its affiliates.
Copyright (c) 2009, 2016, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
/* File that includes common types used globally in MariaDB */
#ifndef SQL_TYPES_INCLUDED
#define SQL_TYPES_INCLUDED
typedef ulonglong sql_mode_t;
typedef int64 query_id_t;
#endif

View File

@ -330,6 +330,7 @@ TODO list:
#include <my_global.h> /* NO_EMBEDDED_ACCESS_CHECKS */
#include "sql_priv.h"
#include "sql_basic_types.h"
#include "sql_cache.h"
#include "sql_parse.h" // check_table_access
#include "tztime.h" // struct Time_zone

View File

@ -548,7 +548,7 @@ struct Query_cache_query_flags
uint collation_connection_num;
ha_rows limit;
Time_zone *time_zone;
ulonglong sql_mode;
sql_mode_t sql_mode;
ulong max_sort_length;
ulong group_concat_max_len;
ulong default_week_format;

View File

@ -502,8 +502,6 @@ enum killed_type
KILL_TYPE_QUERY
};
typedef ulonglong sql_mode_t;
#include "sql_lex.h" /* Must be here */
class Delayed_insert;

View File

@ -857,7 +857,7 @@ error2:
bool mysqld_help(THD *thd, const char *mask)
{
ulonglong sql_mode_backup= thd->variables.sql_mode;
sql_mode_t sql_mode_backup= thd->variables.sql_mode;
thd->variables.sql_mode&= ~MODE_PAD_CHAR_TO_FULL_LENGTH;
bool rc= mysqld_help_internal(thd, mask);
thd->variables.sql_mode= sql_mode_backup;

View File

@ -1953,7 +1953,7 @@ public:
enum_duplicates dup;
my_time_t start_time;
ulong start_time_sec_part;
ulonglong sql_mode;
sql_mode_t sql_mode;
bool auto_increment_field_not_null;
bool query_start_used, ignore, log_query, query_start_sec_part_used;
bool stmt_depends_on_first_successful_insert_id_in_prev_stmt;

View File

@ -1757,7 +1757,7 @@ public:
enum store_key_result result;
THD *thd= to_field->table->in_use;
enum_check_fields saved_count_cuted_fields= thd->count_cuted_fields;
ulonglong sql_mode= thd->variables.sql_mode;
sql_mode_t orig_sql_mode= thd->variables.sql_mode;
thd->variables.sql_mode&= ~(MODE_NO_ZERO_IN_DATE | MODE_NO_ZERO_DATE);
thd->variables.sql_mode|= MODE_INVALID_DATES;
@ -1766,7 +1766,7 @@ public:
result= copy_inner();
thd->count_cuted_fields= saved_count_cuted_fields;
thd->variables.sql_mode= sql_mode;
thd->variables.sql_mode= orig_sql_mode;
return result;
}

View File

@ -9669,7 +9669,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to,
List<Item> all_fields;
bool auto_increment_field_copied= 0;
bool init_read_record_done= 0;
ulonglong save_sql_mode= thd->variables.sql_mode;
sql_mode_t save_sql_mode= thd->variables.sql_mode;
ulonglong prev_insert_id, time_to_report_progress;
Field **dfield_ptr= to->default_field;
DBUG_ENTER("copy_data_between_tables");

View File

@ -1388,7 +1388,7 @@ bool Table_triggers_list::check_n_load(THD *thd, const char *db,
information about mode in old format.
*/
sql_mode= ((trg_sql_mode= itm++) ? *trg_sql_mode :
global_system_variables.sql_mode);
(ulonglong) global_system_variables.sql_mode);
trg_create_time= it_create_times++; // May be NULL if old file
trg_definer= it_definer++; // May be NULL if old file
@ -1871,7 +1871,7 @@ Table_triggers_list::change_table_name_in_triggers(THD *thd,
LEX_STRING *new_table_name)
{
struct change_table_name_param param;
ulonglong save_sql_mode= thd->variables.sql_mode;
sql_mode_t save_sql_mode= thd->variables.sql_mode;
char path_buff[FN_REFLEN];
param.thd= thd;

View File

@ -109,7 +109,7 @@ public:
LEX_STRING db_cl_name;
GRANT_INFO subject_table_grants;
ulonglong sql_mode;
sql_mode_t sql_mode;
/* Store create time. Can't be mysql_time_t as this holds also sub seconds */
ulonglong create_time;
trg_event_type event;

View File

@ -914,7 +914,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
view_query.length(0);
is_query.length(0);
{
ulong sql_mode= thd->variables.sql_mode & MODE_ANSI_QUOTES;
sql_mode_t sql_mode= thd->variables.sql_mode & MODE_ANSI_QUOTES;
thd->variables.sql_mode&= ~MODE_ANSI_QUOTES;
lex->unit.print(&view_query, enum_query_type(QT_VIEW_INTERNAL |
@ -1346,7 +1346,7 @@ bool mysql_make_view(THD *thd, TABLE_SHARE *share, TABLE_LIST *table,
view_select= &lex->select_lex;
view_select->select_number= ++thd->select_number;
ulonglong saved_mode= thd->variables.sql_mode;
sql_mode_t saved_mode= thd->variables.sql_mode;
/* switch off modes which can prevent normal parsing of VIEW
- MODE_REAL_AS_FLOAT affect only CREATE TABLE parsing
+ MODE_PIPES_AS_CONCAT affect expression parsing

View File

@ -3001,7 +3001,7 @@ static Sys_var_ulonglong Sys_sort_buffer(
VALID_RANGE(MIN_SORT_MEMORY, SIZE_T_MAX), DEFAULT(MAX_SORT_MEMORY),
BLOCK_SIZE(1));
export ulonglong expand_sql_mode(ulonglong sql_mode)
export sql_mode_t expand_sql_mode(sql_mode_t sql_mode)
{
if (sql_mode & MODE_ANSI)
{
@ -3055,7 +3055,7 @@ export ulonglong expand_sql_mode(ulonglong sql_mode)
static bool check_sql_mode(sys_var *self, THD *thd, set_var *var)
{
var->save_result.ulonglong_value=
expand_sql_mode(var->save_result.ulonglong_value);
(ulonglong) expand_sql_mode(var->save_result.ulonglong_value);
return false;
}
static bool fix_sql_mode(sys_var *self, THD *thd, enum_var_type type)

View File

@ -2403,7 +2403,7 @@ static bool sql_unusable_for_discovery(THD *thd, handlerton *engine,
int TABLE_SHARE::init_from_sql_statement_string(THD *thd, bool write,
const char *sql, size_t sql_length)
{
ulonglong saved_mode= thd->variables.sql_mode;
sql_mode_t saved_mode= thd->variables.sql_mode;
CHARSET_INFO *old_cs= thd->variables.character_set_client;
Parser_state parser_state;
bool error;
@ -3795,7 +3795,7 @@ bool get_field(MEM_ROOT *mem, Field *field, String *res)
String str(buff,sizeof(buff),&my_charset_bin);
bool rc;
THD *thd= field->get_thd();
ulonglong sql_mode_backup= thd->variables.sql_mode;
sql_mode_t sql_mode_backup= thd->variables.sql_mode;
thd->variables.sql_mode&= ~MODE_PAD_CHAR_TO_FULL_LENGTH;
field->val_str(&str);

View File

@ -2216,7 +2216,7 @@ static int wsrep_create_sp(THD *thd, uchar** buf, size_t* buf_len)
{
String log_query;
sp_head *sp = thd->lex->sphead;
ulong saved_mode= thd->variables.sql_mode;
sql_mode_t saved_mode= thd->variables.sql_mode;
String retstr(64);
retstr.set_charset(system_charset_info);