Below is the list of changes that have just been committed into a local
5.1 repository of lthalmann. When lthalmann does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.1963 05/12/14 20:21:55 lars@stripped +15 -0
Merge mysql.com:/users/lthalmann/bkroot/mysql-5.1-wl1012-v3
into mysql.com:/users/lthalmann/bk/mysql-5.1-wl1012-v3-wl2321-max
client/client_priv.h
1.46 05/12/14 20:21:47 lars@stripped +1 -2
Merge
sql/sql_yacc.yy
1.431 05/12/14 19:58:11 lars@stripped +0 -0
Auto merged
sql/sql_parse.cc
1.488 05/12/14 19:58:09 lars@stripped +0 -0
Auto merged
sql/sql_list.h
1.40 05/12/14 19:58:08 lars@stripped +0 -0
Auto merged
sql/sql_lex.h
1.211 05/12/14 19:58:08 lars@stripped +0 -0
Auto merged
sql/sql_class.h
1.277 05/12/14 19:58:07 lars@stripped +0 -0
Auto merged
sql/sql_class.cc
1.230 05/12/14 19:58:06 lars@stripped +0 -0
Auto merged
sql/slave.cc
1.264 05/12/14 19:58:06 lars@stripped +0 -0
Auto merged
sql/mysql_priv.h
1.347 05/12/14 19:58:04 lars@stripped +0 -0
Auto merged
sql/log_event.h
1.146 05/12/14 19:58:04 lars@stripped +0 -0
Auto merged
sql/log_event.cc
1.201 05/12/14 19:58:03 lars@stripped +0 -0
Auto merged
sql/Makefile.am
1.125 05/12/14 19:58:01 lars@stripped +0 -0
Auto merged
libmysqld/Makefile.am
1.74 05/12/14 19:58:01 lars@stripped +0 -0
Auto merged
client/mysqlbinlog.cc
1.124 05/12/14 19:58:01 lars@stripped +0 -0
Auto merged
client/Makefile.am
1.53 05/12/14 19:58:00 lars@stripped +0 -0
Auto merged
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: lars
# Host: dl145h.mysql.com
# Root: /users/lthalmann/bk/mysql-5.1-wl1012-v3-wl2321-max/RESYNC
--- 1.52/client/Makefile.am 2005-12-07 17:26:32 +01:00
+++ 1.53/client/Makefile.am 2005-12-14 19:58:00 +01:00
@@ -31,7 +31,8 @@
$(top_builddir)/libmysql/libmysqlclient.la
bin_PROGRAMS = mysql mysqladmin mysqlcheck mysqlshow \
mysqldump mysqlimport mysqltest mysqlbinlog \
- mysqltestmanagerc mysqltestmanager-pwgen
+ mysqltestmanagerc mysqltestmanager-pwgen \
+ mysqlslap
noinst_HEADERS = sql_string.h completion_hash.h my_readline.h \
client_priv.h
mysql_SOURCES = mysql.cc readline.cc sql_string.cc completion_hash.cc
@@ -51,6 +52,7 @@
mysqltestmanagerc_SOURCES= mysqlmanagerc.c $(yassl_dummy_link_fix)
mysqlcheck_SOURCES= mysqlcheck.c $(yassl_dummy_link_fix)
mysqlshow_SOURCES= mysqlshow.c $(yassl_dummy_link_fix)
+mysqlslap_SOURCES= mysqlslap.c $(yassl_dummy_link_fix)
mysqldump_SOURCES= mysqldump.c $(yassl_dummy_link_fix)
mysqlimport_SOURCES= mysqlimport.c $(yassl_dummy_link_fix)
sql_src=log_event.h mysql_priv.h log_event.cc my_decimal.h my_decimal.cc
@@ -61,12 +63,12 @@
link_sources:
for f in $(sql_src) ; do \
- rm -f $(srcdir)/$$f; \
- @LN_CP_F@ $(top_srcdir)/sql/$$f $(srcdir)/$$f; \
+ rm -f $$f; \
+ @LN_CP_F@ $(top_srcdir)/sql/$$f $$f; \
done; \
for f in $(strings_src) ; do \
rm -f $(srcdir)/$$f; \
- @LN_CP_F@ $(top_srcdir)/strings/$$f $(srcdir)/$$f; \
+ @LN_CP_F@ $(top_srcdir)/strings/$$f $$f; \
done;
# Don't update the files from bitkeeper
--- 1.124/sql/Makefile.am 2005-12-13 16:10:48 +01:00
+++ 1.125/sql/Makefile.am 2005-12-14 19:58:01 +01:00
@@ -95,7 +95,7 @@
tztime.cc my_time.c my_decimal.cc\
sp_head.cc sp_pcontext.cc sp_rcontext.cc sp.cc \
sp_cache.cc parse_file.cc sql_trigger.cc \
- sql_plugin.cc\
+ sql_plugin.cc sql_binlog.cc \
handlerton.cc
EXTRA_mysqld_SOURCES = ha_innodb.cc ha_berkeley.cc ha_archive.cc \
ha_innodb.h ha_berkeley.h ha_archive.h \
--- 1.200/sql/log_event.cc 2005-12-14 01:52:52 +01:00
+++ 1.201/sql/log_event.cc 2005-12-14 19:58:03 +01:00
@@ -164,7 +164,7 @@
we cannot meet Start_log event in the middle of events from one
LOAD DATA.
*/
- p= strmake(prefbuf,"SQL_LOAD-",9);
+ p= strmake(prefbuf, STRING_WITH_LEN("SQL_LOAD-"));
p= int10_to_str(::server_id, p, 10);
*(p++)= '-';
*p= 0;
@@ -928,14 +928,16 @@
/* Pretty-print event common header if header is exactly 19 bytes */
if (print_event_info->common_header_len == LOG_EVENT_MINIMAL_HEADER_LEN)
{
+ DBUG_ASSERT(hexdump_from == (unsigned long) hexdump_from);
fprintf(file, "# Position Timestamp Type Master ID "
"Size Master Pos Flags \n");
fprintf(file, "# %8.8lx %02x %02x %02x %02x %02x "
"%02x %02x %02x %02x %02x %02x %02x %02x "
"%02x %02x %02x %02x %02x %02x\n",
- hexdump_from, ptr[0], ptr[1], ptr[2], ptr[3], ptr[4],
- ptr[5], ptr[6], ptr[7], ptr[8], ptr[9], ptr[10], ptr[11],
- ptr[12], ptr[13], ptr[14], ptr[15], ptr[16], ptr[17], ptr[18]);
+ (unsigned long) hexdump_from,
+ ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5], ptr[6],
+ ptr[7], ptr[8], ptr[9], ptr[10], ptr[11], ptr[12], ptr[13],
+ ptr[14], ptr[15], ptr[16], ptr[17], ptr[18]);
ptr += LOG_EVENT_MINIMAL_HEADER_LEN;
hexdump_from += LOG_EVENT_MINIMAL_HEADER_LEN;
}
@@ -952,8 +954,10 @@
if (i % 16 == 15)
{
+ DBUG_ASSERT(hexdump_from == (unsigned long) hexdump_from);
fprintf(file, "# %8.8lx %-48.48s |%16s|\n",
- hexdump_from + (i & 0xfffffff0), hex_string, char_string);
+ (unsigned long) (hexdump_from + (i & 0xfffffff0)),
+ hex_string, char_string);
hex_string[0]= 0;
char_string[0]= 0;
c= char_string;
@@ -965,8 +969,10 @@
/* Non-full last line */
if (hex_string[0]) {
- printf("# %8.8lx %-48.48s |%s|\n# ",
- hexdump_from + (i & 0xfffffff0), hex_string, char_string);
+ DBUG_ASSERT(hexdump_from == (unsigned long) hexdump_from);
+ fprintf(file, "# %8.8lx %-48.48s |%s|\n# ",
+ (unsigned long) (hexdump_from + (i & 0xfffffff0)),
+ hex_string, char_string);
}
}
}
@@ -3043,7 +3049,7 @@
String tmp(buf1, sizeof(buf1), log_cs);
tmp.length(0);
tmp.append(new_log_ident, ident_len);
- tmp.append(";pos=");
+ tmp.append(STRING_WITH_LEN(";pos="));
tmp.append(llstr(pos,buf));
protocol->store(tmp.ptr(), tmp.length(), &my_charset_bin);
}
@@ -3397,12 +3403,17 @@
Xid_log_event methods
**************************************************************************/
+#ifndef DBUG_OFF
+my_bool binlog_no_xid;
+#endif
+
#if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
void Xid_log_event::pack_info(Protocol *protocol)
{
char buf[128], *pos;
pos= strmov(buf, "COMMIT /* xid=");
- pos= longlong10_to_str(xid, pos, 10);
+ if (!binlog_no_xid)
+ pos= longlong10_to_str(xid, pos, 10);
pos= strmov(pos, " */");
protocol->store(buf, (uint) (pos-buf), &my_charset_bin);
}
@@ -4214,7 +4225,7 @@
bzero((char*)&file, sizeof(file));
p = slave_load_file_stem(fname_buf, file_id, server_id);
strmov(p, ".info"); // strmov takes less code than memcpy
- strnmov(proc_info, "Making temp file ", 17); // no end 0
+ strnmov(proc_info, STRING_WITH_LEN("Making temp file ")); // no end 0
thd->proc_info= proc_info;
my_delete(fname_buf, MYF(0)); // old copy may exist already
if ((fd= my_create(fname_buf, CREATE_MODE,
@@ -4386,7 +4397,7 @@
DBUG_ENTER("Append_block_log_event::exec_event");
memcpy(p, ".data", 6);
- strnmov(proc_info, "Making temp file ", 17); // no end 0
+ strnmov(proc_info, STRING_WITH_LEN("Making temp file ")); // no end 0
thd->proc_info= proc_info;
if (get_create_or_append())
{
@@ -4872,23 +4883,23 @@
p= buf;
memcpy(p, query, fn_pos_start);
p+= fn_pos_start;
- fname= (p= strmake(p, " INFILE \'", 9));
+ fname= (p= strmake(p, STRING_WITH_LEN(" INFILE \'")));
p= slave_load_file_stem(p, file_id, server_id);
- fname_end= (p= strmake(p, ".data", 5));
+ fname_end= (p= strmake(p, STRING_WITH_LEN(".data")));
*(p++)='\'';
switch (dup_handling)
{
case LOAD_DUP_IGNORE:
- p= strmake(p, " IGNORE", 7);
+ p= strmake(p, STRING_WITH_LEN(" IGNORE"));
break;
case LOAD_DUP_REPLACE:
- p= strmake(p, " REPLACE", 8);
+ p= strmake(p, STRING_WITH_LEN(" REPLACE"));
break;
default:
/* Ordinary load data */
break;
}
- p= strmake(p, " INTO", 5);
+ p= strmake(p, STRING_WITH_LEN(" INTO"));
p= strmake(p, query+fn_pos_end, q_len-fn_pos_end);
error= Query_log_event::exec_event(rli, buf, p-buf);
@@ -4999,14 +5010,22 @@
Rows_log_event member functions
**************************************************************************/
+/*
+ In TABLE_SHARE, "db" and "table_name" are 0-terminated (see this comment in
+ table.cc / alloc_table_share():
+ Use the fact the key is db/0/table_name/0
+ We rely on this to be sure the m_dbnam and m_tblnam members of
+ Rows_log_event and Table_map_log_event are 0-terminated.
+*/
+
#ifndef MYSQL_CLIENT
Rows_log_event::Rows_log_event(THD *thd_arg, TABLE *tbl_arg, ulong tid,
MY_BITMAP const *cols, bool is_transactional)
: Log_event(thd_arg, 0, is_transactional),
- m_dbnam(tbl_arg->s->db), m_dblen(m_dbnam ? strlen(m_dbnam) : 0),
+ m_dbnam(tbl_arg->s->db.str), m_dblen(m_dbnam ? tbl_arg->s->db.length : 0),
m_table(tbl_arg),
- m_tblnam(tbl_arg->s->table_name),
- m_tbllen(strlen(tbl_arg->s->table_name)),
+ m_tblnam(tbl_arg->s->table_name.str),
+ m_tbllen(tbl_arg->s->table_name.length), //m_tbl should be LEX_STRING*
m_table_id(tid),
m_width(tbl_arg->s->fields),
m_rows_buf(my_malloc(opt_binlog_rows_event_max_size * sizeof(*m_rows_buf), MYF(MY_WME))),
@@ -5217,8 +5236,9 @@
for ( ; ; )
{
- table_list.db= const_cast<char*>(table->s->db);
- table_list.alias= table_list.table_name= const_cast<char*>(table->s->table_name);
+ table_list.db= const_cast<char*>(table->s->db.str);
+ table_list.alias= table_list.table_name=
+ const_cast<char*>(table->s->table_name.str);
if ((error= lock_tables(thd, &table_list, count, &need_reopen)) == 0)
break;
@@ -5233,8 +5253,8 @@
we need to store a local copy of the table names since the table object
will become invalid after close_tables_for_reopen
*/
- char *db= my_strdup(table->s->db,MYF(MY_WME));
- char *table_name= my_strdup(table->s->table_name,MYF(MY_WME));
+ char *db= my_strdup(table->s->db.str, MYF(MY_WME));
+ char *table_name= my_strdup(table->s->table_name.str, MYF(MY_WME));
if (db == 0 || table_name == 0)
{
@@ -5536,10 +5556,10 @@
bool is_transactional, uint16 flags)
: Log_event(thd, 0, is_transactional),
m_table(tbl),
- m_dbnam(tbl->s->db),
- m_dblen(m_dbnam ? strlen(m_dbnam) : 0),
- m_tblnam(tbl->s->table_name),
- m_tbllen(strlen(m_tblnam)),
+ m_dbnam(tbl->s->db.str),
+ m_dblen(m_dbnam ? tbl->s->db.length : 0),
+ m_tblnam(tbl->s->table_name.str),
+ m_tbllen(tbl->s->table_name.length),
m_colcnt(tbl->s->fields), m_coltype(0),
m_table_id(tid),
m_flags(flags)
@@ -5672,8 +5692,8 @@
DBUG_ASSERT(table_list->next_global == 0);
for (TABLE *table= thd->open_tables; table ; table= table->next)
{
- if (strcmp(table->s->db, table_list->db) == 0
- && strcmp(table->s->table_name, table_list->table_name) == 0)
+ if (strcmp(table->s->db.str, table_list->db) == 0
+ && strcmp(table->s->table_name.str, table_list->table_name) == 0)
{
/* Copy the table pointer into the table list. */
table_list->table= table;
@@ -5835,20 +5855,20 @@
*/
if (col == tsh->fields)
{
- DBUG_ASSERT(tsh->db && tsh->table_name);
+ DBUG_ASSERT(tsh->db.str && tsh->table_name.str);
slave_print_msg(ERROR_LEVEL, rli, ER_BINLOG_ROW_WRONG_TABLE_DEF,
"Table width mismatch - "
"received %u columns, %s.%s has %u columns",
- m_colcnt, tsh->db, tsh->table_name, tsh->fields);
+ m_colcnt, tsh->db.str, tsh->table_name.str, tsh->fields);
}
else
{
DBUG_ASSERT(col < m_colcnt && col < tsh->fields);
- DBUG_ASSERT(tsh->db && tsh->table_name);
+ DBUG_ASSERT(tsh->db.str && tsh->table_name.str);
slave_print_msg(ERROR_LEVEL, rli, ER_BINLOG_ROW_WRONG_TABLE_DEF,
"Column %d type mismatch - "
"received type %d, %s.%s has type %d",
- col, m_coltype[col], tsh->db, tsh->table_name,
+ col, m_coltype[col], tsh->db.str, tsh->table_name.str,
m_table->field[col]->type());
}
--- 1.145/sql/log_event.h 2005-12-14 01:52:52 +01:00
+++ 1.146/sql/log_event.h 2005-12-14 19:58:04 +01:00
@@ -1204,6 +1204,10 @@
typedef ulonglong my_xid; // this line is the same as in handler.h
#endif
+#ifndef DBUG_OFF
+extern my_bool binlog_no_xid;
+#endif
+
class Xid_log_event: public Log_event
{
public:
--- 1.346/sql/mysql_priv.h 2005-12-13 16:10:48 +01:00
+++ 1.347/sql/mysql_priv.h 2005-12-14 19:58:04 +01:00
@@ -600,6 +600,7 @@
bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create);
bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent);
void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, ushort flags);
+void mysql_binlog_statement(THD *thd);
bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
my_bool drop_temporary);
int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
--- 1.123/client/mysqlbinlog.cc 2005-12-04 19:55:14 +01:00
+++ 1.124/client/mysqlbinlog.cc 2005-12-14 19:58:01 +01:00
@@ -63,6 +63,7 @@
static bool one_database=0, to_last_remote_log= 0, disable_log_bin= 0;
static bool opt_hexdump= 0;
+static bool opt_base64_output= 0;
static const char* database= 0;
static my_bool force_opt= 0, short_form= 0, remote_opt= 0;
static ulonglong offset = 0;
@@ -530,11 +531,19 @@
else
print_event_info->hexdump_from= pos;
+ print_event_info->base64_output= opt_base64_output;
+
switch (ev_type) {
case QUERY_EVENT:
if (check_database(((Query_log_event*)ev)->db))
goto end;
- ev->print(result_file, print_event_info);
+ if (opt_base64_output)
+ {
+ ev->print_header(result_file, print_event_info);
+ ev->print_base64(result_file, print_event_info);
+ }
+ else
+ ev->print(result_file, print_event_info);
break;
case CREATE_FILE_EVENT:
{
@@ -554,7 +563,13 @@
filename and use LOCAL), prepared in the 'case EXEC_LOAD_EVENT'
below.
*/
- ce->print(result_file, print_event_info, TRUE);
+ if (opt_base64_output)
+ {
+ ce->print_header(result_file, print_event_info);
+ ce->print_base64(result_file, print_event_info);
+ }
+ else
+ ce->print(result_file, print_event_info, TRUE);
// If this binlog is not 3.23 ; why this test??
if (description_event->binlog_version >= 3)
@@ -650,6 +665,12 @@
{"autoclose", OPT_AUTO_CLOSE, "Auto close the screen on exit for Netware.",
0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
#endif
+ {"base64-output", OPT_BASE64_OUTPUT,
+ "Print all binlog entries using base64 encoding. "
+ "This is for debugging only. Logs produced using this option "
+ "should not be applied on production systems.",
+ (gptr*) &opt_base64_output, (gptr*) &opt_base64_output, 0, GET_BOOL,
+ NO_ARG, 0, 0, 0, 0, 0, 0},
/*
mysqlbinlog needs charsets knowledge, to be able to convert a charset
number found in binlog to a charset name (to be able to print things
--- 1.263/sql/slave.cc 2005-12-14 01:52:53 +01:00
+++ 1.264/sql/slave.cc 2005-12-14 19:58:06 +01:00
@@ -514,7 +514,7 @@
Don't ask for disk deletion. For now, anyway they will be deleted when
slave restarts, but it is a better intention to not delete them.
*/
- close_temporary(table, 0);
+ close_temporary(table, 1, 0);
}
save_temporary_tables= 0;
slave_open_temp_tables= 0;
@@ -1116,7 +1116,7 @@
MYSQL_RES *master_res= 0;
MYSQL_ROW master_row;
- if (!mysql_real_query(mysql, "SELECT UNIX_TIMESTAMP()", 23) &&
+ if (!mysql_real_query(mysql, STRING_WITH_LEN("SELECT UNIX_TIMESTAMP()")) &&
(master_res= mysql_store_result(mysql)) &&
(master_row= mysql_fetch_row(master_res)))
{
@@ -1142,7 +1142,8 @@
Note: we could have put a @@SERVER_ID in the previous SELECT
UNIX_TIMESTAMP() instead, but this would not have worked on 3.23 masters.
*/
- if (!mysql_real_query(mysql, "SHOW VARIABLES LIKE 'SERVER_ID'", 31) &&
+ if (!mysql_real_query(mysql,
+ STRING_WITH_LEN("SHOW VARIABLES LIKE 'SERVER_ID'")) &&
(master_res= mysql_store_result(mysql)))
{
if ((master_row= mysql_fetch_row(master_res)) &&
@@ -1177,7 +1178,8 @@
goto err;
if ((*mysql->server_version == '4') &&
- !mysql_real_query(mysql, "SELECT @@GLOBAL.COLLATION_SERVER", 32) &&
+ !mysql_real_query(mysql,
+ STRING_WITH_LEN("SELECT @@GLOBAL.COLLATION_SERVER")) &&
(master_res= mysql_store_result(mysql)))
{
if ((master_row= mysql_fetch_row(master_res)) &&
@@ -1204,7 +1206,7 @@
those were alpha).
*/
if ((*mysql->server_version == '4') &&
- !mysql_real_query(mysql, "SELECT @@GLOBAL.TIME_ZONE", 25) &&
+ !mysql_real_query(mysql, STRING_WITH_LEN("SELECT @@GLOBAL.TIME_ZONE")) &&
(master_res= mysql_store_result(mysql)))
{
if ((master_row= mysql_fetch_row(master_res)) &&
@@ -1342,7 +1344,7 @@
error=file->repair(thd,&check_opt) != 0;
thd->net.vio = save_vio;
if (error)
- my_error(ER_INDEX_REBUILD, MYF(0), tables.table->s->table_name);
+ my_error(ER_INDEX_REBUILD, MYF(0), tables.table->s->table_name.str);
err:
close_thread_tables(thd);
@@ -3112,6 +3114,7 @@
THD_CHECK_SENTRY(thd);
pthread_detach_this_thread();
+ thd->thread_stack= (char*) &thd; // remember where our stack is
if (init_slave_thread(thd, SLAVE_THD_IO))
{
pthread_cond_broadcast(&mi->start_cond);
@@ -3120,7 +3123,6 @@
goto err;
}
mi->io_thd = thd;
- thd->thread_stack = (char*)&thd; // remember where our stack is
pthread_mutex_lock(&LOCK_thread_count);
threads.append(thd);
pthread_mutex_unlock(&LOCK_thread_count);
--- 1.229/sql/sql_class.cc 2005-12-14 19:22:41 +01:00
+++ 1.230/sql/sql_class.cc 2005-12-14 19:58:06 +01:00
@@ -186,6 +186,7 @@
spcont(NULL)
{
stmt_arena= this;
+ thread_stack= 0;
db= 0;
catalog= (char*)"std"; // the only catalog we have for now
main_security_ctx.init();
@@ -527,6 +528,12 @@
bool THD::store_globals()
{
+ /*
+ Assert that thread_stack is initialized: it's necessary to be able
+ to track stack overrun.
+ */
+ DBUG_ASSERT(this->thread_stack);
+
if (my_pthread_setspecific_ptr(THR_THD, this) ||
my_pthread_setspecific_ptr(THR_MALLOC, &mem_root))
return 1;
@@ -668,7 +675,8 @@
DBUG_ASSERT((options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) &&
table->file->has_transactions());
- add_changed_table(table->s->table_cache_key, table->s->key_length);
+ add_changed_table(table->s->table_cache_key.str,
+ table->s->table_cache_key.length);
DBUG_VOID_RETURN;
}
@@ -1063,7 +1071,8 @@
if (!dirname_length(exchange->file_name))
{
- strxnmov(path, FN_REFLEN, mysql_real_data_home, thd->db ? thd->db : "", NullS);
+ strxnmov(path, FN_REFLEN-1, mysql_real_data_home, thd->db ? thd->db : "",
+ NullS);
(void) fn_format(path, exchange->file_name, path, "", option);
}
else
@@ -1505,7 +1514,13 @@
{
my_var *mv= gl++;
if (mv->local)
- (void)local_vars.push_back(new Item_splocal(mv->s, mv->offset));
+ {
+ Item_splocal *var= new Item_splocal(mv->s, mv->offset, mv->type);
+ (void)local_vars.push_back(var);
+#ifndef DBUG_OFF
+ var->m_sp= mv->sp;
+#endif
+ }
else
{
Item_func_set_user_var *var= new Item_func_set_user_var(mv->s, item);
@@ -1575,7 +1590,6 @@
:Query_arena(&main_mem_root, state_arg),
id(id_arg),
set_query_id(1),
- allow_sum_func(0),
lex(&main_lex),
query(0),
query_length(0),
@@ -1596,7 +1610,6 @@
{
id= stmt->id;
set_query_id= stmt->set_query_id;
- allow_sum_func= stmt->allow_sum_func;
lex= stmt->lex;
query= stmt->query;
query_length= stmt->query_length;
@@ -1776,8 +1789,8 @@
{
if ((yy=var_li++))
{
- if (thd->spcont->set_item_eval(current_thd,
- yy->get_offset(), it.ref(), zz->type))
+ if (thd->spcont->set_variable(current_thd, yy->get_var_idx(),
+ *it.ref()))
DBUG_RETURN(1);
}
}
@@ -1812,6 +1825,7 @@
group_parts= group_length= group_null_parts= 0;
quick_group= 1;
table_charset= 0;
+ precomputed_group_by= 0;
}
@@ -1926,6 +1940,7 @@
- Value for found_rows() is reset and restored
- examined_row_count is added to the total
- cuted_fields is added to the total
+ - new savepoint level is created and destroyed
NOTES:
Seed for random() is saved for the first! usage of RAND()
@@ -1944,11 +1959,13 @@
backup->last_insert_id= last_insert_id;
backup->next_insert_id= next_insert_id;
backup->insert_id_used= insert_id_used;
+ backup->clear_next_insert_id= clear_next_insert_id;
backup->limit_found_rows= limit_found_rows;
backup->examined_row_count= examined_row_count;
backup->sent_row_count= sent_row_count;
backup->cuted_fields= cuted_fields;
backup->client_capabilities= client_capabilities;
+ backup->savepoints= transaction.savepoints;
if ((!lex->requires_prelocking() || is_update_query(lex->sql_command)) &&
!binlog_row_based)
@@ -1962,6 +1979,7 @@
examined_row_count= 0;
sent_row_count= 0;
cuted_fields= 0;
+ transaction.savepoints= 0;
#ifndef EMBEDDED_LIBRARY
/* Surpress OK packets in case if we will execute statements */
@@ -1972,6 +1990,21 @@
void THD::restore_sub_statement_state(Sub_statement_state *backup)
{
+ /*
+ To save resources we want to release savepoints which were created
+ during execution of function or trigger before leaving their savepoint
+ level. It is enough to release first savepoint set on this level since
+ all later savepoints will be released automatically.
+ */
+ if (transaction.savepoints)
+ {
+ SAVEPOINT *sv;
+ for (sv= transaction.savepoints; sv->prev; sv= sv->prev)
+ {}
+ /* ha_release_savepoint() never returns error. */
+ (void)ha_release_savepoint(this, sv);
+ }
+ transaction.savepoints= backup->savepoints;
options= backup->options;
in_sub_stmt= backup->in_sub_stmt;
net.no_send_ok= backup->no_send_ok;
@@ -1979,6 +2012,7 @@
last_insert_id= backup->last_insert_id;
next_insert_id= backup->next_insert_id;
insert_id_used= backup->insert_id_used;
+ clear_next_insert_id= backup->clear_next_insert_id;
limit_found_rows= backup->limit_found_rows;
sent_row_count= backup->sent_row_count;
client_capabilities= backup->client_capabilities;
--- 1.276/sql/sql_class.h 2005-12-14 01:52:53 +01:00
+++ 1.277/sql/sql_class.h 2005-12-14 19:58:07 +01:00
@@ -218,6 +218,7 @@
ulong completion_type;
/* Determines which non-standard SQL behaviour should be enabled */
ulong sql_mode;
+ ulong max_sp_recursion_depth;
/* check of key presence in updatable view */
ulong updatable_views_with_limit;
ulong default_week_format;
@@ -312,6 +313,7 @@
ulong net_big_packet_count;
ulong opened_tables;
+ ulong opened_shares;
ulong select_full_join_count;
ulong select_full_range_join_count;
ulong select_range_count;
@@ -474,19 +476,6 @@
and update_row
*/
ulong set_query_id;
- /*
- This variable is used in post-parse stage to declare that sum-functions,
- or functions which have sense only if GROUP BY is present, are allowed.
- For example in queries
- SELECT MIN(i) FROM foo
- SELECT GROUP_CONCAT(a, b, MIN(i)) FROM ... GROUP BY ...
- MIN(i) have no sense.
- Though it's grammar-related issue, it's hard to catch it out during the
- parse stage because GROUP BY clause goes in the end of query. This
- variable is mainly used in setup_fields/fix_fields.
- See item_sum.cc for details.
- */
- bool allow_sum_func;
LEX_STRING name; /* name for named prepared statements */
LEX *lex; // parse tree descriptor
@@ -784,8 +773,9 @@
ha_rows cuted_fields, sent_row_count, examined_row_count;
ulong client_capabilities;
uint in_sub_stmt;
- bool enable_slow_log, insert_id_used;
+ bool enable_slow_log, insert_id_used, clear_next_insert_id;
my_bool no_send_ok;
+ SAVEPOINT *savepoints;
};
@@ -1035,14 +1025,16 @@
free_root(&mem_root,MYF(MY_KEEP_PREALLOC));
#endif
}
-#ifdef USING_TRANSACTIONS
st_transactions()
{
+#ifdef USING_TRANSACTIONS
bzero((char*)this, sizeof(*this));
xid_state.xid.null();
init_sql_alloc(&mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0);
- }
+#else
+ xid_state.xa_state= XA_NOTR;
#endif
+ }
} transaction;
Field *dupp_field;
#ifndef __WIN__
@@ -1625,11 +1617,18 @@
uint convert_blob_length;
CHARSET_INFO *table_charset;
bool schema_table;
+ /*
+ True if GROUP BY and its aggregate functions are already computed
+ by a table access method (e.g. by loose index scan). In this case
+ query execution should not perform aggregation and should treat
+ aggregate functions as normal functions.
+ */
+ bool precomputed_group_by;
TMP_TABLE_PARAM()
:copy_field(0), group_parts(0),
group_length(0), group_null_parts(0), convert_blob_length(0),
- schema_table(0)
+ schema_table(0), precomputed_group_by(0)
{}
~TMP_TABLE_PARAM()
{
@@ -1891,6 +1890,13 @@
class my_var : public Sql_alloc {
public:
LEX_STRING s;
+#ifndef DBUG_OFF
+ /*
+ Routine to which this Item_splocal belongs. Used for checking if correct
+ runtime context is used for variable handling.
+ */
+ sp_head *sp;
+#endif
bool local;
uint offset;
enum_field_types type;
--- 1.210/sql/sql_lex.h 2005-12-12 20:55:13 +01:00
+++ 1.211/sql/sql_lex.h 2005-12-14 19:58:08 +01:00
@@ -93,7 +93,7 @@
SQLCOM_XA_COMMIT, SQLCOM_XA_ROLLBACK, SQLCOM_XA_RECOVER,
SQLCOM_SHOW_PROC_CODE, SQLCOM_SHOW_FUNC_CODE,
SQLCOM_INSTALL_PLUGIN, SQLCOM_UNINSTALL_PLUGIN,
- SQLCOM_SHOW_AUTHORS,
+ SQLCOM_SHOW_AUTHORS, SQLCOM_BINLOG,
/* This should be the last !!! */
SQLCOM_END
--- 1.39/sql/sql_list.h 2005-11-28 20:57:46 +01:00
+++ 1.40/sql/sql_list.h 2005-12-14 19:58:08 +01:00
@@ -441,6 +441,28 @@
};
+/* Needed to be able to have an I_List of char* strings in mysqld.cc. */
+
+class i_string: public ilink
+{
+public:
+ const char* ptr;
+ i_string():ptr(0) { }
+ i_string(const char* s) : ptr(s) {}
+};
+
+/* needed for linked list of two strings for replicate-rewrite-db */
+class i_string_pair: public ilink
+{
+public:
+ const char* key;
+ const char* val;
+ i_string_pair():key(0),val(0) { }
+ i_string_pair(const char* key_arg, const char* val_arg) :
+ key(key_arg),val(val_arg) {}
+};
+
+
template <class T> class I_List_iterator;
/*
--- 1.487/sql/sql_parse.cc 2005-12-14 01:39:46 +01:00
+++ 1.488/sql/sql_parse.cc 2005-12-14 19:58:09 +01:00
@@ -791,6 +791,9 @@
DBUG_PRINT("info",
("New connection received on %s", vio_description(net->vio)));
+#ifdef SIGNAL_WITH_VIO_CLOSE
+ thd->set_active_vio(net->vio);
+#endif
if (!thd->main_security_ctx.host) // If TCP/IP connection
{
@@ -1091,6 +1094,7 @@
VOID(sigemptyset(&set)); // Get mask in use
VOID(pthread_sigmask(SIG_UNBLOCK,&set,&thd->block_signals));
#endif
+ thd->thread_stack= (char*) &thd;
if (thd->store_globals())
{
close_connection(thd, ER_OUT_OF_RESOURCES, 1);
@@ -1104,7 +1108,6 @@
int error;
NET *net= &thd->net;
Security_context *sctx= thd->security_ctx;
- thd->thread_stack= (char*) &thd;
net->no_send_error= 0;
if ((error=check_connection(thd)))
@@ -1176,6 +1179,7 @@
or this thread has been schedule to handle the next query
*/
thd= current_thd;
+ thd->thread_stack= (char*) &thd;
} while (!(test_flags & TEST_NO_THREADS));
/* The following is only executed if we are not using --one-thread */
return(0); /* purecov: deadcode */
@@ -1195,6 +1199,7 @@
char *buff;
/* The following must be called before DBUG_ENTER */
+ thd->thread_stack= (char*) &thd;
if (my_thread_init() || thd->store_globals())
{
#ifndef EMBEDDED_LIBRARY
@@ -1978,7 +1983,8 @@
uptime,
(int) thread_count, (ulong) thd->query_id,
(ulong) thd->status_var.long_query_count,
- thd->status_var.opened_tables, refresh_version, cached_tables(),
+ thd->status_var.opened_tables, refresh_version,
+ cached_open_tables(),
(uptime ? (ulonglong2double(thd->query_id) / (double) uptime) :
(double) 0));
#ifdef SAFEMALLOC
@@ -2613,7 +2619,8 @@
goto error; /* purecov: inspected */
thd->enable_slow_log= opt_log_slow_admin_statements;
res = mysql_backup_table(thd, first_table);
-
+ select_lex->table_list.first= (byte*) first_table;
+ lex->query_tables=all_tables;
break;
}
case SQLCOM_RESTORE_TABLE:
@@ -2625,6 +2632,8 @@
goto error; /* purecov: inspected */
thd->enable_slow_log= opt_log_slow_admin_statements;
res = mysql_restore_table(thd, first_table);
+ select_lex->table_list.first= (byte*) first_table;
+ lex->query_tables=all_tables;
break;
}
case SQLCOM_ASSIGN_TO_KEYCACHE:
@@ -3118,6 +3127,8 @@
mysql_bin_log.write(&qinfo);
}
}
+ select_lex->table_list.first= (byte*) first_table;
+ lex->query_tables=all_tables;
break;
}
case SQLCOM_CHECK:
@@ -3128,6 +3139,8 @@
goto error; /* purecov: inspected */
thd->enable_slow_log= opt_log_slow_admin_statements;
res = mysql_check_table(thd, first_table, &lex->check_opt);
+ select_lex->table_list.first= (byte*) first_table;
+ lex->query_tables=all_tables;
break;
}
case SQLCOM_ANALYZE:
@@ -3148,6 +3161,8 @@
mysql_bin_log.write(&qinfo);
}
}
+ select_lex->table_list.first= (byte*) first_table;
+ lex->query_tables=all_tables;
break;
}
@@ -3171,6 +3186,8 @@
mysql_bin_log.write(&qinfo);
}
}
+ select_lex->table_list.first= (byte*) first_table;
+ lex->query_tables=all_tables;
break;
}
case SQLCOM_UPDATE:
@@ -3666,8 +3683,6 @@
my_error(ER_WRONG_DB_NAME, MYF(0), lex->name);
break;
}
- if (check_access(thd,SELECT_ACL,lex->name,0,1,0,is_schema_db(lex->name)))
- break;
res=mysqld_show_create_db(thd,lex->name,&lex->create_info);
break;
}
@@ -3676,7 +3691,8 @@
if (check_access(thd,INSERT_ACL,"mysql",0,1,0,0))
break;
#ifdef HAVE_DLOPEN
- if (sp_find_function(thd, lex->spname))
+ if (sp_find_routine(thd, TYPE_ENUM_FUNCTION, lex->spname,
+ &thd->sp_func_cache, FALSE))
{
my_error(ER_UDF_EXISTS, MYF(0), lex->spname->m_name.str);
goto error;
@@ -4027,8 +4043,8 @@
break;
}
case SQLCOM_SAVEPOINT:
- if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) ||
- !opt_using_transactions)
+ if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN) ||
+ thd->in_sub_stmt) || !opt_using_transactions)
send_ok(thd);
else
{
@@ -4122,14 +4138,6 @@
}
}
#endif
- if (lex->sphead->m_type == TYPE_ENUM_FUNCTION &&
- !(lex->sphead->m_flags & sp_head::HAS_RETURN))
- {
- my_error(ER_SP_NORETURN, MYF(0), name);
- delete lex->sphead;
- lex->sphead= 0;
- goto error;
- }
/*
We need to copy name and db in order to use them for
@@ -4210,7 +4218,8 @@
By this moment all needed SPs should be in cache so no need to look
into DB.
*/
- if (!(sp= sp_find_procedure(thd, lex->spname, TRUE)))
+ if (!(sp= sp_find_routine(thd, TYPE_ENUM_PROCEDURE, lex->spname,
+ &thd->sp_proc_cache, TRUE)))
{
my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "PROCEDURE",
lex->spname->m_qname.str);
@@ -4334,9 +4343,11 @@
memcpy(&chistics, &lex->sp_chistics, sizeof(chistics));
if (lex->sql_command == SQLCOM_ALTER_PROCEDURE)
- sp= sp_find_procedure(thd, lex->spname);
+ sp= sp_find_routine(thd, TYPE_ENUM_PROCEDURE, lex->spname,
+ &thd->sp_proc_cache, FALSE);
else
- sp= sp_find_function(thd, lex->spname);
+ sp= sp_find_routine(thd, TYPE_ENUM_FUNCTION, lex->spname,
+ &thd->sp_func_cache, FALSE);
mysql_reset_errors(thd, 0);
if (! sp)
{
@@ -4412,9 +4423,11 @@
char *db, *name;
if (lex->sql_command == SQLCOM_DROP_PROCEDURE)
- sp= sp_find_procedure(thd, lex->spname);
+ sp= sp_find_routine(thd, TYPE_ENUM_PROCEDURE, lex->spname,
+ &thd->sp_proc_cache, FALSE);
else
- sp= sp_find_function(thd, lex->spname);
+ sp= sp_find_routine(thd, TYPE_ENUM_FUNCTION, lex->spname,
+ &thd->sp_func_cache, FALSE);
mysql_reset_errors(thd, 0);
if (sp)
{
@@ -4542,6 +4555,33 @@
lex->wild->ptr() : NullS));
break;
}
+#ifndef DBUG_OFF
+ case SQLCOM_SHOW_PROC_CODE:
+ case SQLCOM_SHOW_FUNC_CODE:
+ {
+ sp_head *sp;
+
+ if (lex->spname->m_name.length > NAME_LEN)
+ {
+ my_error(ER_TOO_LONG_IDENT, MYF(0), lex->spname->m_name.str);
+ goto error;
+ }
+ if (lex->sql_command == SQLCOM_SHOW_PROC_CODE)
+ sp= sp_find_routine(thd, TYPE_ENUM_PROCEDURE, lex->spname,
+ &thd->sp_proc_cache, FALSE);
+ else
+ sp= sp_find_routine(thd, TYPE_ENUM_FUNCTION, lex->spname,
+ &thd->sp_func_cache, FALSE);
+ if (!sp || !sp->show_routine_code(thd))
+ {
+ /* We don't distinguish between errors for now */
+ my_error(ER_SP_DOES_NOT_EXIST, MYF(0),
+ SP_COM_STRING(lex), lex->spname->m_name.str);
+ goto error;
+ }
+ break;
+ }
+#endif // ifndef DBUG_OFF
case SQLCOM_CREATE_VIEW:
{
if (end_active_trans(thd))
@@ -4560,7 +4600,7 @@
buff.append(command[thd->lex->create_view_mode].str,
command[thd->lex->create_view_mode].length);
view_store_options(thd, first_table, &buff);
- buff.append("VIEW ", 5);
+ buff.append(STRING_WITH_LEN("VIEW "));
/* Test if user supplied a db (ie: we did not use thd->db) */
if (first_table->db != thd->db && first_table->db[0])
{
@@ -4570,7 +4610,7 @@
}
append_identifier(thd, &buff, first_table->table_name,
first_table->table_name_length);
- buff.append(" AS ", 4);
+ buff.append(STRING_WITH_LEN(" AS "));
buff.append(first_table->source.str, first_table->source.length);
thd->binlog_query(THD::STMT_QUERY_TYPE,
@@ -4818,11 +4858,15 @@
/*
- The return value for ROW_COUNT() is "implementation dependent" if
- the statement is not DELETE, INSERT or UPDATE (or a CALL executing
- such a statement), but -1 is what JDBC and ODBC wants.
+ The return value for ROW_COUNT() is "implementation dependent" if the
+ statement is not DELETE, INSERT or UPDATE, but -1 is what JDBC and ODBC
+ wants.
+
+ We do not change the value for a CALL or EXECUTE statement, so the value
+ generated by the last called (or executed) statement is preserved.
*/
- if (lex->sql_command != SQLCOM_CALL && uc_update_queries[lex->sql_command]<2)
+ if (lex->sql_command != SQLCOM_CALL && lex->sql_command != SQLCOM_EXECUTE &&
+ uc_update_queries[lex->sql_command]<2)
thd->row_count_func= -1;
goto cleanup;
@@ -5263,6 +5307,7 @@
char *buf __attribute__((unused)))
{
long stack_used;
+ DBUG_ASSERT(thd == current_thd);
if ((stack_used=used_stack(thd->thread_stack,(char*) &stack_used)) >=
(long) (thread_stack - margin))
{
@@ -5393,6 +5438,8 @@
select_lex->parent_lex= lex; /* Used in init_query. */
select_lex->init_query();
select_lex->init_select();
+ lex->nest_level++;
+ select_lex->nest_level= lex->nest_level;
/*
Don't evaluate this subquery during statement prepare even if
it's a constant one. The flag is switched off in the end of
@@ -5732,9 +5779,10 @@
buf, "TIMESTAMP");
}
- if (!(new_field= new_create_field(thd, field_name, type, length, decimals,
- type_modifier, default_value, on_update_value,
- comment, change, interval_list, cs, uint_geom_type)))
+ if (!(new_field= new create_field()) ||
+ new_field->init(thd, field_name, type, length, decimals, type_modifier,
+ default_value, on_update_value, comment, change,
+ interval_list, cs, uint_geom_type))
DBUG_RETURN(1);
lex->create_list.push_back(new_field);
@@ -5742,327 +5790,6 @@
DBUG_RETURN(0);
}
-/*****************************************************************************
-** Create field definition for create
-** Return 0 on failure, otherwise return create_field instance
-******************************************************************************/
-
-create_field *
-new_create_field(THD *thd, char *field_name, enum_field_types type,
- char *length, char *decimals,
- uint type_modifier,
- Item *default_value, Item *on_update_value,
- LEX_STRING *comment,
- char *change, List<String> *interval_list, CHARSET_INFO *cs,
- uint uint_geom_type)
-{
- register create_field *new_field;
- uint sign_len, allowed_type_modifier=0;
- ulong max_field_charlength= MAX_FIELD_CHARLENGTH;
- DBUG_ENTER("new_create_field");
-
- if (!(new_field=new create_field()))
- DBUG_RETURN(NULL);
- new_field->field=0;
- new_field->field_name=field_name;
- new_field->def= default_value;
- new_field->flags= type_modifier;
- new_field->unireg_check= (type_modifier & AUTO_INCREMENT_FLAG ?
- Field::NEXT_NUMBER : Field::NONE);
- new_field->decimals= decimals ? (uint)atoi(decimals) : 0;
- if (new_field->decimals >= NOT_FIXED_DEC)
- {
- my_error(ER_TOO_BIG_SCALE, MYF(0), new_field->decimals, field_name,
- NOT_FIXED_DEC-1);
- DBUG_RETURN(NULL);
- }
-
- new_field->sql_type=type;
- new_field->length=0;
- new_field->change=change;
- new_field->interval=0;
- new_field->pack_length= new_field->key_length= 0;
- new_field->charset=cs;
- new_field->geom_type= (Field::geometry_type) uint_geom_type;
-
- new_field->comment=*comment;
- /*
- Set flag if this field doesn't have a default value
- */
- if (!default_value && !(type_modifier & AUTO_INCREMENT_FLAG) &&
- (type_modifier & NOT_NULL_FLAG) && type != FIELD_TYPE_TIMESTAMP)
- new_field->flags|= NO_DEFAULT_VALUE_FLAG;
-
- if (length && !(new_field->length= (uint) atoi(length)))
- length=0; /* purecov: inspected */
- sign_len=type_modifier & UNSIGNED_FLAG ? 0 : 1;
-
- switch (type) {
- case FIELD_TYPE_TINY:
- if (!length) new_field->length=MAX_TINYINT_WIDTH+sign_len;
- allowed_type_modifier= AUTO_INCREMENT_FLAG;
- break;
- case FIELD_TYPE_SHORT:
- if (!length) new_field->length=MAX_SMALLINT_WIDTH+sign_len;
- allowed_type_modifier= AUTO_INCREMENT_FLAG;
- break;
- case FIELD_TYPE_INT24:
- if (!length) new_field->length=MAX_MEDIUMINT_WIDTH+sign_len;
- allowed_type_modifier= AUTO_INCREMENT_FLAG;
- break;
- case FIELD_TYPE_LONG:
- if (!length) new_field->length=MAX_INT_WIDTH+sign_len;
- allowed_type_modifier= AUTO_INCREMENT_FLAG;
- break;
- case FIELD_TYPE_LONGLONG:
- if (!length) new_field->length=MAX_BIGINT_WIDTH;
- allowed_type_modifier= AUTO_INCREMENT_FLAG;
- break;
- case FIELD_TYPE_NULL:
- break;
- case FIELD_TYPE_NEWDECIMAL:
- if (!length && !new_field->decimals)
- new_field->length= 10;
- if (new_field->length > DECIMAL_MAX_PRECISION)
- {
- my_error(ER_TOO_BIG_PRECISION, MYF(0), new_field->length, field_name,
- DECIMAL_MAX_PRECISION);
- DBUG_RETURN(NULL);
- }
- if (new_field->length < new_field->decimals)
- {
- my_error(ER_M_BIGGER_THAN_D, MYF(0), field_name);
- DBUG_RETURN(NULL);
- }
- new_field->length=
- my_decimal_precision_to_length(new_field->length, new_field->decimals,
- type_modifier & UNSIGNED_FLAG);
- new_field->pack_length=
- my_decimal_get_binary_size(new_field->length, new_field->decimals);
- break;
- case MYSQL_TYPE_VARCHAR:
- /*
- Long VARCHAR's are automaticly converted to blobs in mysql_prepare_table
- if they don't have a default value
- */
- max_field_charlength= MAX_FIELD_VARCHARLENGTH;
- break;
- case MYSQL_TYPE_STRING:
- break;
- case FIELD_TYPE_BLOB:
- case FIELD_TYPE_TINY_BLOB:
- case FIELD_TYPE_LONG_BLOB:
- case FIELD_TYPE_MEDIUM_BLOB:
- case FIELD_TYPE_GEOMETRY:
- if (default_value) // Allow empty as default value
- {
- String str,*res;
- res=default_value->val_str(&str);
- if (res->length())
- {
- my_error(ER_BLOB_CANT_HAVE_DEFAULT, MYF(0),
- field_name); /* purecov: inspected */
- DBUG_RETURN(NULL);
- }
- new_field->def=0;
- }
- new_field->flags|=BLOB_FLAG;
- break;
- case FIELD_TYPE_YEAR:
- if (!length || new_field->length != 2)
- new_field->length=4; // Default length
- new_field->flags|= ZEROFILL_FLAG | UNSIGNED_FLAG;
- break;
- case FIELD_TYPE_FLOAT:
- /* change FLOAT(precision) to FLOAT or DOUBLE */
- allowed_type_modifier= AUTO_INCREMENT_FLAG;
- if (length && !decimals)
- {
- uint tmp_length=new_field->length;
- if (tmp_length > PRECISION_FOR_DOUBLE)
- {
- my_error(ER_WRONG_FIELD_SPEC, MYF(0), field_name);
- DBUG_RETURN(NULL);
- }
- else if (tmp_length > PRECISION_FOR_FLOAT)
- {
- new_field->sql_type=FIELD_TYPE_DOUBLE;
- new_field->length=DBL_DIG+7; // -[digits].E+###
- }
- else
- new_field->length=FLT_DIG+6; // -[digits].E+##
- new_field->decimals= NOT_FIXED_DEC;
- break;
- }
- if (!length && !decimals)
- {
- new_field->length = FLT_DIG+6;
- new_field->decimals= NOT_FIXED_DEC;
- }
- if (new_field->length < new_field->decimals &&
- new_field->decimals != NOT_FIXED_DEC)
- {
- my_error(ER_M_BIGGER_THAN_D, MYF(0), field_name);
- DBUG_RETURN(NULL);
- }
- break;
- case FIELD_TYPE_DOUBLE:
- allowed_type_modifier= AUTO_INCREMENT_FLAG;
- if (!length && !decimals)
- {
- new_field->length = DBL_DIG+7;
- new_field->decimals=NOT_FIXED_DEC;
- }
- if (new_field->length < new_field->decimals &&
- new_field->decimals != NOT_FIXED_DEC)
- {
- my_error(ER_M_BIGGER_THAN_D, MYF(0), field_name);
- DBUG_RETURN(NULL);
- }
- break;
- case FIELD_TYPE_TIMESTAMP:
- if (!length)
- new_field->length= 14; // Full date YYYYMMDDHHMMSS
- else if (new_field->length != 19)
- {
- /*
- We support only even TIMESTAMP lengths less or equal than 14
- and 19 as length of 4.1 compatible representation.
- */
- new_field->length=((new_field->length+1)/2)*2; /* purecov: inspected */
- new_field->length= min(new_field->length,14); /* purecov: inspected */
- }
- new_field->flags|= ZEROFILL_FLAG | UNSIGNED_FLAG;
- if (default_value)
- {
- /* Grammar allows only NOW() value for ON UPDATE clause */
- if (default_value->type() == Item::FUNC_ITEM &&
- ((Item_func*)default_value)->functype() == Item_func::NOW_FUNC)
- {
- new_field->unireg_check= (on_update_value?Field::TIMESTAMP_DNUN_FIELD:
- Field::TIMESTAMP_DN_FIELD);
- /*
- We don't need default value any longer moreover it is dangerous.
- Everything handled by unireg_check further.
- */
- new_field->def= 0;
- }
- else
- new_field->unireg_check= (on_update_value?Field::TIMESTAMP_UN_FIELD:
- Field::NONE);
- }
- else
- {
- /*
- If we have default TIMESTAMP NOT NULL column without explicit DEFAULT
- or ON UPDATE values then for the sake of compatiblity we should treat
- this column as having DEFAULT NOW() ON UPDATE NOW() (when we don't
- have another TIMESTAMP column with auto-set option before this one)
- or DEFAULT 0 (in other cases).
- So here we are setting TIMESTAMP_OLD_FIELD only temporary, and will
- replace this value by TIMESTAMP_DNUN_FIELD or NONE later when
- information about all TIMESTAMP fields in table will be availiable.
-
- If we have TIMESTAMP NULL column without explicit DEFAULT value
- we treat it as having DEFAULT NULL attribute.
- */
- new_field->unireg_check= (on_update_value ?
- Field::TIMESTAMP_UN_FIELD :
- (new_field->flags & NOT_NULL_FLAG ?
- Field::TIMESTAMP_OLD_FIELD:
- Field::NONE));
- }
- break;
- case FIELD_TYPE_DATE: // Old date type
- if (protocol_version != PROTOCOL_VERSION-1)
- new_field->sql_type=FIELD_TYPE_NEWDATE;
- /* fall trough */
- case FIELD_TYPE_NEWDATE:
- new_field->length=10;
- break;
- case FIELD_TYPE_TIME:
- new_field->length=10;
- break;
- case FIELD_TYPE_DATETIME:
- new_field->length=19;
- break;
- case FIELD_TYPE_SET:
- {
- if (interval_list->elements > sizeof(longlong)*8)
- {
- my_error(ER_TOO_BIG_SET, MYF(0), field_name); /* purecov: inspected */
- DBUG_RETURN(NULL);
- }
- new_field->pack_length= get_set_pack_length(interval_list->elements);
-
- List_iterator<String> it(*interval_list);
- String *tmp;
- while ((tmp= it++))
- new_field->interval_list.push_back(tmp);
- /*
- Set fake length to 1 to pass the below conditions.
- Real length will be set in mysql_prepare_table()
- when we know the character set of the column
- */
- new_field->length= 1;
- break;
- }
- case FIELD_TYPE_ENUM:
- {
- // Should be safe
- new_field->pack_length= get_enum_pack_length(interval_list->elements);
-
- List_iterator<String> it(*interval_list);
- String *tmp;
- while ((tmp= it++))
- new_field->interval_list.push_back(tmp);
- new_field->length= 1; // See comment for FIELD_TYPE_SET above.
- break;
- }
- case MYSQL_TYPE_VAR_STRING:
- DBUG_ASSERT(0); // Impossible
- break;
- case MYSQL_TYPE_BIT:
- {
- if (!length)
- new_field->length= 1;
- if (new_field->length > MAX_BIT_FIELD_LENGTH)
- {
- my_error(ER_TOO_BIG_DISPLAYWIDTH, MYF(0), field_name,
- MAX_BIT_FIELD_LENGTH);
- DBUG_RETURN(NULL);
- }
- new_field->pack_length= (new_field->length + 7) / 8;
- break;
- }
- case FIELD_TYPE_DECIMAL:
- DBUG_ASSERT(0); /* Was obsolete */
- }
-
- if (!(new_field->flags & BLOB_FLAG) &&
- ((new_field->length > max_field_charlength && type != FIELD_TYPE_SET &&
- type != FIELD_TYPE_ENUM &&
- (type != MYSQL_TYPE_VARCHAR || default_value)) ||
- (!new_field->length &&
- type != MYSQL_TYPE_STRING &&
- type != MYSQL_TYPE_VARCHAR && type != FIELD_TYPE_GEOMETRY)))
- {
- my_error((type == MYSQL_TYPE_VAR_STRING || type == MYSQL_TYPE_VARCHAR ||
- type == MYSQL_TYPE_STRING) ? ER_TOO_BIG_FIELDLENGTH :
- ER_TOO_BIG_DISPLAYWIDTH,
- MYF(0),
- field_name, max_field_charlength); /* purecov: inspected */
- DBUG_RETURN(NULL);
- }
- type_modifier&= AUTO_INCREMENT_FLAG;
- if ((~allowed_type_modifier) & type_modifier)
- {
- my_error(ER_WRONG_FIELD_SPEC, MYF(0), field_name);
- DBUG_RETURN(NULL);
- }
- DBUG_RETURN(new_field);
-}
-
/* Store position for column in ALTER TABLE .. ADD column */
@@ -6178,12 +5905,16 @@
if (!table)
DBUG_RETURN(0); // End of memory
alias_str= alias ? alias->str : table->table.str;
- if (check_table_name(table->table.str,table->table.length) ||
- table->db.str && check_db_name(table->db.str))
+ if (check_table_name(table->table.str,table->table.length))
{
my_error(ER_WRONG_TABLE_NAME, MYF(0), table->table.str);
DBUG_RETURN(0);
}
+ if (table->db.str && check_db_name(table->db.str))
+ {
+ my_error(ER_WRONG_DB_NAME, MYF(0), table->db.str);
+ DBUG_RETURN(0);
+ }
if (!alias) /* Alias is case sensitive */
{
@@ -6556,36 +6287,39 @@
/*
- Create a new name resolution context for a JOIN ... ON clause.
+ Push a new name resolution context for a JOIN ... ON clause to the
+ context stack of a query block.
SYNOPSIS
- make_join_on_context()
+ push_new_name_resolution_context()
thd pointer to current thread
left_op left operand of the JOIN
right_op rigth operand of the JOIN
DESCRIPTION
Create a new name resolution context for a JOIN ... ON clause,
- and set the first and last leaves of the list of table references
- to be used for name resolution.
+ set the first and last leaves of the list of table references
+ to be used for name resolution, and push the newly created
+ context to the stack of contexts of the query.
RETURN
- A new context if all is OK
- NULL - if a memory allocation error occured
+ FALSE if all is OK
+ TRUE if a memory allocation error occured
*/
-Name_resolution_context *
-make_join_on_context(THD *thd, TABLE_LIST *left_op, TABLE_LIST *right_op)
+bool
+push_new_name_resolution_context(THD *thd,
+ TABLE_LIST *left_op, TABLE_LIST *right_op)
{
Name_resolution_context *on_context;
if (!(on_context= new (thd->mem_root) Name_resolution_context))
- return NULL;
+ return TRUE;
on_context->init();
on_context->first_name_resolution_table=
left_op->first_leaf_for_name_resolution();
on_context->last_name_resolution_table=
right_op->last_leaf_for_name_resolution();
- return on_context;
+ return thd->lex->push_context(on_context);
}
@@ -6711,7 +6445,10 @@
allocate temporary THD for execution of acl_reload()/grant_reload().
*/
if (!thd && (thd= (tmp_thd= new THD)))
+ {
+ thd->thread_stack= (char*) &tmp_thd;
thd->store_globals();
+ }
if (thd)
{
(void)acl_reload(thd);
--- 1.430/sql/sql_yacc.yy 2005-12-12 20:55:14 +01:00
+++ 1.431/sql/sql_yacc.yy 2005-12-14 19:58:11 +01:00
@@ -897,6 +897,7 @@
alter
| analyze
| backup
+ | binlog_event
| call
| change
| check
@@ -4399,6 +4400,13 @@
table_list opt_mi_check_type
{}
;
+
+binlog_event:
+ BINLOG_SYM TEXT_STRING_sys
+ {
+ Lex->sql_command = SQLCOM_BINLOG;
+ Lex->comment= $2;
+ }
check:
CHECK_SYM table_or_tables
--- 1.45/client/client_priv.h 2005-12-04 02:16:58 +01:00
+++ 1.46/client/client_priv.h 2005-12-14 20:21:47 +01:00
@@ -52,5 +52,5 @@
OPT_TRIGGERS,
OPT_IGNORE_TABLE,OPT_INSERT_IGNORE,OPT_SHOW_WARNINGS,OPT_DROP_DATABASE,
OPT_TZ_UTC, OPT_AUTO_CLOSE, OPT_CREATE_SLAP_SCHEMA,
- OPT_MYSQL_REPLACE_INTO
+ OPT_MYSQL_REPLACE_INTO, OPT_BASE64_OUTPUT
};
--- 1.73/libmysqld/Makefile.am 2005-12-14 01:39:44 +01:00
+++ 1.74/libmysqld/Makefile.am 2005-12-14 19:58:01 +01:00
@@ -144,19 +144,19 @@
link_sources:
set -x; \
for f in $(sqlsources); do \
- rm -f $(srcdir)/$$f; \
- @LN_CP_F@ $(srcdir)/../sql/$$f $(srcdir)/$$f; \
+ rm -f $$f; \
+ @LN_CP_F@ $(top_srcdir)/sql/$$f $$f; \
done; \
for f in $(libmysqlsources); do \
- rm -f $(srcdir)/$$f; \
- @LN_CP_F@ $(srcdir)/../libmysql/$$f $(srcdir)/$$f; \
+ rm -f $$f; \
+ @LN_CP_F@ $(top_srcdir)/libmysql/$$f $$f; \
done; \
for f in $(sqlstoragesources); do \
- rm -f $(srcdir)/$$f; \
- @LN_CP_F@ `find $(srcdir)/../sql -name $$f` $(srcdir)/$$f; \
+ rm -f $$f; \
+ @LN_CP_F@ `find $(srcdir)/../sql -name $$f` $$f; \
done; \
- rm -f $(srcdir)/client_settings.h; \
- @LN_CP_F@ $(srcdir)/../libmysql/client_settings.h $(srcdir)/client_settings.h;
+ rm -f client_settings.h; \
+ @LN_CP_F@ $(top_srcdir)/libmysql/client_settings.h client_settings.h
clean-local:
| Thread |
|---|
| • bk commit into 5.1 tree (lars:1.1963) | Lars Thalmann | 14 Dec |