Commit 6471005c authored by unknown's avatar unknown

4.1 -> 5.0 merge


client/mysql.cc:
  Auto merged
client/sql_string.h:
  Auto merged
configure.in:
  Auto merged
myisam/mi_create.c:
  Auto merged
mysql-test/r/date_formats.result:
  Auto merged
mysql-test/t/date_formats.test:
  Auto merged
ndb/src/kernel/blocks/dbtup/DbtupMeta.cpp:
  Auto merged
ndb/src/mgmsrv/ConfigInfo.cpp:
  Auto merged
sql/item_strfunc.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_string.h:
  Auto merged
sql/table.cc:
  Auto merged
parents 3630e829 f098cab9
......@@ -1084,7 +1084,7 @@ static int read_and_execute(bool interactive)
(We want to allow help, print and clear anywhere at line start
*/
if ((named_cmds || glob_buffer.is_empty())
&& !in_string && (com=find_command(line,0)))
&& !ml_comment && !in_string && (com=find_command(line,0)))
{
if ((*com->func)(&glob_buffer,line) > 0)
break;
......
......@@ -2239,15 +2239,16 @@ static void dump_table(char *table, char *db)
goto err;
}
if (opt_disable_keys)
if (opt_lock)
{
fprintf(md_result_file, "\n/*!40000 ALTER TABLE %s DISABLE KEYS */;\n",
opt_quoted_table);
fprintf(md_result_file,"LOCK TABLES %s WRITE;\n", opt_quoted_table);
check_io(md_result_file);
}
if (opt_lock)
/* Moved disable keys to after lock per bug 15977 */
if (opt_disable_keys)
{
fprintf(md_result_file,"LOCK TABLES %s WRITE;\n", opt_quoted_table);
fprintf(md_result_file, "/*!40000 ALTER TABLE %s DISABLE KEYS */;\n",
opt_quoted_table);
check_io(md_result_file);
}
......@@ -2511,17 +2512,19 @@ static void dump_table(char *table, char *db)
error= EX_CONSCHECK;
goto err;
}
if (opt_lock)
{
fputs("UNLOCK TABLES;\n", md_result_file);
check_io(md_result_file);
}
/* Moved enable keys to before unlock per bug 15977 */
if (opt_disable_keys)
{
fprintf(md_result_file,"/*!40000 ALTER TABLE %s ENABLE KEYS */;\n",
opt_quoted_table);
check_io(md_result_file);
}
if (opt_lock)
{
fputs("UNLOCK TABLES;\n", md_result_file);
check_io(md_result_file);
}
if (opt_autocommit)
{
fprintf(md_result_file, "commit;\n");
......
--require r/case_sensitive_file_system.require
--disable_query_log
show variables like "lower_case_file_system";
--enable_query_log
Variable_name Value
lower_case_file_system OFF
......@@ -564,3 +564,9 @@ TIME_FORMAT("24:00:00", '%l %p')
SELECT TIME_FORMAT("25:00:00", '%l %p');
TIME_FORMAT("25:00:00", '%l %p')
1 AM
SELECT DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896);
DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896)
NULL
Warnings:
Warning 1292 Truncated incorrect datetime value: '%Y-%m-%d %H:%i:%s'
"End of 4.1 tests"
create database d1;
grant all on d1.* to 'sample'@'localhost' identified by 'password';
flush privileges;
select database();
database()
d1
create database d2;
ERROR 42000: Access denied for user 'sample'@'localhost' to database 'd2'
create database D1;
ERROR 42000: Access denied for user 'sample'@'localhost' to database 'D1'
drop database if exists d1;
1
1
ERROR 1064 (42000) at line 3: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
ERROR at line 1: USE must be followed by a database name
This diff is collapsed.
......@@ -502,6 +502,20 @@ SELECT FOUND_ROWS();
FOUND_ROWS()
2
deallocate prepare stmt;
drop table if exists t1;
create temporary table if not exists t1 (a1 int);
prepare stmt from "delete t1 from t1 where (cast(a1/3 as unsigned) * 3) = a1";
drop temporary table t1;
create temporary table if not exists t1 (a1 int);
execute stmt;
drop temporary table t1;
create temporary table if not exists t1 (a1 int);
execute stmt;
drop temporary table t1;
create temporary table if not exists t1 (a1 int);
execute stmt;
drop temporary table t1;
deallocate prepare stmt;
create table t1 (a char(3) not null, b char(3) not null,
c char(3) not null, primary key (a, b, c));
create table t2 like t1;
......
......@@ -290,7 +290,6 @@ drop table t1;
select str_to_date( 1, NULL );
select str_to_date( NULL, 1 );
select str_to_date( 1, IF(1=1,NULL,NULL) );
# End of 4.1 tests
#
# Bug#11326
......@@ -321,3 +320,10 @@ SELECT TIME_FORMAT("12:00:00", '%l %p');
SELECT TIME_FORMAT("23:00:00", '%l %p');
SELECT TIME_FORMAT("24:00:00", '%l %p');
SELECT TIME_FORMAT("25:00:00", '%l %p');
#
# Bug#20729: Bad date_format() call makes mysql server crash
#
SELECT DATE_FORMAT('%Y-%m-%d %H:%i:%s', 1151414896);
--echo "End of 4.1 tests"
#
# Specific tests for case sensitive file systems
# i.e. lower_case_filesystem=OFF
#
-- source include/have_case_sensitive_file_system.inc
connect (master,localhost,root,,);
connection master;
create database d1;
grant all on d1.* to 'sample'@'localhost' identified by 'password';
flush privileges;
connect (sample,localhost,sample,password,d1);
connection sample;
select database();
--error 1044
create database d2;
--error 1044
create database D1;
disconnect sample;
connection master;
drop database if exists d1;
disconnect master;
connection default;
# End of 4.1 tests
# This test should work in embedded server after we fix mysqltest
-- source include/not_embedded.inc
#
# Bug #20432: mysql client interprets commands in comments
#
# if the client sees the 'use' within the comment, we haven't fixed
--exec echo "/*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "*/" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
# SQL can have embedded comments => workie
--exec echo "select /*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "*/ 1" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
# client commands on the other hand must be at BOL => error
--exec echo "/*" > $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "xxx" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec echo "*/ use" >> $MYSQLTEST_VARDIR/tmp/bug20432.sql
--error 1
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
# client comment recognized, but parameter missing => error
--exec echo "use" > $MYSQLTEST_VARDIR/tmp/bug20432.sql
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/bug20432.sql 2>&1
......@@ -491,6 +491,30 @@ deallocate prepare stmt;
drop table t1, t2;
#
# Bug#19399 "Stored Procedures 'Lost Connection' when dropping/creating
# tables"
# Check that multi-delete tables are also cleaned up before re-execution.
#
--disable_warnings
drop table if exists t1;
create temporary table if not exists t1 (a1 int);
--enable_warnings
# exact delete syntax is essential
prepare stmt from "delete t1 from t1 where (cast(a1/3 as unsigned) * 3) = a1";
drop temporary table t1;
create temporary table if not exists t1 (a1 int);
# the server crashed on the next statement without the fix
execute stmt;
drop temporary table t1;
create temporary table if not exists t1 (a1 int);
# the problem was in memory corruption: repeat the test just in case
execute stmt;
drop temporary table t1;
create temporary table if not exists t1 (a1 int);
execute stmt;
drop temporary table t1;
deallocate prepare stmt;
# Bug#6102 "Server crash with prepared statement and blank after
# function name"
# ensure that stored functions are cached when preparing a statement
......
......@@ -156,7 +156,10 @@ class Item_func :public Item_result_field
{
return (null_value=args[0]->get_time(ltime));
}
bool is_null() { (void) val_int(); return null_value; }
bool is_null() {
(void) val_int(); /* Discard result. It sets null_value as side-effect. */
return null_value;
}
void signal_divide_by_null();
friend class udf_handler;
Field *tmp_table_field() { return result_field; }
......
......@@ -149,8 +149,8 @@ my_bool acl_init(bool dont_read_acl_tables)
acl_cache= new hash_filo(ACL_CACHE_SIZE, 0, 0,
(hash_get_key) acl_entry_get_key,
(hash_free_key) free,
/* Use the case sensitive "binary" charset */
&my_charset_bin);
lower_case_file_system ?
system_charset_info : &my_charset_bin);
if (dont_read_acl_tables)
{
DBUG_RETURN(0); /* purecov: tested */
......
......@@ -124,6 +124,7 @@ void lex_start(THD *thd, uchar *buf,uint length)
lex->value_list.empty();
lex->update_list.empty();
lex->param_list.empty();
lex->auxilliary_table_list.empty();
lex->view_list.empty();
lex->prepared_stmt_params.empty();
lex->unit.next= lex->unit.master=
......
......@@ -2135,7 +2135,8 @@ void reinit_stmt_before_use(THD *thd, LEX *lex)
Reset old pointers to TABLEs: they are not valid since the tables
were closed in the end of previous prepare or execute call.
*/
tables->table= 0;
tables->reinit_before_use(thd);
/* Reset is_schema_table_processed value(needed for I_S tables */
tables->is_schema_table_processed= FALSE;
......
......@@ -2985,6 +2985,23 @@ Field_iterator_table_ref::get_natural_column_ref()
return nj_col;
}
/*
Cleanup this table for re-execution.
SYNOPSIS
st_table_list::reinit_before_use()
*/
void st_table_list::reinit_before_use(THD * /* thd */)
{
/*
Reset old pointers to TABLEs: they are not valid since the tables
were closed in the end of previous prepare or execute call.
*/
table= 0;
table_list= 0;
}
/*****************************************************************************
** Instansiate templates
......
......@@ -668,6 +668,11 @@ typedef struct st_table_list
Security_context *find_view_security_context(THD *thd);
bool prepare_view_securety_context(THD *thd);
#endif
/*
Cleanup for re-execution in a prepared statement or a stored
procedure.
*/
void reinit_before_use(THD *thd);
private:
bool prep_check_option(THD *thd, uint8 check_opt_type);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment