Commit 026fd270 authored by unknown's avatar unknown

Merge mysql.com:/home/mydev/mysql-5.1

into  mysql.com:/home/mydev/mysql-5.1-bug11527

parents 38657e1b 104b9e78
......@@ -1616,3 +1616,4 @@ zlib/*.ds?
zlib/*.vcproj
libmysqld/partition_info.cc
storage/ndb/src/common/util/testBitmask.cpp
include/openssl
......@@ -1086,6 +1086,9 @@ WAIT:
int status, pid;
pid= wait(&status);
DBUG_PRINT("info", ("Parent: child %d status %d", pid, status));
if (status != 0)
printf("%s: Child %d died with the status %d\n",
my_progname, pid, status);
}
}
#endif
......@@ -1122,11 +1125,11 @@ run_task(thread_context *con)
DBUG_PRINT("info", ("trying to connect to host %s as user %s", host, user));
lock_file= my_open(lock_file_str, O_RDWR, MYF(0));
my_lock(lock_file, F_RDLCK, 0, F_TO_EOF, MYF(0));
if (!opt_only_print)
if (!opt_only_print)
{
if (!(mysql= mysql_real_connect(NULL, host, user, opt_password,
create_schema_string,
opt_mysql_port,
if (!(mysql= mysql_real_connect(mysql, host, user, opt_password,
create_schema_string,
opt_mysql_port,
opt_mysql_unix_port,
0)))
{
......@@ -1136,12 +1139,12 @@ run_task(thread_context *con)
}
DBUG_PRINT("info", ("connected."));
queries= 0;
queries= 0;
limit_not_met:
for (ptr= con->stmt; ptr && ptr->length; ptr= ptr->next)
{
if (opt_only_print)
if (opt_only_print)
{
printf("%.*s;\n", (uint)ptr->length, ptr->string);
}
......
......@@ -987,10 +987,10 @@ sub executable_setup () {
# New CMake locations.
"$glob_basedir/client/release",
"$glob_basedir/client/debug");
$exe_mysqld= mtr_exe_exists ("$path_client_bindir/mysqld-max",
"$path_client_bindir/mysqld-nt",
$exe_mysqld= mtr_exe_exists ("$path_client_bindir/mysqld-nt",
"$path_client_bindir/mysqld",
"$path_client_bindir/mysqld-debug",
"$path_client_bindir/mysqld-max",
"$glob_basedir/sql/release/mysqld",
"$glob_basedir/sql/debug/mysqld");
$path_language= mtr_path_exists("$glob_basedir/share/english/",
......
......@@ -19,6 +19,8 @@ TZ=$MY_TZ; export TZ # for UNIX_TIMESTAMP tests to work
LOCAL_SOCKET=@MYSQL_UNIX_ADDR@
MYSQL_TCP_PORT=@MYSQL_TCP_PORT@
umask 022
# For query_cache test
case `uname` in
SCO_SV | UnixWare | OpenUNIX )
......
......@@ -6,26 +6,26 @@ Table Op Msg_type Msg_text
test.t4 backup error Failed copying .frm file (errno: X)
test.t4 backup status Operation failed
Warnings:
Warning 1540 The 'BACKUP TABLE' statement is deprecated and will be removed in MySQL 5.2. Please use client programs (e.g. mysqldump, mysql, MySQL Administrator) instead.
Warning 1540 The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead.
Error 1 Can't create/write to file 'MYSQLTEST_VARDIR/bogus/t4.frm' (Errcode: X)
backup table t4 to '../tmp';
Table Op Msg_type Msg_text
test.t4 backup status OK
Warnings:
Warning 1540 The 'BACKUP TABLE' statement is deprecated and will be removed in MySQL 5.2. Please use client programs (e.g. mysqldump, mysql, MySQL Administrator) instead.
Warning 1540 The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead.
backup table t4 to '../tmp';
Table Op Msg_type Msg_text
test.t4 backup error Failed copying .frm file (errno: X)
test.t4 backup status Operation failed
Warnings:
Warning 1540 The 'BACKUP TABLE' statement is deprecated and will be removed in MySQL 5.2. Please use client programs (e.g. mysqldump, mysql, MySQL Administrator) instead.
Warning 1540 The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead.
Error 1 Can't create/write to file 'MYSQLTEST_VARDIR/tmp/t4.frm' (Errcode: X)
drop table t4;
restore table t4 from '../tmp';
Table Op Msg_type Msg_text
test.t4 restore status OK
Warnings:
Warning 1540 The 'RESTORE TABLE' statement is deprecated and will be removed in MySQL 5.2. Please use client programs (e.g. mysqldump, mysql, MySQL Administrator) instead.
Warning 1540 The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead.
select count(*) from t4;
count(*)
0
......@@ -35,19 +35,19 @@ backup table t1 to '../tmp';
Table Op Msg_type Msg_text
test.t1 backup status OK
Warnings:
Warning 1540 The 'BACKUP TABLE' statement is deprecated and will be removed in MySQL 5.2. Please use client programs (e.g. mysqldump, mysql, MySQL Administrator) instead.
Warning 1540 The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead.
drop table t1;
restore table t1 from '../bogus';
Table Op Msg_type Msg_text
t1 restore error Failed copying .frm file
Warnings:
Warning 1540 The 'RESTORE TABLE' statement is deprecated and will be removed in MySQL 5.2. Please use client programs (e.g. mysqldump, mysql, MySQL Administrator) instead.
Warning 1540 The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead.
Error 29 File 'MYSQLTEST_VARDIR/bogus/t1.frm' not found (Errcode: X)
restore table t1 from '../tmp';
Table Op Msg_type Msg_text
test.t1 restore status OK
Warnings:
Warning 1540 The 'RESTORE TABLE' statement is deprecated and will be removed in MySQL 5.2. Please use client programs (e.g. mysqldump, mysql, MySQL Administrator) instead.
Warning 1540 The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead.
select n from t1;
n
23
......@@ -62,7 +62,7 @@ Table Op Msg_type Msg_text
test.t2 backup status OK
test.t3 backup status OK
Warnings:
Warning 1540 The 'BACKUP TABLE' statement is deprecated and will be removed in MySQL 5.2. Please use client programs (e.g. mysqldump, mysql, MySQL Administrator) instead.
Warning 1540 The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead.
drop table t1,t2,t3;
restore table t1,t2,t3 from '../tmp';
Table Op Msg_type Msg_text
......@@ -70,7 +70,7 @@ test.t1 restore status OK
test.t2 restore status OK
test.t3 restore status OK
Warnings:
Warning 1540 The 'RESTORE TABLE' statement is deprecated and will be removed in MySQL 5.2. Please use client programs (e.g. mysqldump, mysql, MySQL Administrator) instead.
Warning 1540 The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead.
select n from t1;
n
23
......@@ -91,7 +91,7 @@ restore table t1 from '../tmp';
Table Op Msg_type Msg_text
test.t1 restore status OK
Warnings:
Warning 1540 The 'RESTORE TABLE' statement is deprecated and will be removed in MySQL 5.2. Please use client programs (e.g. mysqldump, mysql, MySQL Administrator) instead.
Warning 1540 The syntax 'RESTORE TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead.
rename table t1 to t5;
lock tables t5 write;
backup table t5 to '../tmp';
......@@ -99,5 +99,5 @@ unlock tables;
Table Op Msg_type Msg_text
test.t5 backup status OK
Warnings:
Warning 1540 The 'BACKUP TABLE' statement is deprecated and will be removed in MySQL 5.2. Please use client programs (e.g. mysqldump, mysql, MySQL Administrator) instead.
Warning 1540 The syntax 'BACKUP TABLE' is deprecated and will be removed in MySQL 5.2. Please use MySQL Administrator (mysqldump, mysql) instead.
drop table t5;
......@@ -332,3 +332,12 @@ SELECT * FROM t1;
col1 col2 col3 col4 col5 col6 col7 col8 col9 col10 col11 col12 col13 col14 col15 col16 col17 col18 col19 col20 col21 col22 col23 col24 col25 col26 col27 col28 col29 col30 col31 col32 col33 col34 col35 col36 col37 col38 fix1 fix2 fix3 fix4 fix5 fix6 fix7 fix8 fix9 fix10 fix11 fix12 fix13 fix14 fix15 fix16 fix17 fix18 fix19 fix20 fix21 fix22 fix23 fix24 fix25 fix26 fix27 fix28 fix29 fix30
9 99 999 9999 99999 999999 9999999 99999999 999999999 9999999999 99999999999 999999999999 9999999999999 99999999999999 999999999999999 9999999999999999 99999999999999999 999999999999999999 9999999999999999999 99999999999999999999 999999999999999999999 9999999999999999999999 99999999999999999999999 999999999999999999999999 9999999999999999999999999 99999999999999999999999999 999999999999999999999999999 9999999999999999999999999999 99999999999999999999999999999 999999999999999999999999999999 9999999999999999999999999999999 99999999999999999999999999999999 999999999999999999999999999999999 9999999999999999999999999999999999 99999999999999999999999999999999999 999999999999999999999999999999999999 9999999999999999999999999999999999999 99999999999999999999999999999999999999 9999999999999999999999999999999999999.9 999999999999999999999999999999999999.99 99999999999999999999999999999999999.999 9999999999999999999999999999999999.9999 999999999999999999999999999999999.99999 99999999999999999999999999999999.999999 9999999999999999999999999999999.9999999 999999999999999999999999999999.99999999 99999999999999999999999999999.999999999 9999999999999999999999999999.9999999999 999999999999999999999999999.99999999999 99999999999999999999999999.999999999999 9999999999999999999999999.9999999999999 999999999999999999999999.99999999999999 99999999999999999999999.999999999999999 9999999999999999999999.9999999999999999 999999999999999999999.99999999999999999 99999999999999999999.999999999999999999 9999999999999999999.9999999999999999999 999999999999999999.99999999999999999999 99999999999999999.999999999999999999999 9999999999999999.9999999999999999999999 999999999999999.99999999999999999999999 99999999999999.999999999999999999999999 9999999999999.9999999999999999999999999 999999999999.99999999999999999999999999 99999999999.999999999999999999999999999 9999999999.9999999999999999999999999999 999999999.99999999999999999999999999999 99999999.999999999999999999999999999999
DROP TABLE t1;
create table t1 (bigint_col bigint unsigned);
insert into t1 values (17666000000000000000);
select * from t1 where bigint_col=17666000000000000000;
bigint_col
17666000000000000000
select * from t1 where bigint_col='17666000000000000000';
bigint_col
17666000000000000000
drop table t1;
create database if not exists events_test;
use events_test;
"We use procedure here because its statements won't be logged into the general log"
"If we had used normal select that are logged in different ways depending on whether"
"the test suite is run in normal mode or with --ps-protocol"
CREATE procedure select_general_log()
BEGIN
SELECT user_host, argument FROM mysql.general_log WHERE argument LIKE '%alabala%';
END|
"Check General Query Log"
SET GLOBAL event_scheduler=0;
create event log_general on schedule every 1 minute do SELect 'alabala', sleep(3) from dual;
TRUNCATE mysql.general_log;
"1 row, the current statement!"
call select_general_log();
user_host argument
SET GLOBAL event_scheduler=1;
"Wait the scheduler to start"
"Should see 3 rows - the 'SELect' is in the middle. The other two are selects from general_log"
call select_general_log();
user_host argument
root[root] @ localhost [localhost] SELect 'alabala', sleep(3) from dual
DROP PROCEDURE select_general_log;
DROP EVENT log_general;
SET GLOBAL event_scheduler=0;
"Check slow query log"
"Save the values"
SET @old_global_long_query_time:=(select get_value());
SET @old_session_long_query_time:=@@long_query_time;
......
drop table if exists t1;
set names utf8;
create table t1 (s1 int)
partition by list (s1)
(partition c values in (1),
partition Ç values in (3));
insert into t1 values (1),(3);
select * from t1;
s1
1
3
flush tables;
set names latin1;
select * from t1;
s1
1
3
drop table t1;
......@@ -319,7 +319,7 @@ use db_bug7787;
CREATE PROCEDURE p1()
SHOW INNODB STATUS;
Warnings:
Warning 1287 'SHOW INNODB STATUS' is deprecated; use 'SHOW ENGINE INNODB STATUS' instead
Warning 1540 The syntax 'SHOW INNODB STATUS' is deprecated and will be removed in MySQL 5.2. Please use 'SHOW ENGINE INNODB STATUS' instead.
GRANT EXECUTE ON PROCEDURE p1 TO user_bug7787@localhost;
DROP DATABASE db_bug7787;
use test;
......@@ -100,13 +100,13 @@ create table t1 (t2 timestamp(2), t4 timestamp(4), t6 timestamp(6),
t8 timestamp(8), t10 timestamp(10), t12 timestamp(12),
t14 timestamp(14));
Warnings:
Warning 1287 'TIMESTAMP(2)' is deprecated; use 'TIMESTAMP' instead
Warning 1287 'TIMESTAMP(4)' is deprecated; use 'TIMESTAMP' instead
Warning 1287 'TIMESTAMP(6)' is deprecated; use 'TIMESTAMP' instead
Warning 1287 'TIMESTAMP(8)' is deprecated; use 'TIMESTAMP' instead
Warning 1287 'TIMESTAMP(10)' is deprecated; use 'TIMESTAMP' instead
Warning 1287 'TIMESTAMP(12)' is deprecated; use 'TIMESTAMP' instead
Warning 1287 'TIMESTAMP(14)' is deprecated; use 'TIMESTAMP' instead
Warning 1540 The syntax 'TIMESTAMP(2)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead.
Warning 1540 The syntax 'TIMESTAMP(4)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead.
Warning 1540 The syntax 'TIMESTAMP(6)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead.
Warning 1540 The syntax 'TIMESTAMP(8)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead.
Warning 1540 The syntax 'TIMESTAMP(10)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead.
Warning 1540 The syntax 'TIMESTAMP(12)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead.
Warning 1540 The syntax 'TIMESTAMP(14)' is deprecated and will be removed in MySQL 5.2. Please use 'TIMESTAMP' instead.
insert t1 values (0,0,0,0,0,0,0),
("1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
"1997-12-31 23:47:59", "1997-12-31 23:47:59", "1997-12-31 23:47:59",
......
......@@ -168,7 +168,7 @@ max_error_count 10
drop table t1;
set table_type=MYISAM;
Warnings:
Warning 1287 'table_type' is deprecated; use 'storage_engine' instead
Warning 1540 The syntax 'table_type' is deprecated and will be removed in MySQL 5.2. Please use 'storage_engine' instead.
create table t1 (a int);
insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10);
update t1 set a='abc';
......
......@@ -270,3 +270,12 @@ VALUES (9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999,
SELECT * FROM t1;
DROP TABLE t1;
#bug #9088 BIGINT WHERE CLAUSE
create table t1 (bigint_col bigint unsigned);
insert into t1 values (17666000000000000000);
select * from t1 where bigint_col=17666000000000000000;
select * from t1 where bigint_col='17666000000000000000';
drop table t1;
create database if not exists events_test;
use events_test;
--echo "We use procedure here because its statements won't be logged into the general log"
--echo "If we had used normal select that are logged in different ways depending on whether"
--echo "the test suite is run in normal mode or with --ps-protocol"
delimiter |;
CREATE procedure select_general_log()
BEGIN
SELECT user_host, argument FROM mysql.general_log WHERE argument LIKE '%alabala%';
END|
delimiter ;|
--echo "Check General Query Log"
SET GLOBAL event_scheduler=0;
create event log_general on schedule every 1 minute do SELect 'alabala', sleep(3) from dual;
TRUNCATE mysql.general_log;
--echo "1 row, the current statement!"
call select_general_log();
SET GLOBAL event_scheduler=1;
--echo "Wait the scheduler to start"
--echo "Should see 3 rows - the 'SELect' is in the middle. The other two are selects from general_log"
--sleep 2
call select_general_log();
DROP PROCEDURE select_general_log;
DROP EVENT log_general;
SET GLOBAL event_scheduler=0;
--sleep 1
--echo "Check slow query log"
--disable_query_log
DELIMITER |;
CREATE FUNCTION get_value()
......
#
# Test for character set related things in combination
# with the partition storage engine
#
-- source include/have_partition.inc
--disable_warnings
drop table if exists t1;
--enable_warnings
set names utf8;
create table t1 (s1 int)
partition by list (s1)
(partition c values in (1),
partition Ç values in (3));
insert into t1 values (1),(3);
select * from t1;
flush tables;
set names latin1;
select * from t1;
drop table t1;
......@@ -213,15 +213,10 @@ then
chown $user $mysql_unix_port_dir
fi
# Use the mysqld-max binary by default if the user doesn't specify a binary
# If the user doesn't specify a binary, we assume name "mysqld"
if test -z "$MYSQLD"
then
if test -x $ledir/mysqld-max
then
MYSQLD=mysqld-max
else
MYSQLD=mysqld
fi
MYSQLD=mysqld
fi
if test ! -x $ledir/$MYSQLD
......
......@@ -1156,7 +1156,12 @@ Event_timed::execute(THD *thd, MEM_ROOT *mem_root)
goto done;
/* Now we are sure we have valid this->sphead so we can copy the context */
sphead->m_security_ctx= security_ctx;
thd->db= dbname.str;
/*
THD::~THD will clean this or if there is DROP DATABASE in the SP then
it will be free there. It should not point to our buffer which is allocated
on a mem_root.
*/
thd->db= my_strdup(dbname.str, MYF(0));
thd->db_length= dbname.length;
if (!check_access(thd, EVENT_ACL,dbname.str, 0, 0, 0,is_schema_db(dbname.str)))
{
......@@ -1164,6 +1169,8 @@ Event_timed::execute(THD *thd, MEM_ROOT *mem_root)
empty_item_list.empty();
if (thd->enable_slow_log)
sphead->m_flags|= sp_head::LOG_SLOW_STATEMENTS;
sphead->m_flags|= sp_head::LOG_GENERAL_LOG;
ret= sphead->execute_procedure(thd, &empty_item_list);
}
else
......@@ -1175,7 +1182,6 @@ Event_timed::execute(THD *thd, MEM_ROOT *mem_root)
restore_security_context(thd, save_ctx);
DBUG_PRINT("info", ("master_access=%d db_access=%d",
thd->security_ctx->master_access, thd->security_ctx->db_access));
thd->db= 0;
VOID(pthread_mutex_lock(&this->LOCK_running));
running= false;
......@@ -1238,12 +1244,12 @@ Event_timed::change_security_context(THD *thd, Security_context *s_ctx,
Event_timed::restore_security_context()
thd - thread
backup - switch to this context
*/
*/
void
Event_timed::restore_security_context(THD *thd, Security_context *backup)
{
DBUG_ENTER("Event_timed::change_security_context");
DBUG_ENTER("Event_timed::restore_security_context");
#ifndef NO_EMBEDDED_ACCESS_CHECKS
if (backup)
thd->security_ctx= backup;
......@@ -1490,7 +1496,6 @@ Event_timed::spawn_thread_finish(THD *thd)
0 - ok
1 - not locked by this thread
*/
int
Event_timed::spawn_unlock(THD *thd)
......
......@@ -1931,9 +1931,10 @@ class Item_int_with_ref :public Item_int
{
Item *ref;
public:
Item_int_with_ref(longlong i, Item *ref_arg) :Item_int(i), ref(ref_arg)
Item_int_with_ref(longlong i, Item *ref_arg, my_bool unsigned_arg) :
Item_int(i), ref(ref_arg)
{
unsigned_flag= ref_arg->unsigned_flag;
unsigned_flag= unsigned_arg;
}
int save_in_field(Field *field, bool no_conversions)
{
......
......@@ -216,7 +216,8 @@ static bool convert_constant_item(THD *thd, Field *field, Item **item)
field->table->in_use->variables.sql_mode|= MODE_INVALID_DATES;
if (!(*item)->save_in_field(field, 1) && !((*item)->null_value))
{
Item *tmp=new Item_int_with_ref(field->val_int(), *item);
Item *tmp=new Item_int_with_ref(field->val_int(), *item,
test(field->flags & UNSIGNED_FLAG));
field->table->in_use->variables.sql_mode= orig_sql_mode;
if (tmp)
thd->change_item_tree(item, tmp);
......
......@@ -92,6 +92,15 @@ char* query_table_status(THD *thd,const char *db,const char *table_name);
#define PREV_BITS(type,A) ((type) (((type) 1 << (A)) -1))
#define all_bits_set(A,B) ((A) & (B) != (B))
#define WARN_DEPRECATED(Thd,Ver,Old,New) \
do { \
DBUG_ASSERT(strncmp(Ver, MYSQL_SERVER_VERSION, sizeof(Ver)-1) >= 0); \
push_warning_printf(((THD *)Thd), MYSQL_ERROR::WARN_LEVEL_WARN, \
ER_WARN_DEPRECATED, ER(ER_WARN_DEPRECATED), \
(Old), (Ver), (New)); \
} while(0)
extern CHARSET_INFO *system_charset_info, *files_charset_info ;
extern CHARSET_INFO *national_charset_info, *table_alias_charset;
......
......@@ -13,10 +13,6 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
/**
* An enum and a struct to handle partitioning and subpartitioning.
......@@ -55,7 +51,7 @@ public:
handlerton *engine_type;
enum partition_state part_state;
uint16 nodegroup_id;
partition_element()
: part_max_rows(0), part_min_rows(0), partition_name(NULL),
tablespace_name(NULL), range_value(0), part_comment(NULL),
......
......@@ -16,6 +16,10 @@
/* Some general useful functions */
#ifdef USE_PRAGMA_IMPLEMENTATION
#pragma implementation
#endif
#include "mysql_priv.h"
#include "ha_partition.h"
......
......@@ -13,7 +13,7 @@
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#ifdef USE_PRAGMA_INTERFACE
#pragma interface /* gcc class implementation */
#endif
......@@ -223,55 +223,31 @@ public:
subpart_field_list.empty();
}
~partition_info() {}
bool is_sub_partitioned();
uint get_tot_partitions();
bool set_up_defaults_for_partitioning(handler *file, ulonglong max_rows,
/* Answers the question if subpartitioning is used for a certain table */
bool is_sub_partitioned()
{
return (subpart_type == NOT_A_PARTITION ? FALSE : TRUE);
}
/* Returns the total number of partitions on the leaf level */
uint get_tot_partitions()
{
return no_parts * (is_sub_partitioned() ? no_subparts : 1);
}
bool set_up_defaults_for_partitioning(handler *file, ulonglong max_rows,
uint start_no);
char *has_unique_names();
private:
bool set_up_default_partitions(handler *file, ulonglong max_rows,
uint start_no);
bool set_up_default_subpartitions(handler *file, ulonglong max_rows);
char *create_default_partition_names(uint part_no, uint no_parts,
char *create_default_partition_names(uint part_no, uint no_parts,
uint start_no, bool is_subpart);
bool has_unique_name(partition_element *element);
bool has_unique_name(partition_element *element);
};
/*
Answers the question if subpartitioning is used for a certain table
SYNOPSIS
is_sub_partitioned()
part_info A reference to the partition_info struct
RETURN VALUE
Returns true if subpartitioning used and false otherwise
DESCRIPTION
A routine to check for subpartitioning for improved readability of code
*/
inline
bool partition_info::is_sub_partitioned()
{
return (subpart_type == NOT_A_PARTITION ? FALSE : TRUE);
}
/*
Returns the total number of partitions on the leaf level.
SYNOPSIS
get_tot_partitions()
part_info A reference to the partition_info struct
RETURN VALUE
Returns the number of partitions
DESCRIPTION
A routine to check for number of partitions for improved readability
of code
*/
inline
uint partition_info::get_tot_partitions()
{
return no_parts * (is_sub_partitioned() ? no_subparts : 1);
}
uint32 get_next_partition_id_range(struct st_partition_iter* part_iter);
/* Initialize the iterator to return a single partition with given part_id */
......
......@@ -2775,7 +2775,7 @@ static bool set_log_update(THD *thd, set_var *var)
See sql/mysqld.cc/, comments in function init_server_components() for an
explaination of the different warnings we send below
*/
if (opt_sql_bin_update)
{
((sys_var_thd_bit*) var->var)->bit_flag|= (OPTION_BIN_LOG |
......@@ -3256,10 +3256,7 @@ bool sys_var_thd_storage_engine::update(THD *thd, set_var *var)
void sys_var_thd_table_type::warn_deprecated(THD *thd)
{
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_DEPRECATED_SYNTAX,
ER(ER_WARN_DEPRECATED_SYNTAX), "table_type",
"storage_engine");
WARN_DEPRECATED(thd, "5.2", "table_type", "'storage_engine'");
}
void sys_var_thd_table_type::set_default(THD *thd, enum_var_type type)
......@@ -3516,10 +3513,8 @@ bool process_key_caches(int (* func) (const char *name, KEY_CACHE *))
void sys_var_trust_routine_creators::warn_deprecated(THD *thd)
{
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_DEPRECATED_SYNTAX,
ER(ER_WARN_DEPRECATED_SYNTAX), "log_bin_trust_routine_creators",
"log_bin_trust_function_creators");
WARN_DEPRECATED(thd, "5.2", "log_bin_trust_routine_creators",
"'log_bin_trust_function_creators'");
}
void sys_var_trust_routine_creators::set_default(THD *thd, enum_var_type type)
......
......@@ -5018,7 +5018,7 @@ ER_UNKNOWN_STORAGE_ENGINE 42000
ger "Unbekannte Speicher-Engine '%s'"
por "Motor de tabela desconhecido '%s'"
spa "Desconocido motor de tabla '%s'"
ER_WARN_DEPRECATED_SYNTAX
ER_UNUSED_1
eng "'%s' is deprecated; use '%s' instead"
ger "'%s' ist veraltet. Bitte benutzen Sie '%s'"
por "'%s' desatualizado. Use '%s' em seu lugar"
......@@ -5810,8 +5810,8 @@ ER_ILLEGAL_HA_CREATE_OPTION
eng "Table storage engine '%-.64s' does not support the create option '%.64s'"
ER_CANT_CHANGE_TX_ISOLATION 25001
eng "Transaction isolation level can't be changed while a transaction is in progress"
ER_WARN_DEPRECATED_STATEMENT
eng "The '%s' statement is deprecated and will be removed in MySQL %s. Please use client programs (e.g. %s) instead."
ER_WARN_DEPRECATED
eng "The syntax '%s' is deprecated and will be removed in MySQL %s. Please use %s instead."
ER_SP_NO_AGGREGATE 42000
eng "AGGREGATE is not supported for stored functions"
ER_TEMP_TABLE_PREVENTS_SWITCH_OUT_OF_RBR
......
......@@ -1413,6 +1413,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
sp_rcontext *save_spcont, *octx;
sp_rcontext *nctx = NULL;
bool save_enable_slow_log= false;
bool save_log_general= false;
DBUG_ENTER("sp_head::execute_procedure");
DBUG_PRINT("info", ("procedure %s", m_name.str));
......@@ -1511,20 +1512,28 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
DBUG_PRINT("info",(" %.*s: eval args done", m_name.length, m_name.str));
}
if (thd->enable_slow_log && !(m_flags & LOG_SLOW_STATEMENTS))
if (!(m_flags & LOG_SLOW_STATEMENTS) && thd->enable_slow_log)
{
DBUG_PRINT("info", ("Disabling slow log for the execution"));
save_enable_slow_log= thd->enable_slow_log;
save_enable_slow_log= true;
thd->enable_slow_log= FALSE;
}
if (!(m_flags & LOG_GENERAL_LOG) && !(thd->options & OPTION_LOG_OFF))
{
DBUG_PRINT("info", ("Disabling general log for the execution"));
save_log_general= true;
/* disable this bit */
thd->options |= OPTION_LOG_OFF;
}
thd->spcont= nctx;
if (!err_status)
err_status= execute(thd);
if (save_enable_slow_log && !(m_flags & LOG_SLOW_STATEMENTS))
thd->enable_slow_log= save_enable_slow_log;
if (save_log_general)
thd->options &= ~OPTION_LOG_OFF;
if (save_enable_slow_log)
thd->enable_slow_log= true;
/*
In the case when we weren't able to employ reuse mechanism for
OUT/INOUT paranmeters, we should reallocate memory. This
......@@ -2303,6 +2312,9 @@ sp_instr_stmt::execute(THD *thd, uint *nextp)
(the order of query cache and subst_spvars calls is irrelevant because
queries with SP vars can't be cached)
*/
if (unlikely((thd->options & OPTION_LOG_OFF)==0))
general_log_print(thd, COM_QUERY, "%s", thd->query);
if (query_cache_send_result_to_client(thd,
thd->query, thd->query_length) <= 0)
{
......
......@@ -125,7 +125,8 @@ public:
HAS_SET_AUTOCOMMIT_STMT= 64,// Is set if a procedure with 'set autocommit'
/* Is set if a procedure with COMMIT (implicit or explicit) | ROLLBACK */
HAS_COMMIT_OR_ROLLBACK= 128,
LOG_SLOW_STATEMENTS= 256
LOG_SLOW_STATEMENTS= 256, // Used by events
LOG_GENERAL_LOG= 512 // Used by events
};
/* TYPE_ENUM_FUNCTION, TYPE_ENUM_PROCEDURE or TYPE_ENUM_TRIGGER */
......
......@@ -5921,10 +5921,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
*/
char buf[32];
my_snprintf(buf, sizeof(buf), "TIMESTAMP(%s)", length);
push_warning_printf(thd,MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_DEPRECATED_SYNTAX,
ER(ER_WARN_DEPRECATED_SYNTAX),
buf, "TIMESTAMP");
WARN_DEPRECATED(thd, "5.2", buf, "'TIMESTAMP'");
}
if (!(new_field= new create_field()) ||
......
......@@ -3630,11 +3630,13 @@ bool mysql_unpack_partition(THD *thd, const uchar *part_buf,
Item *thd_free_list= thd->free_list;
bool result= TRUE;
partition_info *part_info;
CHARSET_INFO *old_character_set_client= thd->variables.character_set_client;
LEX *old_lex= thd->lex;
LEX lex;
DBUG_ENTER("mysql_unpack_partition");
thd->lex= &lex;
thd->variables.character_set_client= system_charset_info;
lex_start(thd, part_buf, part_info_len);
/*
We need to use the current SELECT_LEX since I need to keep the
......@@ -3760,6 +3762,7 @@ bool mysql_unpack_partition(THD *thd, const uchar *part_buf,
end:
thd->free_list= thd_free_list;
thd->lex= old_lex;
thd->variables.character_set_client= old_character_set_client;
DBUG_RETURN(result);
}
......
......@@ -48,12 +48,7 @@ const LEX_STRING null_lex_str={0,0};
#define yyoverflow(A,B,C,D,E,F) {ulong val= *(F); if (my_yyoverflow((B), (D), &val)) { yyerror((char*) (A)); return 2; } else { *(F)= (YYSIZE_T)val; }}
#define WARN_DEPRECATED(A,B) \
push_warning_printf(((THD *)yythd), MYSQL_ERROR::WARN_LEVEL_WARN, \
ER_WARN_DEPRECATED_SYNTAX, \
ER(ER_WARN_DEPRECATED_SYNTAX), (A), (B));
#define YYERROR_UNLESS(A) \
#define YYERROR_UNLESS(A) \
if (!(A)) \
{ \
yyerror(ER(ER_SYNTAX_ERROR)); \
......@@ -4009,6 +4004,13 @@ create_table_options:
create_table_option:
ENGINE_SYM opt_equal storage_engines { Lex->create_info.db_type= $3; Lex->create_info.used_fields|= HA_CREATE_USED_ENGINE; }
| TYPE_SYM opt_equal storage_engines
{
Lex->create_info.db_type= $3;
WARN_DEPRECATED(yythd, "5.2", "TYPE=storage_engine",
"'ENGINE=storage_engine'");
Lex->create_info.used_fields|= HA_CREATE_USED_ENGINE;
}
| MAX_ROWS opt_equal ulonglong_num { Lex->create_info.max_rows= $3; Lex->create_info.used_fields|= HA_CREATE_USED_MAX_ROWS;}
| MIN_ROWS opt_equal ulonglong_num { Lex->create_info.min_rows= $3; Lex->create_info.used_fields|= HA_CREATE_USED_MIN_ROWS;}
| AVG_ROW_LENGTH opt_equal ulong_num { Lex->create_info.avg_row_length=$3; Lex->create_info.used_fields|= HA_CREATE_USED_AVG_ROW_LENGTH;}
......@@ -5365,11 +5367,8 @@ restore:
RESTORE_SYM table_or_tables
{
Lex->sql_command = SQLCOM_RESTORE_TABLE;
push_warning_printf(((THD *)yythd), MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_DEPRECATED_STATEMENT,
ER(ER_WARN_DEPRECATED_STATEMENT),
"RESTORE TABLE", "5.2",
"mysqldump, mysql, MySQL Administrator");
WARN_DEPRECATED(yythd, "5.2", "RESTORE TABLE",
"MySQL Administrator (mysqldump, mysql)");
}
table_list FROM TEXT_STRING_sys
{
......@@ -5380,11 +5379,8 @@ backup:
BACKUP_SYM table_or_tables
{
Lex->sql_command = SQLCOM_BACKUP_TABLE;
push_warning_printf(((THD *)yythd), MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_DEPRECATED_STATEMENT,
ER(ER_WARN_DEPRECATED_STATEMENT),
"BACKUP TABLE", "5.2",
"mysqldump, mysql, MySQL Administrator");
WARN_DEPRECATED(yythd, "5.2", "BACKUP TABLE",
"MySQL Administrator (mysqldump, mysql)");
}
table_list TO_SYM TEXT_STRING_sys
{
......@@ -8227,7 +8223,7 @@ show_param:
{
LEX *lex=Lex;
lex->sql_command= SQLCOM_SHOW_STORAGE_ENGINES;
WARN_DEPRECATED("SHOW TABLE TYPES", "SHOW [STORAGE] ENGINES");
WARN_DEPRECATED(yythd, "5.2", "SHOW TABLE TYPES", "'SHOW [STORAGE] ENGINES'");
}
| opt_storage ENGINES_SYM
{
......@@ -8263,7 +8259,7 @@ show_param:
lex->option_type= $1;
if (prepare_schema_table(YYTHD, lex, 0, SCH_STATUS))
YYABORT;
}
}
| INNOBASE_SYM STATUS_SYM
{
LEX *lex= Lex;
......@@ -8274,19 +8270,19 @@ show_param:
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), "InnoDB");
YYABORT;
}
WARN_DEPRECATED("SHOW INNODB STATUS", "SHOW ENGINE INNODB STATUS");
WARN_DEPRECATED(yythd, "5.2", "SHOW INNODB STATUS", "'SHOW ENGINE INNODB STATUS'");
}
| MUTEX_SYM STATUS_SYM
{
LEX *lex= Lex;
lex->sql_command = SQLCOM_SHOW_ENGINE_MUTEX;
lex->sql_command = SQLCOM_SHOW_ENGINE_MUTEX;
if (!(lex->create_info.db_type=
ha_resolve_by_legacy_type(YYTHD, DB_TYPE_INNODB)))
{
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), "InnoDB");
YYABORT;
}
WARN_DEPRECATED("SHOW MUTEX STATUS", "SHOW ENGINE INNODB MUTEX");
WARN_DEPRECATED(yythd, "5.2", "SHOW MUTEX STATUS", "'SHOW ENGINE INNODB MUTEX'");
}
| opt_full PROCESSLIST_SYM
{ Lex->sql_command= SQLCOM_SHOW_PROCESSLIST;}
......@@ -8325,7 +8321,7 @@ show_param:
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), "BerkeleyDB");
YYABORT;
}
WARN_DEPRECATED("SHOW BDB LOGS", "SHOW ENGINE BDB LOGS");
WARN_DEPRECATED(yythd, "5.2", "SHOW BDB LOGS", "'SHOW ENGINE BDB LOGS'");
}
| LOGS_SYM
{
......@@ -8337,7 +8333,7 @@ show_param:
my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), "BerkeleyDB");
YYABORT;
}
WARN_DEPRECATED("SHOW LOGS", "SHOW ENGINE BDB LOGS");
WARN_DEPRECATED(yythd, "5.2", "SHOW LOGS", "'SHOW ENGINE BDB LOGS'");
}
| GRANTS
{
......@@ -8691,11 +8687,8 @@ load: LOAD DATA_SYM
LOAD TABLE_SYM table_ident FROM MASTER_SYM
{
LEX *lex=Lex;
push_warning_printf(((THD *)yythd), MYSQL_ERROR::WARN_LEVEL_WARN,
ER_WARN_DEPRECATED_STATEMENT,
ER(ER_WARN_DEPRECATED_STATEMENT),
"LOAD TABLE FROM MASTER", "5.2",
"mysqldump, mysql, MySQL Administrator");
WARN_DEPRECATED(yythd, "5.2", "LOAD TABLE FROM MASTER",
"MySQL Administrator (mysqldump, mysql)");
if (lex->sphead)
{
my_error(ER_SP_BADSTATEMENT, MYF(0), "LOAD TABLE");
......
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