Fixed compiler and valgrind warnings
Added missing DBUG_xxx_RETURN statements Fixed some usage of not initialized variables (as found by valgrind) Ensure that we don't remove locked tables used as name locks from open table cache until unlock_table_names() are called. This was fixed by having drop_locked_name() returning any table used as a name lock so that we can free it in unlock_table_names() This will allow Tomas to continue with his work to use namelocks to syncronize things. Note: valgrind still produces a lot of warnings about using not initialized code and shows memory loss errors when running the ndb tests BitKeeper/etc/ignore: added mysql-test/r/*.log client/mysqltest.c: Change type of variables to get rid of compiler warnings More debugging Fix memory leak mysql-test/mysql-test-run.sh: Collect warnings about missing DBUG_RETURN statements mysql-test/r/lock_multi.result: Add test of new code mysql-test/r/ndb_condition_pushdown.result: Drop used tables before test mysql-test/t/lock_multi.test: Add test of new code mysql-test/t/ndb_condition_pushdown.test: Drop used tables before test mysql-test/valgrind.supp: Ignore 'safe' warnings from libz (when used with archive) sql/event.cc: More comments Simplify code Fixed memory leak found by valgrind sql/ha_archive.cc: Remove compiler warnings (Wrong handlerton structure and signed/unsigned comparison) sql/ha_berkeley.cc: Fixed compiler warning sql/ha_blackhole.cc: Fixed compiler warning sql/ha_federated.cc: Fixed compiler warning sql/ha_heap.cc: Fixed compiler warning sql/ha_myisam.cc: Fixed compiler warning sql/ha_myisammrg.cc: Fixed compiler warning sql/ha_ndbcluster.cc: Fixed compiler warnings sql/ha_partition.cc: Fixed compiler warning Fixed error noticed by valgrind in ha_partition::rnd_init() sql/handler.cc: Fixed compiler warning sql/handler.h: Fixed compiler warning sql/item.cc: Fixed compiler warning sql/item_xmlfunc.cc: Fixed warning from valgrind when calling memcpy with wrong address sql/lock.cc: More debugging sql/log.cc: Fixed compiler warning Indentation fixes sql/log.h: Fixed compiler warning sql/mysql_priv.h: Changed prototype for 'drop_locked_tables' sql/opt_range.cc: Indentation fix sql/password.c: Removed compiler warnings sql/set_var.cc: Fixed compiler warning sql/slave.cc: Fixed compiler warning sql/sp_head.cc: Fixed compiler warning sql/sql_acl.cc: Fixed compiler warning sql/sql_analyse.cc: Added missing DBUG_RETURN statements sql/sql_base.cc: Removed de-reference of not initialized pointer More comments drop_locked_tables() changed to not delete tables used for name locking Fixed compiler warnings sql/sql_delete.cc: Fixed usage of not initialized variable (deleted could be referenced in some not common error conditions) sql/sql_parse.cc: Added missing DBUG_VOID_RETURN Simplify code sql/sql_partition.cc: Fixed usage of wrong variable (noticed by valgrind) sql/sql_plugin.cc: Removed compiler warning sql/sql_show.cc: Removed compiler warning sql/sql_table.cc: Ensure that we don't remove locked tables used as name locks from open table cache until unlock_table_names() are called. This was fixed by having drop_locked_name() returning any table used as a name lock so that we can free it in unlock_table_names() This will allow Tomas to continue with his work to use namelocks to syncronize things. Fixed wrong test of 'table_type' (path_length could otherwise be accessed uninitialized) Remove compile warnings about not initialized variables. sql/sql_yacc.yy: Ensure that no_write_to_binlog is properly initialized (Was accessed uninitialized by partition code) sql/table.cc: Removed valgrind warnings (not fatal) Removed compiler warnings sql/tztime.cc: Removed valgrind warning storage/ndb/include/ndbapi/NdbIndexStat.hpp: Removed compiler warning
This commit is contained in:
parent
73970addd8
commit
59eaf292de
@ -1758,3 +1758,4 @@ vio/viotest-sslconnect.cpp
|
||||
vio/viotest.cpp
|
||||
zlib/*.ds?
|
||||
zlib/*.vcproj
|
||||
mysql-test/r/*.log
|
||||
|
@ -209,9 +209,9 @@ struct st_replace_regex
|
||||
*/
|
||||
char* buf;
|
||||
char* even_buf;
|
||||
uint even_buf_len;
|
||||
char* odd_buf;
|
||||
uint odd_buf_len;
|
||||
int even_buf_len;
|
||||
int odd_buf_len;
|
||||
};
|
||||
|
||||
struct st_replace_regex *glob_replace_regex= 0;
|
||||
@ -1279,6 +1279,7 @@ int var_query_set(VAR* var, const char *query, const char** query_end)
|
||||
MYSQL_ROW row;
|
||||
MYSQL* mysql = &cur_con->mysql;
|
||||
LINT_INIT(res);
|
||||
DBUG_ENTER("var_query_set");
|
||||
|
||||
while (end > query && *end != '`')
|
||||
--end;
|
||||
@ -1340,7 +1341,7 @@ int var_query_set(VAR* var, const char *query, const char** query_end)
|
||||
eval_expr(var, "", 0);
|
||||
|
||||
mysql_free_result(res);
|
||||
return 0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
void var_copy(VAR *dest, VAR *src)
|
||||
@ -1517,6 +1518,7 @@ void do_system(struct st_query *command)
|
||||
}
|
||||
|
||||
command->last_argument= command->end;
|
||||
dynstr_free(&ds_cmd);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
@ -1557,7 +1559,7 @@ int do_echo(struct st_query *command)
|
||||
dynstr_append_mem(ds, "\n", 1);
|
||||
dynstr_free(&ds_echo);
|
||||
command->last_argument= command->end;
|
||||
return 0;
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
@ -1660,7 +1662,7 @@ int do_save_master_pos()
|
||||
|
||||
if (have_ndbcluster)
|
||||
{
|
||||
ulonglong epoch, tmp_epoch= 0;
|
||||
ulonglong epoch=0, tmp_epoch= 0;
|
||||
int count= 0;
|
||||
|
||||
do
|
||||
|
@ -1088,7 +1088,7 @@ report_stats () {
|
||||
|
||||
found_error=0
|
||||
# Find errors
|
||||
for i in "^Warning:" "^Error:" "^==.* at 0x" "InnoDB: Warning"
|
||||
for i in "^Warning:" "^Error:" "^==.* at 0x" "InnoDB: Warning" "missing DBUG_RETURN"
|
||||
do
|
||||
if $GREP "$i" $MY_LOG_DIR/warnings.tmp >> $MY_LOG_DIR/warnings
|
||||
then
|
||||
|
@ -36,6 +36,13 @@ lock table t1 write, t2 write;
|
||||
drop table t2;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
drop table t1;
|
||||
create table t1 (a int);
|
||||
create table t2 (a int);
|
||||
lock table t1 write, t2 write, t1 as t1_2 write, t2 as t2_2 write;
|
||||
insert t1 select * from t2;
|
||||
drop table t2;
|
||||
ERROR 42S02: Table 'test.t2' doesn't exist
|
||||
drop table t1;
|
||||
create table t1(a int);
|
||||
lock tables t1 write;
|
||||
show columns from t1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
DROP TABLE IF EXISTS t1,t2,t3,t4;
|
||||
CREATE TABLE t1 (
|
||||
auto int(5) unsigned NOT NULL auto_increment,
|
||||
string char(10),
|
||||
|
@ -95,6 +95,25 @@ reap;
|
||||
connection locker;
|
||||
drop table t1;
|
||||
|
||||
#
|
||||
# Same test as above, but with the dropped table locked twice
|
||||
#
|
||||
|
||||
connection locker;
|
||||
create table t1 (a int);
|
||||
create table t2 (a int);
|
||||
lock table t1 write, t2 write, t1 as t1_2 write, t2 as t2_2 write;
|
||||
connection reader;
|
||||
send insert t1 select * from t2;
|
||||
connection locker;
|
||||
drop table t2;
|
||||
connection reader;
|
||||
--error 1146
|
||||
reap;
|
||||
connection locker;
|
||||
drop table t1;
|
||||
|
||||
|
||||
# End of 4.1 tests
|
||||
|
||||
#
|
||||
|
@ -2,7 +2,7 @@
|
||||
-- source include/not_embedded.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1,t2;
|
||||
DROP TABLE IF EXISTS t1,t2,t3,t4;
|
||||
--enable_warnings
|
||||
|
||||
#
|
||||
|
@ -153,6 +153,15 @@
|
||||
fun:gzflush
|
||||
}
|
||||
|
||||
{
|
||||
libz deflate3
|
||||
Memcheck:Cond
|
||||
obj:*/libz.so.*
|
||||
obj:*/libz.so.*
|
||||
fun:deflate
|
||||
fun:do_flush
|
||||
}
|
||||
|
||||
#
|
||||
# Warning from my_thread_init becasue mysqld dies before kill thread exists
|
||||
#
|
||||
|
21
sql/event.cc
21
sql/event.cc
@ -952,6 +952,10 @@ err:
|
||||
NOTES
|
||||
1) Use sp_name for look up, return in **ett if found
|
||||
2) tbl is not closed at exit
|
||||
|
||||
RETURN
|
||||
0 ok In this case *ett is set to the event
|
||||
# error *ett == 0
|
||||
*/
|
||||
|
||||
static int
|
||||
@ -960,7 +964,7 @@ db_find_event(THD *thd, sp_name *name, LEX_STRING *definer, Event_timed **ett,
|
||||
{
|
||||
TABLE *table;
|
||||
int ret;
|
||||
Event_timed *et=NULL;
|
||||
Event_timed *et= 0;
|
||||
DBUG_ENTER("db_find_event");
|
||||
DBUG_PRINT("enter", ("name: %*s", name->m_name.length, name->m_name.str));
|
||||
|
||||
@ -997,7 +1001,7 @@ db_find_event(THD *thd, sp_name *name, LEX_STRING *definer, Event_timed **ett,
|
||||
}
|
||||
|
||||
done:
|
||||
if (ret && et)
|
||||
if (ret)
|
||||
{
|
||||
delete et;
|
||||
et= 0;
|
||||
@ -1382,7 +1386,7 @@ evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer)
|
||||
ret= db_find_event(thd, spn, &definer, &et, NULL, thd->mem_root);
|
||||
thd->restore_backup_open_tables_state(&backup);
|
||||
|
||||
if (!ret && et)
|
||||
if (et)
|
||||
{
|
||||
Protocol *protocol= thd->protocol;
|
||||
char show_str_buf[768];
|
||||
@ -1392,10 +1396,12 @@ evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer)
|
||||
ulong sql_mode_len=0;
|
||||
|
||||
show_str.length(0);
|
||||
show_str.set_charset(system_charset_info);
|
||||
|
||||
if (et->get_create_event(thd, &show_str))
|
||||
{
|
||||
delete et;
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
||||
field_list.push_back(new Item_empty_string("Event", NAME_LEN));
|
||||
|
||||
@ -1409,16 +1415,19 @@ evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer)
|
||||
show_str.length()));
|
||||
if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS |
|
||||
Protocol::SEND_EOF))
|
||||
{
|
||||
delete et;
|
||||
DBUG_RETURN(1);
|
||||
|
||||
}
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(et->name.str, et->name.length, system_charset_info);
|
||||
|
||||
protocol->store((char*) sql_mode_str, sql_mode_len, system_charset_info);
|
||||
|
||||
protocol->store(show_str.c_ptr(), show_str.length(), system_charset_info);
|
||||
protocol->store(show_str.ptr(), show_str.length(), system_charset_info);
|
||||
ret= protocol->write();
|
||||
send_eof(thd);
|
||||
delete et;
|
||||
}
|
||||
|
||||
DBUG_RETURN(ret);
|
||||
|
@ -180,7 +180,9 @@ handlerton archive_hton = {
|
||||
NULL, /* fill_files_table */
|
||||
HTON_NO_FLAGS,
|
||||
NULL, /* binlog_func */
|
||||
NULL /* binlog_log_query */
|
||||
NULL, /* binlog_log_query */
|
||||
NULL /* release_temporary_latches */
|
||||
|
||||
};
|
||||
|
||||
static handler *archive_create_handler(TABLE_SHARE *table)
|
||||
@ -1228,10 +1230,11 @@ int ha_archive::optimize(THD* thd, HA_CHECK_OPT* check_opt)
|
||||
if (table->found_next_number_field)
|
||||
{
|
||||
Field *field= table->found_next_number_field;
|
||||
if (share->auto_increment_value <
|
||||
field->val_int((char*)(buf + field->offset())))
|
||||
ulonglong auto_value=
|
||||
(ulonglong) field->val_int((char*)(buf + field->offset()));
|
||||
if (share->auto_increment_value < auto_value)
|
||||
auto_increment_value= share->auto_increment_value=
|
||||
field->val_int((char*)(buf + field->offset()));
|
||||
auto_value;
|
||||
}
|
||||
share->rows_recorded++;
|
||||
}
|
||||
|
@ -155,7 +155,8 @@ handlerton berkeley_hton = {
|
||||
NULL, /* Fill Files Table */
|
||||
HTON_CLOSE_CURSORS_AT_COMMIT | HTON_FLUSH_AFTER_RENAME,
|
||||
NULL, /* binlog_func */
|
||||
NULL /* binlog_log_query */
|
||||
NULL, /* binlog_log_query */
|
||||
NULL /* release_temporary_latches */
|
||||
};
|
||||
|
||||
handler *berkeley_create_handler(TABLE_SHARE *table)
|
||||
|
@ -62,8 +62,9 @@ handlerton blackhole_hton= {
|
||||
NULL, /* Alter Tablespace */
|
||||
NULL, /* Fill FILES table */
|
||||
HTON_CAN_RECREATE,
|
||||
NULL, /* binlog_func */
|
||||
NULL /* binlog_log_query */
|
||||
NULL, /* binlog_func */
|
||||
NULL, /* binlog_log_query */
|
||||
NULL /* release_temporary_latches */
|
||||
};
|
||||
|
||||
|
||||
|
@ -400,7 +400,8 @@ handlerton federated_hton= {
|
||||
NULL, /* Fill FILES table */
|
||||
HTON_ALTER_NOT_SUPPORTED,
|
||||
NULL, /* binlog_func */
|
||||
NULL /* binlog_log_query */
|
||||
NULL, /* binlog_log_query */
|
||||
NULL /* release_temporary_latches */
|
||||
};
|
||||
|
||||
|
||||
|
@ -60,7 +60,8 @@ handlerton heap_hton= {
|
||||
NULL, /* Fill Files Table */
|
||||
HTON_CAN_RECREATE,
|
||||
NULL, /* binlog_func */
|
||||
NULL /* binlog_log_query */
|
||||
NULL, /* binlog_log_query */
|
||||
NULL /* release_temporary_latches */
|
||||
};
|
||||
|
||||
static handler *heap_create_handler(TABLE_SHARE *table)
|
||||
|
@ -92,7 +92,8 @@ handlerton myisam_hton= {
|
||||
NULL, /* Fill Files Table */
|
||||
HTON_CAN_RECREATE,
|
||||
NULL, /* binlog_func */
|
||||
NULL /* binlog_log_query */
|
||||
NULL, /* binlog_log_query */
|
||||
NULL /* release_temporary_latches */
|
||||
};
|
||||
|
||||
|
||||
|
@ -70,7 +70,8 @@ handlerton myisammrg_hton= {
|
||||
NULL, /* Fill Files Table */
|
||||
HTON_CAN_RECREATE,
|
||||
NULL, /* binlog_func */
|
||||
NULL /* binlog_log_query */
|
||||
NULL, /* binlog_log_query */
|
||||
NULL /* release_temporary_latches */
|
||||
};
|
||||
|
||||
static handler *myisammrg_create_handler(TABLE_SHARE *table)
|
||||
|
@ -2336,7 +2336,7 @@ int ha_ndbcluster::ordered_index_scan(const key_range *start_key,
|
||||
if (generate_scan_filter(m_cond_stack, op))
|
||||
DBUG_RETURN(ndb_err(trans));
|
||||
|
||||
if (res= define_read_attrs(buf, op))
|
||||
if ((res= define_read_attrs(buf, op)))
|
||||
{
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
@ -9681,6 +9681,7 @@ int ndbcluster_alter_tablespace(THD* thd, st_alter_tablespace *info)
|
||||
NDBDICT *dict = ndb->getDictionary();
|
||||
int error;
|
||||
const char * errmsg;
|
||||
LINT_INIT(errmsg);
|
||||
|
||||
switch (info->ts_cmd_type){
|
||||
case (CREATE_TABLESPACE):
|
||||
|
@ -103,8 +103,9 @@ handlerton partition_hton = {
|
||||
NULL, /* Alter Tablespace */
|
||||
NULL, /* Fill FILES table */
|
||||
HTON_NOT_USER_SELECTABLE | HTON_HIDDEN,
|
||||
NULL, /* binlog_func */
|
||||
NULL /* binlog_log_query */
|
||||
NULL, /* binlog_func */
|
||||
NULL, /* binlog_log_query */
|
||||
NULL /* release_temporary_latches */
|
||||
};
|
||||
|
||||
/*
|
||||
@ -2914,12 +2915,15 @@ int ha_partition::rnd_init(bool scan)
|
||||
|
||||
/* Now we see what the index of our first important partition is */
|
||||
DBUG_PRINT("info", ("m_part_info->used_partitions 0x%x",
|
||||
m_part_info->used_partitions.bitmap));
|
||||
m_part_info->used_partitions.bitmap));
|
||||
part_id= bitmap_get_first_set(&(m_part_info->used_partitions));
|
||||
DBUG_PRINT("info", ("m_part_spec.start_part %d", part_id));
|
||||
|
||||
if (MY_BIT_NONE == part_id)
|
||||
{
|
||||
error= 0;
|
||||
goto err1;
|
||||
}
|
||||
|
||||
/*
|
||||
We have a partition and we are scanning with rnd_next
|
||||
@ -2958,7 +2962,7 @@ err:
|
||||
while ((int)--i >= (int)part_id)
|
||||
{
|
||||
if (bitmap_is_set(&(m_part_info->used_partitions), i))
|
||||
m_file[i]->ha_rnd_end();
|
||||
m_file[i]->ha_rnd_end();
|
||||
}
|
||||
err1:
|
||||
m_scan_value= 2;
|
||||
|
@ -68,7 +68,8 @@ const handlerton default_hton =
|
||||
NULL, /* fill_files_table */
|
||||
HTON_NO_FLAGS, /* flags */
|
||||
NULL, /* binlog_func */
|
||||
NULL /* binlog_log_query */
|
||||
NULL, /* binlog_log_query */
|
||||
NULL /* release_temporary_latches */
|
||||
};
|
||||
|
||||
static SHOW_COMP_OPTION have_yes= SHOW_OPTION_YES;
|
||||
|
@ -686,6 +686,8 @@ public:
|
||||
{
|
||||
do_prelock(tables, count);
|
||||
}
|
||||
virtual ~TABLEOP_HOOKS() {}
|
||||
TABLEOP_HOOKS() {}
|
||||
|
||||
private:
|
||||
/* Function primitive that is called prior to locking tables */
|
||||
|
@ -1362,6 +1362,9 @@ bool agg_item_charsets(DTCollation &coll, const char *fname,
|
||||
Item **args, uint nargs, uint flags)
|
||||
{
|
||||
Item **arg, **last, *safe_args[2];
|
||||
|
||||
LINT_INIT(safe_args[0]);
|
||||
LINT_INIT(safe_args[1]);
|
||||
if (agg_item_collations(coll, fname, args, nargs, flags))
|
||||
return TRUE;
|
||||
|
||||
|
@ -2403,8 +2403,7 @@ void Item_xml_str_func::fix_length_and_dec()
|
||||
char context[32];
|
||||
uint clen= xpath.query.end - xpath.lasttok.beg;
|
||||
set_if_bigger(clen, sizeof(context) - 1);
|
||||
memcpy(context, xpath.lasttok.beg, clen);
|
||||
context[clen]= '\0';
|
||||
strmake(context, xpath.lasttok.beg, clen);
|
||||
my_printf_error(ER_UNKNOWN_ERROR, "XPATH syntax error: '%s'",
|
||||
MYF(0), context);
|
||||
return;
|
||||
|
@ -911,11 +911,13 @@ end:
|
||||
void unlock_table_names(THD *thd, TABLE_LIST *table_list,
|
||||
TABLE_LIST *last_table)
|
||||
{
|
||||
DBUG_ENTER("unlock_table_names");
|
||||
for (TABLE_LIST *table= table_list;
|
||||
table != last_table;
|
||||
table= table->next_local)
|
||||
unlock_table_name(thd,table);
|
||||
pthread_cond_broadcast(&COND_refresh);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
|
14
sql/log.cc
14
sql/log.cc
@ -63,9 +63,11 @@ static int binlog_prepare(THD *thd, bool all);
|
||||
Don't add constructors, destructors, or virtual functions.
|
||||
*/
|
||||
struct binlog_trx_data {
|
||||
bool empty() const {
|
||||
bool empty() const
|
||||
{
|
||||
return pending == NULL && my_b_tell(&trans_log) == 0;
|
||||
}
|
||||
binlog_trx_data() {}
|
||||
IO_CACHE trans_log; // The transaction cache
|
||||
Rows_log_event *pending; // The pending binrows event
|
||||
};
|
||||
@ -104,7 +106,8 @@ handlerton binlog_hton = {
|
||||
NULL, /* Fill FILES table */
|
||||
HTON_NOT_USER_SELECTABLE | HTON_HIDDEN,
|
||||
NULL, /* binlog_func */
|
||||
NULL /* binlog_log_query */
|
||||
NULL, /* binlog_log_query */
|
||||
NULL /* release_temporary_latches */
|
||||
};
|
||||
|
||||
|
||||
@ -2637,8 +2640,9 @@ int THD::binlog_setup_trx_data()
|
||||
|
||||
int THD::binlog_write_table_map(TABLE *table, bool is_trans)
|
||||
{
|
||||
int error;
|
||||
DBUG_ENTER("THD::binlog_write_table_map");
|
||||
DBUG_PRINT("enter", ("table=%p (%s: #%u)",
|
||||
DBUG_PRINT("enter", ("table: %p (%s: #%u)",
|
||||
table, table->s->table_name, table->s->table_map_id));
|
||||
|
||||
/* Pre-conditions */
|
||||
@ -2655,10 +2659,10 @@ int THD::binlog_write_table_map(TABLE *table, bool is_trans)
|
||||
trans_register_ha(this, options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN),
|
||||
&binlog_hton);
|
||||
|
||||
if (int error= mysql_bin_log.write(&the_event))
|
||||
if ((error= mysql_bin_log.write(&the_event)))
|
||||
DBUG_RETURN(error);
|
||||
|
||||
++binlog_table_maps;
|
||||
binlog_table_maps++;
|
||||
table->s->table_map_version= mysql_bin_log.table_map_version();
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
@ -40,7 +40,8 @@ class TC_LOG
|
||||
|
||||
class TC_LOG_DUMMY: public TC_LOG // use it to disable the logging
|
||||
{
|
||||
public:
|
||||
public:
|
||||
TC_LOG_DUMMY() {}
|
||||
int open(const char *opt_name) { return 0; }
|
||||
void close() { }
|
||||
int log(THD *thd, my_xid xid) { return 1; }
|
||||
@ -354,6 +355,7 @@ public:
|
||||
class Log_event_handler
|
||||
{
|
||||
public:
|
||||
Log_event_handler() {}
|
||||
virtual bool init()= 0;
|
||||
virtual void cleanup()= 0;
|
||||
|
||||
|
@ -838,7 +838,7 @@ bool reopen_tables(THD *thd,bool get_locks,bool in_refresh);
|
||||
bool close_data_tables(THD *thd,const char *db, const char *table_name);
|
||||
bool wait_for_tables(THD *thd);
|
||||
bool table_is_used(TABLE *table, bool wait_for_name_lock);
|
||||
bool drop_locked_tables(THD *thd,const char *db, const char *table_name);
|
||||
TABLE *drop_locked_tables(THD *thd,const char *db, const char *table_name);
|
||||
void abort_locked_tables(THD *thd,const char *db, const char *table_name);
|
||||
void execute_init_command(THD *thd, sys_var_str *init_command_var,
|
||||
rw_lock_t *var_mutex);
|
||||
|
@ -6039,7 +6039,8 @@ SEL_ARG *
|
||||
SEL_ARG::insert(SEL_ARG *key)
|
||||
{
|
||||
SEL_ARG *element,**par,*last_element;
|
||||
LINT_INIT(par); LINT_INIT(last_element);
|
||||
LINT_INIT(par);
|
||||
LINT_INIT(last_element);
|
||||
|
||||
for (element= this; element != &null_element ; )
|
||||
{
|
||||
|
@ -323,7 +323,7 @@ void create_random_string(char *to, uint length, struct rand_struct *rand_st)
|
||||
|
||||
char *octet2hex(char *to, const char *str, uint len)
|
||||
{
|
||||
const byte *str_end= str + len;
|
||||
const char *str_end= str + len;
|
||||
for (; str != str_end; ++str)
|
||||
{
|
||||
*to++= _dig_vec_upper[((uchar) *str) >> 4];
|
||||
@ -406,7 +406,7 @@ make_scrambled_password(char *to, const char *password)
|
||||
mysql_sha1_result(&sha1_context, hash_stage2);
|
||||
/* convert hash_stage2 to hex string */
|
||||
*to++= PVERSION41_CHAR;
|
||||
octet2hex(to, hash_stage2, SHA1_HASH_SIZE);
|
||||
octet2hex(to, (const char*) hash_stage2, SHA1_HASH_SIZE);
|
||||
}
|
||||
|
||||
|
||||
@ -520,5 +520,5 @@ void get_salt_from_password(uint8 *hash_stage2, const char *password)
|
||||
void make_password_from_salt(char *to, const uint8 *hash_stage2)
|
||||
{
|
||||
*to++= PVERSION41_CHAR;
|
||||
octet2hex(to, hash_stage2, SHA1_HASH_SIZE);
|
||||
octet2hex(to, (const char*) hash_stage2, SHA1_HASH_SIZE);
|
||||
}
|
||||
|
@ -1965,6 +1965,7 @@ CHARSET_INFO *get_old_charset_by_name(const char *name)
|
||||
bool sys_var_collation::check(THD *thd, set_var *var)
|
||||
{
|
||||
CHARSET_INFO *tmp;
|
||||
LINT_INIT(tmp);
|
||||
|
||||
if (var->value->result_type() == STRING_RESULT)
|
||||
{
|
||||
@ -1999,6 +2000,7 @@ bool sys_var_collation::check(THD *thd, set_var *var)
|
||||
bool sys_var_character_set::check(THD *thd, set_var *var)
|
||||
{
|
||||
CHARSET_INFO *tmp;
|
||||
LINT_INIT(tmp);
|
||||
|
||||
if (var->value->result_type() == STRING_RESULT)
|
||||
{
|
||||
|
@ -3613,7 +3613,7 @@ Slave SQL thread aborted. Can't execute init_slave query");
|
||||
thd->net.last_error ?
|
||||
thd->net.last_error : "<no message>");
|
||||
}
|
||||
else if (rli->last_slave_errno != thd->net.last_errno)
|
||||
else if (rli->last_slave_errno != (int) thd->net.last_errno)
|
||||
{
|
||||
sql_print_error("Slave (additional info): %s Error_code: %d",
|
||||
thd->net.last_error ?
|
||||
@ -4095,6 +4095,7 @@ int queue_event(MASTER_INFO* mi,const char* buf, ulong event_len)
|
||||
buf[EVENT_TYPE_OFFSET] != FORMAT_DESCRIPTION_EVENT /* a way to escape */)
|
||||
DBUG_RETURN(queue_old_event(mi,buf,event_len));
|
||||
|
||||
LINT_INIT(inc_pos);
|
||||
pthread_mutex_lock(&mi->data_lock);
|
||||
|
||||
switch (buf[EVENT_TYPE_OFFSET]) {
|
||||
|
@ -1224,10 +1224,10 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount,
|
||||
sp_rcontext *octx = thd->spcont;
|
||||
sp_rcontext *nctx = NULL;
|
||||
bool err_status= FALSE;
|
||||
|
||||
DBUG_ENTER("sp_head::execute_function");
|
||||
DBUG_PRINT("info", ("function %s", m_name.str));
|
||||
|
||||
LINT_INIT(binlog_save_options);
|
||||
params = m_pcont->context_pvars();
|
||||
|
||||
/*
|
||||
|
@ -5037,6 +5037,8 @@ static int handle_grant_struct(uint struct_no, bool drop,
|
||||
LINT_INIT(acl_user);
|
||||
LINT_INIT(acl_db);
|
||||
LINT_INIT(grant_name);
|
||||
LINT_INIT(user);
|
||||
LINT_INIT(host);
|
||||
|
||||
/* Get the number of elements in the in-memory structure. */
|
||||
switch (struct_no) {
|
||||
@ -5109,8 +5111,7 @@ static int handle_grant_struct(uint struct_no, bool drop,
|
||||
result= 1; /* At least one element found. */
|
||||
if ( drop )
|
||||
{
|
||||
switch ( struct_no )
|
||||
{
|
||||
switch ( struct_no ) {
|
||||
case 0:
|
||||
delete_dynamic_element(&acl_users, idx);
|
||||
break;
|
||||
|
@ -176,8 +176,7 @@ err:
|
||||
|
||||
bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
|
||||
{
|
||||
const char *begin, *end = str + str_len;
|
||||
|
||||
const char *begin, *end= str + str_len;
|
||||
DBUG_ENTER("test_if_number");
|
||||
|
||||
/*
|
||||
@ -186,13 +185,13 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
|
||||
*/
|
||||
for (; str != end && my_isspace(system_charset_info, *str); str++) ;
|
||||
if (str == end)
|
||||
return 0;
|
||||
DBUG_RETURN(0);
|
||||
|
||||
if (*str == '-')
|
||||
{
|
||||
info->negative = 1;
|
||||
if (++str == end || *str == '0') // converting -0 to a number
|
||||
return 0; // might lose information
|
||||
if (++str == end || *str == '0') // converting -0 to a number
|
||||
DBUG_RETURN(0); // might lose information
|
||||
}
|
||||
else
|
||||
info->negative = 0;
|
||||
@ -210,33 +209,33 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
|
||||
int error;
|
||||
info->ullval= (ulonglong) my_strtoll10(begin, &endpos, &error);
|
||||
if (info->integers == 1)
|
||||
return 0; // a single number can't be zerofill
|
||||
DBUG_RETURN(0); // single number can't be zerofill
|
||||
info->maybe_zerofill = 1;
|
||||
return 1; // a zerofill number, or an integer
|
||||
DBUG_RETURN(1); // a zerofill number, or an integer
|
||||
}
|
||||
if (*str == '.' || *str == 'e' || *str == 'E')
|
||||
{
|
||||
if (info->zerofill) // can't be zerofill anymore
|
||||
return 0;
|
||||
if ((str + 1) == end) // number was something like '123[.eE]'
|
||||
if (info->zerofill) // can't be zerofill anymore
|
||||
DBUG_RETURN(0);
|
||||
if ((str + 1) == end) // number was something like '123[.eE]'
|
||||
{
|
||||
char *endpos= (char*) str;
|
||||
int error;
|
||||
info->ullval= (ulonglong) my_strtoll10(begin, &endpos, &error);
|
||||
return 1;
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (*str == 'e' || *str == 'E') // number may be something like '1e+50'
|
||||
if (*str == 'e' || *str == 'E') // number may be something like '1e+50'
|
||||
{
|
||||
str++;
|
||||
if (*str != '-' && *str != '+')
|
||||
return 0;
|
||||
DBUG_RETURN(0);
|
||||
for (str++; str != end && my_isdigit(system_charset_info,*str); str++) ;
|
||||
if (str == end)
|
||||
{
|
||||
info->is_float = 1; // we can't use variable decimals here
|
||||
info->is_float = 1; // we can't use variable decimals here
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
for (str++; *(end - 1) == '0'; end--); // jump over zeros at the end
|
||||
if (str == end) // number was something like '123.000'
|
||||
@ -244,17 +243,17 @@ bool test_if_number(NUM_INFO *info, const char *str, uint str_len)
|
||||
char *endpos= (char*) str;
|
||||
int error;
|
||||
info->ullval= (ulonglong) my_strtoll10(begin, &endpos, &error);
|
||||
return 1;
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
for (; str != end && my_isdigit(system_charset_info,*str); str++)
|
||||
info->decimals++;
|
||||
if (str == end)
|
||||
{
|
||||
info->dval = my_atof(begin);
|
||||
return 1;
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1877,7 +1877,7 @@ TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
|
||||
if (!thd->open_tables)
|
||||
thd->version=refresh_version;
|
||||
else if ((thd->version != refresh_version) &&
|
||||
! (flags & MYSQL_LOCK_IGNORE_FLUSH) && !table->s->log_table)
|
||||
! (flags & MYSQL_LOCK_IGNORE_FLUSH))
|
||||
{
|
||||
/* Someone did a refresh while thread was opening tables */
|
||||
if (refresh)
|
||||
@ -2349,13 +2349,36 @@ bool wait_for_tables(THD *thd)
|
||||
}
|
||||
|
||||
|
||||
/* drop tables from locked list */
|
||||
/*
|
||||
drop tables from locked list
|
||||
|
||||
bool drop_locked_tables(THD *thd,const char *db, const char *table_name)
|
||||
SYNOPSIS
|
||||
drop_locked_tables()
|
||||
thd Thread thandler
|
||||
db Database
|
||||
table_name Table name
|
||||
|
||||
INFORMATION
|
||||
This is only called on drop tables
|
||||
|
||||
The TABLE object for the dropped table is unlocked but still kept around
|
||||
as a name lock, which means that the table will be available for other
|
||||
thread as soon as we call unlock_table_names().
|
||||
If there is multiple copies of the table locked, all copies except
|
||||
the first, which acts as a name lock, is removed.
|
||||
|
||||
RETURN
|
||||
# If table existed, return table
|
||||
0 Table was not locked
|
||||
*/
|
||||
|
||||
|
||||
TABLE *drop_locked_tables(THD *thd,const char *db, const char *table_name)
|
||||
{
|
||||
TABLE *table,*next,**prev;
|
||||
bool found=0;
|
||||
TABLE *table,*next,**prev, *found= 0;
|
||||
prev= &thd->open_tables;
|
||||
DBUG_ENTER("drop_locked_tables");
|
||||
|
||||
for (table= thd->open_tables; table ; table=next)
|
||||
{
|
||||
next=table->next;
|
||||
@ -2363,8 +2386,21 @@ bool drop_locked_tables(THD *thd,const char *db, const char *table_name)
|
||||
!strcmp(table->s->db.str, db))
|
||||
{
|
||||
mysql_lock_remove(thd, thd->locked_tables,table);
|
||||
VOID(hash_delete(&open_cache,(byte*) table));
|
||||
found=1;
|
||||
if (!found)
|
||||
{
|
||||
found= table;
|
||||
/* Close engine table, but keep object around as a name lock */
|
||||
if (table->db_stat)
|
||||
{
|
||||
table->db_stat= 0;
|
||||
table->file->close();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We already have a name lock, remove copy */
|
||||
VOID(hash_delete(&open_cache,(byte*) table));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2373,14 +2409,12 @@ bool drop_locked_tables(THD *thd,const char *db, const char *table_name)
|
||||
}
|
||||
}
|
||||
*prev=0;
|
||||
if (found)
|
||||
VOID(pthread_cond_broadcast(&COND_refresh)); // Signal to refresh
|
||||
if (thd->locked_tables && thd->locked_tables->table_count == 0)
|
||||
{
|
||||
my_free((gptr) thd->locked_tables,MYF(0));
|
||||
thd->locked_tables=0;
|
||||
}
|
||||
return found;
|
||||
DBUG_RETURN(found);
|
||||
}
|
||||
|
||||
|
||||
@ -3489,6 +3523,7 @@ find_field_in_view(THD *thd, TABLE_LIST *table_list,
|
||||
Field_iterator_view field_it;
|
||||
field_it.set(table_list);
|
||||
Query_arena *arena, backup;
|
||||
LINT_INIT(arena);
|
||||
|
||||
DBUG_ASSERT(table_list->schema_table_reformed ||
|
||||
(ref != 0 && table_list->view != 0));
|
||||
@ -3578,6 +3613,7 @@ find_field_in_natural_join(THD *thd, TABLE_LIST *table_ref, const char *name,
|
||||
DBUG_ASSERT(table_ref->is_natural_join && table_ref->join_columns);
|
||||
DBUG_ASSERT(*actual_table == NULL);
|
||||
|
||||
LINT_INIT(arena);
|
||||
LINT_INIT(found_field);
|
||||
|
||||
for (;;)
|
||||
|
@ -37,7 +37,7 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
||||
READ_RECORD info;
|
||||
bool using_limit=limit != HA_POS_ERROR;
|
||||
bool transactional_table, safe_update, const_cond;
|
||||
ha_rows deleted;
|
||||
ha_rows deleted= 0;
|
||||
uint usable_index= MAX_KEY;
|
||||
SELECT_LEX *select_lex= &thd->lex->select_lex;
|
||||
bool ha_delete_all_rows= 0;
|
||||
@ -212,7 +212,6 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
|
||||
else
|
||||
init_read_record_idx(&info, thd, table, 1, usable_index);
|
||||
|
||||
deleted=0L;
|
||||
init_ftfuncs(thd, select_lex, 1);
|
||||
thd->proc_info="updating";
|
||||
will_batch= !table->file->start_bulk_delete();
|
||||
|
@ -2112,8 +2112,8 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
|
||||
void log_slow_statement(THD *thd)
|
||||
{
|
||||
DBUG_ENTER("log_slow_statement");
|
||||
time_t start_of_query;
|
||||
DBUG_ENTER("log_slow_statement");
|
||||
|
||||
/*
|
||||
The following should never be true with our current code base,
|
||||
@ -2121,7 +2121,7 @@ void log_slow_statement(THD *thd)
|
||||
statement in a trigger or stored function
|
||||
*/
|
||||
if (unlikely(thd->in_sub_stmt))
|
||||
return; // Don't set time for sub stmt
|
||||
DBUG_VOID_RETURN; // Don't set time for sub stmt
|
||||
|
||||
start_of_query= thd->start_time;
|
||||
thd->end_time(); // Set start time
|
||||
@ -5864,18 +5864,15 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
|
||||
{
|
||||
if (thd->net.report_error)
|
||||
{
|
||||
if (thd->lex->sphead)
|
||||
{
|
||||
delete thd->lex->sphead;
|
||||
thd->lex->sphead= NULL;
|
||||
}
|
||||
if (thd->lex->et)
|
||||
delete lex->sphead;
|
||||
lex->sphead= NULL;
|
||||
if (lex->et)
|
||||
{
|
||||
thd->lex->et->free_sphead_on_delete= true;
|
||||
lex->et->free_sphead_on_delete= true;
|
||||
/* alloced on thd->mem_root so no real memory free but dtor call */
|
||||
thd->lex->et->free_sp();
|
||||
thd->lex->et->deinit_mutexes();
|
||||
thd->lex->et= NULL;
|
||||
lex->et->free_sp();
|
||||
lex->et->deinit_mutexes();
|
||||
lex->et= NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -5906,18 +5903,18 @@ void mysql_parse(THD *thd, char *inBuf, uint length)
|
||||
thd->is_fatal_error));
|
||||
query_cache_abort(&thd->net);
|
||||
lex->unit.cleanup();
|
||||
if (thd->lex->sphead)
|
||||
if (lex->sphead)
|
||||
{
|
||||
/* Clean up after failed stored procedure/function */
|
||||
delete thd->lex->sphead;
|
||||
thd->lex->sphead= NULL;
|
||||
delete lex->sphead;
|
||||
lex->sphead= NULL;
|
||||
}
|
||||
if (thd->lex->et)
|
||||
if (lex->et)
|
||||
{
|
||||
thd->lex->et->free_sphead_on_delete= true;
|
||||
lex->et->free_sphead_on_delete= true;
|
||||
lex->et->free_sp();
|
||||
lex->et->deinit_mutexes();
|
||||
thd->lex->et= NULL;
|
||||
lex->et= NULL;
|
||||
}
|
||||
}
|
||||
thd->proc_info="freeing items";
|
||||
|
@ -4924,7 +4924,7 @@ the generated partition syntax in a correct manner.
|
||||
*/
|
||||
if (table->part_info)
|
||||
{
|
||||
if (thd->lex->alter_info.flags & ALTER_REMOVE_PARTITIONING)
|
||||
if (alter_info->flags & ALTER_REMOVE_PARTITIONING)
|
||||
{
|
||||
DBUG_PRINT("info", ("Remove partitioning"));
|
||||
if (!(thd->lex->create_info.used_fields & HA_CREATE_USED_ENGINE))
|
||||
|
@ -192,7 +192,8 @@ static st_plugin_dl *plugin_dl_add(LEX_STRING *dl, int report)
|
||||
|
||||
if (plugin_dl.version != MYSQL_PLUGIN_INTERFACE_VERSION)
|
||||
{
|
||||
int i, sizeof_st_plugin;
|
||||
int i;
|
||||
uint sizeof_st_plugin;
|
||||
struct st_mysql_plugin *old, *cur;
|
||||
char *ptr= (char *)sym;
|
||||
|
||||
|
@ -1770,18 +1770,19 @@ void free_status_vars()
|
||||
there's lots of room for optimizing this, especially in non-sorted mode,
|
||||
but nobody cares - it may be called only in case of failed plugin
|
||||
initialization in the mysqld startup.
|
||||
|
||||
*/
|
||||
|
||||
void remove_status_vars(SHOW_VAR *list)
|
||||
{
|
||||
if (status_vars_inited)
|
||||
{
|
||||
pthread_mutex_lock(&LOCK_status);
|
||||
SHOW_VAR *all= dynamic_element(&all_status_vars, 0, SHOW_VAR *);
|
||||
int a= 0, b= all_status_vars.elements, c= (a+b)/2, res;
|
||||
int a= 0, b= all_status_vars.elements, c= (a+b)/2;
|
||||
|
||||
for (; list->name; list++)
|
||||
{
|
||||
int res= 0;
|
||||
for (a= 0, b= all_status_vars.elements; b-a > 1; c= (a+b)/2)
|
||||
{
|
||||
res= show_var_cmp(list, all+c);
|
||||
@ -1789,7 +1790,8 @@ void remove_status_vars(SHOW_VAR *list)
|
||||
b= c;
|
||||
else if (res > 0)
|
||||
a= c;
|
||||
else break;
|
||||
else
|
||||
break;
|
||||
}
|
||||
if (res == 0)
|
||||
all[c].type= SHOW_UNDEF;
|
||||
@ -1800,7 +1802,7 @@ void remove_status_vars(SHOW_VAR *list)
|
||||
else
|
||||
{
|
||||
SHOW_VAR *all= dynamic_element(&all_status_vars, 0, SHOW_VAR *);
|
||||
int i;
|
||||
uint i;
|
||||
for (; list->name; list++)
|
||||
{
|
||||
for (i= 0; i < all_status_vars.elements; i++)
|
||||
|
@ -565,6 +565,10 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
|
||||
String built_query;
|
||||
DBUG_ENTER("mysql_rm_table_part2");
|
||||
|
||||
LINT_INIT(alias);
|
||||
LINT_INIT(path_length);
|
||||
safe_mutex_assert_owner(&LOCK_open);
|
||||
|
||||
if (thd->current_stmt_binlog_row_based && !dont_log_query)
|
||||
{
|
||||
built_query.set_charset(system_charset_info);
|
||||
@ -614,7 +618,7 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
|
||||
*/
|
||||
if (thd->current_stmt_binlog_row_based && !dont_log_query)
|
||||
{
|
||||
++non_temp_tables_count;
|
||||
non_temp_tables_count++;
|
||||
/*
|
||||
Don't write the database name if it is the current one (or if
|
||||
thd->db is NULL).
|
||||
@ -634,11 +638,18 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
|
||||
table_type= table->db_type;
|
||||
if (!drop_temporary)
|
||||
{
|
||||
TABLE *locked_table;
|
||||
abort_locked_tables(thd, db, table->table_name);
|
||||
remove_table_from_cache(thd, db, table->table_name,
|
||||
RTFC_WAIT_OTHER_THREAD_FLAG |
|
||||
RTFC_CHECK_KILLED_FLAG);
|
||||
drop_locked_tables(thd, db, table->table_name);
|
||||
/*
|
||||
If the table was used in lock tables, remember it so that
|
||||
unlock_table_names can free it
|
||||
*/
|
||||
if ((locked_table= drop_locked_tables(thd, db, table->table_name)))
|
||||
table->table= locked_table;
|
||||
|
||||
if (thd->killed)
|
||||
{
|
||||
thd->no_warnings_for_error= 0;
|
||||
@ -649,8 +660,8 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
|
||||
path_length= build_table_filename(path, sizeof(path),
|
||||
db, alias, reg_ext);
|
||||
}
|
||||
if (table_type == NULL &&
|
||||
(drop_temporary ||
|
||||
if (drop_temporary ||
|
||||
(table_type == NULL &&
|
||||
(access(path, F_OK) &&
|
||||
ha_create_table_from_engine(thd, db, alias)) ||
|
||||
(!drop_view &&
|
||||
@ -3962,6 +3973,11 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
||||
bool committed= 0;
|
||||
DBUG_ENTER("mysql_alter_table");
|
||||
|
||||
LINT_INIT(index_add_count);
|
||||
LINT_INIT(index_drop_count);
|
||||
LINT_INIT(index_add_buffer);
|
||||
LINT_INIT(index_drop_buffer);
|
||||
|
||||
thd->proc_info="init";
|
||||
table_name=table_list->table_name;
|
||||
alias= (lower_case_table_names == 2) ? table_list->alias : table_name;
|
||||
|
@ -4726,13 +4726,14 @@ alter:
|
||||
lex->col_list.empty();
|
||||
lex->select_lex.init_order();
|
||||
lex->select_lex.db=lex->name= 0;
|
||||
lex->like_name= 0;
|
||||
lex->like_name= 0;
|
||||
bzero((char*) &lex->create_info,sizeof(lex->create_info));
|
||||
lex->create_info.db_type= (handlerton*) &default_hton;
|
||||
lex->create_info.default_table_charset= NULL;
|
||||
lex->create_info.row_type= ROW_TYPE_NOT_USED;
|
||||
lex->alter_info.reset();
|
||||
lex->alter_info.flags= 0;
|
||||
lex->no_write_to_binlog= 0;
|
||||
}
|
||||
alter_commands
|
||||
{}
|
||||
|
18
sql/table.cc
18
sql/table.cc
@ -1556,7 +1556,15 @@ int open_table_from_share(THD *thd, TABLE_SHARE *share, const char *alias,
|
||||
DBUG_RETURN (error);
|
||||
}
|
||||
|
||||
/* close a .frm file and it's tables */
|
||||
|
||||
/*
|
||||
Free information allocated by openfrm
|
||||
|
||||
SYNOPSIS
|
||||
closefrm()
|
||||
table TABLE object to free
|
||||
free_share Is 1 if we also want to free table_share
|
||||
*/
|
||||
|
||||
int closefrm(register TABLE *table, bool free_share)
|
||||
{
|
||||
@ -1564,6 +1572,7 @@ int closefrm(register TABLE *table, bool free_share)
|
||||
uint idx;
|
||||
KEY *key_info;
|
||||
DBUG_ENTER("closefrm");
|
||||
|
||||
if (table->db_stat)
|
||||
error=table->file->close();
|
||||
key_info= table->key_info;
|
||||
@ -2395,12 +2404,14 @@ table_check_intact(TABLE *table, uint table_f_count,
|
||||
table running on a old server will be valid.
|
||||
*/
|
||||
field->sql_type(sql_type);
|
||||
if (strncmp(sql_type.c_ptr(), table_def->type.str,
|
||||
if (sql_type.length() < table_def->type.length - 1 ||
|
||||
strncmp(sql_type.ptr(),
|
||||
table_def->type.str,
|
||||
table_def->type.length - 1))
|
||||
{
|
||||
sql_print_error("(%s) Expected field %s at position %d to have type "
|
||||
"%s, found %s", table->alias, table_def->name.str,
|
||||
i, table_def->type.str, sql_type.c_ptr());
|
||||
i, table_def->type.str, sql_type.c_ptr_safe());
|
||||
error= TRUE;
|
||||
}
|
||||
else if (table_def->cset.str && !field->has_charset())
|
||||
@ -3621,6 +3632,7 @@ Field_iterator_table_ref::get_or_create_column_ref(TABLE_LIST *parent_table_ref)
|
||||
TABLE_LIST *add_table_ref= parent_table_ref ?
|
||||
parent_table_ref : table_ref;
|
||||
|
||||
LINT_INIT(field_count);
|
||||
if (field_it == &table_field_it)
|
||||
{
|
||||
/* The field belongs to a stored table. */
|
||||
|
@ -2189,12 +2189,11 @@ my_tz_find(const String * name, TABLE_LIST *tz_tables)
|
||||
TZ_NAMES_ENTRY *tmp_tzname;
|
||||
Time_zone *result_tz= 0;
|
||||
long offset;
|
||||
|
||||
DBUG_ENTER("my_tz_find");
|
||||
DBUG_PRINT("enter", ("time zone name='%s'",
|
||||
name ? ((String *)name)->c_ptr() : "NULL"));
|
||||
|
||||
DBUG_ASSERT(!time_zone_tables_exist || tz_tables || current_thd->slave_thread);
|
||||
name ? ((String *)name)->c_ptr_safe() : "NULL"));
|
||||
DBUG_ASSERT(!time_zone_tables_exist || tz_tables ||
|
||||
current_thd->slave_thread);
|
||||
|
||||
if (!name)
|
||||
DBUG_RETURN(0);
|
||||
|
@ -108,6 +108,7 @@ private:
|
||||
Uint16 m_entries;
|
||||
Uint8 m_idir;
|
||||
Uint8 pad1;
|
||||
Area() {}
|
||||
Pointer& get_pointer(unsigned i) const {
|
||||
return *(Pointer*)&m_data[i];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user