Commit 6b79cd5c authored by monty@narttu.mysql.fi's avatar monty@narttu.mysql.fi

Merge

parents dde384d9 085b1c56
...@@ -420,6 +420,7 @@ libmysqld/sql_unions.cc ...@@ -420,6 +420,7 @@ libmysqld/sql_unions.cc
libmysqld/sql_update.cc libmysqld/sql_update.cc
libmysqld/sql_yacc.cc libmysqld/sql_yacc.cc
libmysqld/stacktrace.c libmysqld/stacktrace.c
libmysqld/strfunc.cc
libmysqld/table.cc libmysqld/table.cc
libmysqld/thr_malloc.cc libmysqld/thr_malloc.cc
libmysqld/time.cc libmysqld/time.cc
......
...@@ -14,6 +14,7 @@ extra_configs="$extra_configs --with-berkeley-db --with-innodb --without-isam -- ...@@ -14,6 +14,7 @@ extra_configs="$extra_configs --with-berkeley-db --with-innodb --without-isam --
if test -z "$just_print" if test -z "$just_print"
then then
set +v
echo "\ echo "\
****************************************************************************** ******************************************************************************
Note that by default BUILD/compile-pentium-valgrind-max calls 'configure' with Note that by default BUILD/compile-pentium-valgrind-max calls 'configure' with
......
...@@ -446,6 +446,10 @@ SOURCE=..\strings\strcont.c ...@@ -446,6 +446,10 @@ SOURCE=..\strings\strcont.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\sql\strfunc.cpp
# End Source File
# Begin Source File
SOURCE=..\strings\strinstr.c SOURCE=..\strings\strinstr.c
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -1253,6 +1253,26 @@ SOURCE=.\sql_yacc.cpp ...@@ -1253,6 +1253,26 @@ SOURCE=.\sql_yacc.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\strfunc.cpp
!IF "$(CFG)" == "mysqld - Win32 Release"
!ELSEIF "$(CFG)" == "mysqld - Win32 Debug"
# ADD CPP /G5
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "mysqld - Win32 nt"
!ELSEIF "$(CFG)" == "mysqld - Win32 Max nt"
!ELSEIF "$(CFG)" == "mysqld - Win32 Max"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\table.cpp SOURCE=.\table.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -945,6 +945,22 @@ SOURCE=.\sql_yacc.cpp ...@@ -945,6 +945,22 @@ SOURCE=.\sql_yacc.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\strfunc.cpp
!IF "$(CFG)" == "mysqldmax - Win32 Release"
!ELSEIF "$(CFG)" == "mysqldmax - Win32 Debug"
# ADD CPP /G5
# SUBTRACT CPP /YX /Yc /Yu
!ELSEIF "$(CFG)" == "mysqldmax - Win32 nt"
!ENDIF
# End Source File
# Begin Source File
SOURCE=.\table.cpp SOURCE=.\table.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -188,6 +188,10 @@ SOURCE=.\longlong2str.c ...@@ -188,6 +188,10 @@ SOURCE=.\longlong2str.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\my_strtoll10.c
# End Source File
# Begin Source File
SOURCE=.\my_vsnprintf.c SOURCE=.\my_vsnprintf.c
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -86,7 +86,7 @@ enum my_lex_states ...@@ -86,7 +86,7 @@ enum my_lex_states
{ {
MY_LEX_START, MY_LEX_CHAR, MY_LEX_IDENT, MY_LEX_START, MY_LEX_CHAR, MY_LEX_IDENT,
MY_LEX_IDENT_SEP, MY_LEX_IDENT_START, MY_LEX_IDENT_SEP, MY_LEX_IDENT_START,
MY_LEX_FOUND_IDENT, MY_LEX_REAL, MY_LEX_HEX_NUMBER, MY_LEX_REAL, MY_LEX_HEX_NUMBER,
MY_LEX_CMP_OP, MY_LEX_LONG_CMP_OP, MY_LEX_STRING, MY_LEX_COMMENT, MY_LEX_END, MY_LEX_CMP_OP, MY_LEX_LONG_CMP_OP, MY_LEX_STRING, MY_LEX_COMMENT, MY_LEX_END,
MY_LEX_OPERATOR_OR_IDENT, MY_LEX_NUMBER_IDENT, MY_LEX_INT_OR_REAL, MY_LEX_OPERATOR_OR_IDENT, MY_LEX_NUMBER_IDENT, MY_LEX_INT_OR_REAL,
MY_LEX_REAL_OR_POINT, MY_LEX_BOOL, MY_LEX_EOL, MY_LEX_ESCAPE, MY_LEX_REAL_OR_POINT, MY_LEX_BOOL, MY_LEX_EOL, MY_LEX_ESCAPE,
......
...@@ -232,6 +232,7 @@ extern char *int2str(long val,char *dst,int radix); ...@@ -232,6 +232,7 @@ extern char *int2str(long val,char *dst,int radix);
extern char *int10_to_str(long val,char *dst,int radix); extern char *int10_to_str(long val,char *dst,int radix);
extern char *str2int(const char *src,int radix,long lower,long upper, extern char *str2int(const char *src,int radix,long lower,long upper,
long *val); long *val);
longlong my_strtoll10(const char *nptr, char **endptr, int *error);
#if SIZEOF_LONG == SIZEOF_LONG_LONG #if SIZEOF_LONG == SIZEOF_LONG_LONG
#define longlong2str(A,B,C) int2str((A),(B),(C)) #define longlong2str(A,B,C) int2str((A),(B),(C))
#define longlong10_to_str(A,B,C) int10_to_str((A),(B),(C)) #define longlong10_to_str(A,B,C) int10_to_str((A),(B),(C))
......
...@@ -669,8 +669,6 @@ extern pthread_t shutdown_th, main_th, signal_th; ...@@ -669,8 +669,6 @@ extern pthread_t shutdown_th, main_th, signal_th;
#define thread_safe_increment(V,L) atomic_add(1,(atomic_t*) &V); #define thread_safe_increment(V,L) atomic_add(1,(atomic_t*) &V);
#define thread_safe_add(V,C,L) atomic_add((C),(atomic_t*) &V); #define thread_safe_add(V,C,L) atomic_add((C),(atomic_t*) &V);
#define thread_safe_sub(V,C,L) atomic_sub((C),(atomic_t*) &V); #define thread_safe_sub(V,C,L) atomic_sub((C),(atomic_t*) &V);
#define statistic_increment(V,L) thread_safe_increment((V),(L))
#define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
#else #else
#define thread_safe_increment(V,L) \ #define thread_safe_increment(V,L) \
pthread_mutex_lock((L)); (V)++; pthread_mutex_unlock((L)); pthread_mutex_lock((L)); (V)++; pthread_mutex_unlock((L));
...@@ -678,6 +676,7 @@ extern pthread_t shutdown_th, main_th, signal_th; ...@@ -678,6 +676,7 @@ extern pthread_t shutdown_th, main_th, signal_th;
pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L)); pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L));
#define thread_safe_sub(V,C,L) \ #define thread_safe_sub(V,C,L) \
pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L)); pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L));
#endif /* HAVE_ATOMIC_ADD */
#ifdef SAFE_STATISTICS #ifdef SAFE_STATISTICS
#define statistic_increment(V,L) thread_safe_increment((V),(L)) #define statistic_increment(V,L) thread_safe_increment((V),(L))
#define statistic_add(V,C,L) thread_safe_add((V),(C),(L)) #define statistic_add(V,C,L) thread_safe_add((V),(C),(L))
...@@ -685,7 +684,6 @@ extern pthread_t shutdown_th, main_th, signal_th; ...@@ -685,7 +684,6 @@ extern pthread_t shutdown_th, main_th, signal_th;
#define statistic_increment(V,L) (V)++ #define statistic_increment(V,L) (V)++
#define statistic_add(V,C,L) (V)+=(C) #define statistic_add(V,C,L) (V)+=(C)
#endif /* SAFE_STATISTICS */ #endif /* SAFE_STATISTICS */
#endif /* HAVE_ATOMIC_ADD */
#endif /* thread_safe_increment */ #endif /* thread_safe_increment */
#ifdef __cplusplus #ifdef __cplusplus
......
...@@ -295,7 +295,12 @@ ...@@ -295,7 +295,12 @@
#define ER_BAD_SLAVE_UNTIL_COND 1276 #define ER_BAD_SLAVE_UNTIL_COND 1276
#define ER_MISSING_SKIP_SLAVE 1277 #define ER_MISSING_SKIP_SLAVE 1277
#define ER_UNTIL_COND_IGNORED 1278 #define ER_UNTIL_COND_IGNORED 1278
#define ER_WRONG_INDEX_NAME 1279 #define ER_WRONG_NAME 1279
#define ER_WARN_QC_RESIZE 1280 #define ER_TABLE 1280
#define ER_BAD_FT_COLUMN 1281 #define ER_DATABASE 1281
#define ER_ERROR_MESSAGES 282 #define ER_COLUMN 1282
#define ER_INDEX 1283
#define ER_CATALOG 1284
#define ER_WARN_QC_RESIZE 1285
#define ER_BAD_FT_COLUMN 1286
#define ER_ERROR_MESSAGES 287
...@@ -159,4 +159,4 @@ ER_WARN_TOO_MANY_RECORDS, "01000", "", ...@@ -159,4 +159,4 @@ ER_WARN_TOO_MANY_RECORDS, "01000", "",
ER_WARN_NULL_TO_NOTNULL, "01000", "", ER_WARN_NULL_TO_NOTNULL, "01000", "",
ER_WARN_DATA_OUT_OF_RANGE, "01000", "", ER_WARN_DATA_OUT_OF_RANGE, "01000", "",
ER_WARN_DATA_TRUNCATED, "01000", "", ER_WARN_DATA_TRUNCATED, "01000", "",
ER_WRONG_INDEX_NAME, "42000", "", ER_WRONG_NAME, "42000", "",
...@@ -38,7 +38,7 @@ libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c ...@@ -38,7 +38,7 @@ libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c
noinst_HEADERS = embedded_priv.h noinst_HEADERS = embedded_priv.h
sqlsources = derror.cc field.cc field_conv.cc filesort.cc \ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
ha_innodb.cc ha_berkeley.cc ha_heap.cc ha_isam.cc ha_isammrg.cc \ ha_innodb.cc ha_berkeley.cc ha_heap.cc ha_isam.cc ha_isammrg.cc \
ha_myisam.cc ha_myisammrg.cc handler.cc sql_handler.cc \ ha_myisam.cc ha_myisammrg.cc handler.cc sql_handler.cc \
hostname.cc init.cc password.c \ hostname.cc init.cc password.c \
......
...@@ -394,7 +394,7 @@ SLAVE_MYLOG="$MYSQL_TEST_DIR/var/log/slave.log" ...@@ -394,7 +394,7 @@ SLAVE_MYLOG="$MYSQL_TEST_DIR/var/log/slave.log"
SLAVE_MYERR="$MYSQL_TEST_DIR/var/log/slave.err" SLAVE_MYERR="$MYSQL_TEST_DIR/var/log/slave.err"
CURRENT_TEST="$MYSQL_TEST_DIR/var/log/current_test" CURRENT_TEST="$MYSQL_TEST_DIR/var/log/current_test"
SMALL_SERVER="-O key_buffer_size=1M -O sort_buffer=256K -O max_heap_table_size=1M" SMALL_SERVER="--key_buffer_size=1M --sort_buffer=256K --max_heap_table_size=1M"
export MASTER_MYPORT export MASTER_MYPORT
export SLAVE_MYPORT export SLAVE_MYPORT
...@@ -801,7 +801,7 @@ manager_launch() ...@@ -801,7 +801,7 @@ manager_launch()
fi fi
$MYSQL_MANAGER_CLIENT $MANAGER_QUIET_OPT --user=$MYSQL_MANAGER_USER \ $MYSQL_MANAGER_CLIENT $MANAGER_QUIET_OPT --user=$MYSQL_MANAGER_USER \
--password=$MYSQL_MANAGER_PW --port=$MYSQL_MANAGER_PORT <<EOF --password=$MYSQL_MANAGER_PW --port=$MYSQL_MANAGER_PORT <<EOF
def_exec $ident $@ def_exec $ident "$@"
set_exec_stdout $ident $CUR_MYERR set_exec_stdout $ident $CUR_MYERR
set_exec_stderr $ident $CUR_MYERR set_exec_stderr $ident $CUR_MYERR
set_exec_con $ident root localhost $CUR_MYSOCK set_exec_con $ident root localhost $CUR_MYSOCK
......
...@@ -219,6 +219,13 @@ a ...@@ -219,6 +219,13 @@ a
test test
drop table t1; drop table t1;
create table t1 (word varchar(255) not null, word2 varchar(255) not null, index(word)); create table t1 (word varchar(255) not null, word2 varchar(255) not null, index(word));
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`word` varchar(255) collate latin1_german2_ci NOT NULL default '',
`word2` varchar(255) collate latin1_german2_ci NOT NULL default '',
KEY `word` (`word`)
) TYPE=MyISAM CHARSET=latin1 COLLATE=latin1_german2_ci
insert into t1 (word) values ('ss'),(0xDF),(0xE4),('ae'); insert into t1 (word) values ('ss'),(0xDF),(0xE4),('ae');
update t1 set word2=word; update t1 set word2=word;
select word, word=binary 0xdf as t from t1 having t > 0; select word, word=binary 0xdf as t from t1 having t > 0;
...@@ -273,6 +280,11 @@ drop table t1; ...@@ -273,6 +280,11 @@ drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci
); );
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`s1` char(5) collate latin1_german2_ci default NULL
) TYPE=MyISAM CHARSET=latin1 COLLATE=latin1_german2_ci
INSERT INTO t1 VALUES (''); INSERT INTO t1 VALUES ('');
INSERT INTO t1 VALUES ('ue'); INSERT INTO t1 VALUES ('ue');
SELECT DISTINCT s1 FROM t1; SELECT DISTINCT s1 FROM t1;
......
SET CHARACTER SET koi8r; SET CHARACTER SET koi8r;
DROP TABLE IF EXISTS ; DROP TABLE IF EXISTS , t1;
SET CHARACTER SET koi8r; SET CHARACTER SET koi8r;
CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp1251) SELECT _koi8r'' AS a; CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp1251) SELECT _koi8r'' AS a;
SHOW CREATE TABLE t1; SHOW CREATE TABLE t1;
...@@ -14,7 +14,7 @@ SELECT HEX(a) FROM t1; ...@@ -14,7 +14,7 @@ SELECT HEX(a) FROM t1;
HEX(a) HEX(a)
EFF0EEE1E0 EFF0EEE1E0
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE CREATE TABLE ``
( (
CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT " " CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT " "
) COMMENT " "; ) COMMENT " ";
......
This diff is collapsed.
...@@ -65,6 +65,6 @@ NULL ...@@ -65,6 +65,6 @@ NULL
50000 50000
NULL NULL
Warnings: Warnings:
Error 1258 Z_DATA_ERROR: Input data was corrupted for zlib Error 1258 ZLIB: Input data was corrupted for zlib
Error 1255 Too big size of uncompressed data. The maximum size is 1048576. (probably, length of uncompressed data was corrupted) Error 1255 Too big size of uncompressed data. The maximum size is 1048576. (probably, length of uncompressed data was corrupted)
drop table t1; drop table t1;
...@@ -74,3 +74,4 @@ f ...@@ -74,3 +74,4 @@ f
5 5
7 7
drop table t1,t2; drop table t1,t2;
create temporary table t3 (f int);
...@@ -40,9 +40,9 @@ create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null ...@@ -40,9 +40,9 @@ create table t1 (ordid int(8) not null auto_increment, ord varchar(50) not null
-- error 1044,1 -- error 1044,1
create table not_existing_database.test (a int); create table not_existing_database.test (a int);
--error 1103 --error 1279
create table `a/a` (a int); create table `a/a` (a int);
--error 1103 --error 1279
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int); create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int);
--error 1059 --error 1059
create table a (`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` int); create table a (`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` int);
...@@ -66,11 +66,11 @@ create table test_$1.test2$ (a int); ...@@ -66,11 +66,11 @@ create table test_$1.test2$ (a int);
drop table test_$1.test2$; drop table test_$1.test2$;
drop database test_$1; drop database test_$1;
--error 1103 --error 1279
create table `` (a int); create table `` (a int);
--error 1103 --error 1279
drop table if exists ``; drop table if exists ``;
--error 1166 --error 1279
create table t1 (`` int); create table t1 (`` int);
--error 1279 --error 1279
create table t1 (i int, index `` (i)); create table t1 (i int, index `` (i));
...@@ -254,12 +254,16 @@ create table t2 like t3; ...@@ -254,12 +254,16 @@ create table t2 like t3;
show create table t2; show create table t2;
select * from t2; select * from t2;
create table t3 like t1; create table t3 like t1;
!$1050 create table t3 like test_$1.t3; --error 1050
create table t3 like test_$1.t3;
--error 1044,1 --error 1044,1
create table non_existing_database.t1 like t1; create table non_existing_database.t1 like t1;
!$1051 create table t3 like non_existing_table; --error 1051
!$1050 create temporary table t3 like t1; create table t3 like non_existing_table;
!$1103 create table t3 like `a/a`; --error 1050
create temporary table t3 like t1;
--error 1279
create table t3 like `a/a`;
drop table t1, t2, t3; drop table t1, t2, t3;
drop table t3; drop table t3;
drop database test_$1; drop database test_$1;
......
...@@ -64,6 +64,7 @@ drop table t1; ...@@ -64,6 +64,7 @@ drop table t1;
# The below checks both binary and character comparisons. # The below checks both binary and character comparisons.
# #
create table t1 (word varchar(255) not null, word2 varchar(255) not null, index(word)); create table t1 (word varchar(255) not null, word2 varchar(255) not null, index(word));
show create table t1;
insert into t1 (word) values ('ss'),(0xDF),(0xE4),('ae'); insert into t1 (word) values ('ss'),(0xDF),(0xE4),('ae');
update t1 set word2=word; update t1 set word2=word;
select word, word=binary 0xdf as t from t1 having t > 0; select word, word=binary 0xdf as t from t1 having t > 0;
...@@ -85,6 +86,7 @@ drop table t1; ...@@ -85,6 +86,7 @@ drop table t1;
CREATE TABLE t1 ( CREATE TABLE t1 (
s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci
); );
show create table t1;
INSERT INTO t1 VALUES (''); INSERT INTO t1 VALUES ('');
INSERT INTO t1 VALUES ('ue'); INSERT INTO t1 VALUES ('ue');
SELECT DISTINCT s1 FROM t1; SELECT DISTINCT s1 FROM t1;
......
SET CHARACTER SET koi8r; SET CHARACTER SET koi8r;
--disable_warnings --disable_warnings
DROP TABLE IF EXISTS ; DROP TABLE IF EXISTS , t1;
--enable_warnings --enable_warnings
SET CHARACTER SET koi8r; SET CHARACTER SET koi8r;
...@@ -11,7 +11,7 @@ SELECT a FROM t1; ...@@ -11,7 +11,7 @@ SELECT a FROM t1;
SELECT HEX(a) FROM t1; SELECT HEX(a) FROM t1;
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE CREATE TABLE ``
( (
CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT " " CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT " "
) COMMENT " "; ) COMMENT " ";
......
--date_format=%d.%m.%Y --time_format=%H.%i.%s --datetime_format=%Y/%d/%m-%H:%i:%s --date-format=%d.%m.%Y --time-format=%H.%i.%s
#
# Test of date format functions
#
--disable-warnings
drop table if exists t1;
--enable-warnings
SHOW GLOBAL VARIABLES LIKE "%_format%"; SHOW GLOBAL VARIABLES LIKE "%_format%";
SHOW SESSION VARIABLES LIKE "%_format%"; SHOW SESSION VARIABLES LIKE "%_format%";
SET date_format="%d.%m.%Y"; #
select CAST("01.01.2001" as DATE) as a; # Test setting a lot of different formats to see which formats are accepted and
SET datetime_format="%d.%m.%Y %H.%i.%s"; # which aren't
select CAST("01.01.2001 05.12.06" as DATETIME) as a; #
SET time_format="%H.%i.%s";
select CAST("05.12.06" as TIME) as a; SET time_format='%H%i%s';
SET time_format='%H:%i:%s.%f';
SET datetime_format="%d.%m.%Y %h:%i:%s %p"; SET time_format='%h-%i-%s.%f%p';
select CAST("01.01.2001 05:12:06AM" as DATETIME) as a; SET time_format='%h:%i:%s.%f %p';
select CAST("01.01.2001 05:12:06 PM" as DATETIME) as a; SET time_format='%h:%i:%s%p';
SET time_format="%h:%i:%s %p"; SET date_format='%Y%m%d';
select CAST("05:12:06 AM" as TIME) as a; SET date_format='%Y.%m.%d';
select CAST("05:12:06.1234PM" as TIME) as a; SET date_format='%d.%m.%Y';
SET date_format='%m-%d-%Y';
SET time_format="%h.%i.%s %p";
SET date_format='%d.%m.%y'; set datetime_format= '%Y%m%d%H%i%s';
SET datetime_format="%d.%m.%y %h.%i.%s %p"; set datetime_format= '%Y-%m-%d %H:%i:%s';
select CAST("12-12-06" as DATE) as a; set datetime_format= '%m-%d-%y %H:%i:%s.%f';
set datetime_format= '%d-%m-%Y %h:%i:%s%p';
select adddate("01.01.97 11.59.59.000001 PM", 10); set datetime_format= '%H:%i:%s %Y-%m-%d';
select datediff("31.12.97 11.59:59.000001 PM","01.01.98"); set datetime_format= '%H:%i:%s.%f %m-%d-%Y';
select weekofyear("31.11.97 11:59:59.000001 PM"); set datetime_format= '%h:%i:%s %p %Y-%m-%d';
select makedate(1997,1); set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
select addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002");
select maketime(23,11,12); SHOW SESSION VARIABLES LIKE "%format";
select timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM");
--error 1231
SET time_format="%H%i%s"; SET time_format='%h:%i:%s';
--error 1105 --error 1231
SET time_format="%h%i%s"; SET time_format='%H %i:%s';
--error 1105 --error 1231
SET time_format='%H::%i:%s';
--error 1231
SET time_format='%H:%i:%s%f';
--error 1231
SET time_format='%H:%i.%f:%s';
--error 1231
SET time_format='%H:%i:%s%p';
--error 1231
SET time_format='%h:%i:%s.%f %p %Y-%m-%d';
--error 1231
SET time_format='%H%i%s.%f';
--error 1231
SET time_format='%H:%i-%s.%f';
--error 1231
SET date_format='%d.%m.%d'; SET date_format='%d.%m.%d';
--error 1105 --error 1231
SET datetime_format="%d.%m.%y %h.%i.%s"; SET datetime_format='%h.%m.%y %d.%i.%s';
--error 1231
set datetime_format= '%H:%i:%s.%f %p %Y-%m-%d';
#
# Test GLOBAL values
set GLOBAL datetime_format= '%H:%i:%s %Y-%m-%d';
SET SESSION datetime_format=default;
select @@global.datetime_format, @@session.datetime_format;
SET GLOBAL datetime_format=default;
SET SESSION datetime_format=default;
select @@global.datetime_format, @@session.datetime_format;
SET GLOBAL date_format=default; SET GLOBAL date_format=default;
SHOW GLOBAL VARIABLES LIKE "date_format%";
SET GLOBAL time_format=default; SET GLOBAL time_format=default;
SHOW GLOBAL VARIABLES LIKE "time_format%";
SET GLOBAL datetime_format=default; SET GLOBAL datetime_format=default;
SHOW GLOBAL VARIABLES LIKE "datetime_format%";
SET date_format=default;
SHOW SESSION VARIABLES LIKE "date_format%";
SET time_format=default; SET time_format=default;
SHOW SESSION VARIABLES LIKE "time_format%"; SET date_format=default;
SET datetime_format=default; SET datetime_format=default;
SHOW SESSION VARIABLES LIKE "datetime_format%";
#
SET time_format='%i:%s:%H'; # The following tests will work only when we at some point will enable
select cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME); # dynamic changing of formats
#
SET GLOBAL date_format='%Y-%m-%d';
SET GLOBAL time_format='%H:%i:%s'; # SET date_format='%d.%m.%Y';
SET GLOBAL datetime_format='%Y-%m-%d %H:%i:%s'; # select CAST('01.01.2001' as DATE) as a;
SET date_format='%Y-%m-%d'; # SET datetime_format='%d.%m.%Y %H.%i.%s';
SET time_format='%H:%i:%s'; # select CAST('01.01.2001 05.12.06' as DATETIME) as a;
SET datetime_format='%Y-%m-%d %H:%i:%s'; # SET time_format='%H.%i.%s';
# select CAST('05.12.06' as TIME) as a;
select str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S"); #
select str_to_date("15 September 2001", "%d %M %Y"); # SET datetime_format='%d.%m.%Y %h:%i:%s %p';
select str_to_date("15 Septembeb 2001", "%d %M %Y"); # select CAST('01.01.2001 05:12:06AM' as DATETIME) as a;
select str_to_date("15 MAY 2001", "%d %b %Y"); # select CAST('01.01.2001 05:12:06 PM' as DATETIME) as a;
select str_to_date("Sunday 15 MAY 2001", "%W %d %b %Y"); #
select str_to_date("Sundai 15 MAY 2001", "%W %d %b %Y"); # SET time_format='%h:%i:%s %p';
select str_to_date("Sundai 15 MA", "%W %d %b %Y"); # select CAST('05:12:06 AM' as TIME) as a;
select str_to_date("Tuesday 52 2001", "%W %V %X"); # select CAST('05:12:06.1234PM' as TIME) as a;
select str_to_date("Sunday 01 2001", "%W %V %X"); #
select str_to_date("Tuesday 00 2002", "%W %U %Y"); # SET time_format='%h.%i.%s %p';
select str_to_date("Thursday 53 1998", "%W %u %Y"); # SET date_format='%d.%m.%y';
select str_to_date("15-01-2001", "%d-%m-%Y %H:%i:%S"); # SET datetime_format='%d.%m.%y %h.%i.%s %p';
select str_to_date("15-01-20", "%d-%m-%Y"); # select CAST('12-12-06' as DATE) as a;
select str_to_date("15-2001-1", "%d-%Y-%c"); #
# select adddate('01.01.97 11.59.59.000001 PM', 10);
# select datediff('31.12.97 11.59:59.000001 PM','01.01.98');
# select weekofyear('31.11.97 11:59:59.000001 PM');
# select makedate(1997,1);
# select addtime('31.12.97 11.59.59.999999 PM', '1 1.1.1.000002');
# select maketime(23,11,12);
# select timediff('01.01.97 11:59:59.000001 PM','31.12.95 11:59:59.000002 PM');
#
# SET time_format='%i:%s:%H';
# select cast(str_to_date('15-01-2001 12:59:59', '%d-%m-%Y %H:%i:%S') as TIME);
#
# Test of str_to_date
#
select str_to_date(concat('15-01-2001',' 2:59:58.999'),
concat('%d-%m-%Y',' ','%H:%i:%s.%f'));
create table t1 (date char(30), format char(30) not null);
insert into t1 values
('2003-01-02 10:11:12', '%Y-%m-%d %H:%i:%S'),
('03-01-02 8:11:2.123456', '%y-%m-%d %H:%i:%S'),
('2003-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p'),
('2003-01-02 01:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f%p'),
('2003-01-02 02:11:12.12345AM', '%Y-%m-%d %h:%i:%S.%f %p'),
('2003-01-02 12:11:12.12345 am', '%Y-%m-%d %h:%i:%S.%f%p'),
('2003-01-02 11:11:12Pm', '%Y-%m-%d %h:%i:%S%p'),
('10:20:10', '%H:%i:%s'),
('10:20:10', '%h:%i:%s.%f'),
('10:20:10AM', '%h:%i:%s%p'),
('10:20:10.44AM', '%h:%i:%s.%f%p'),
('15-01-2001 12:59:58', '%d-%m-%Y %H:%i:%S'),
('15 September 2001', '%d %M %Y'),
('15 SEPTEMB 2001', '%d %M %Y'),
('15 MAY 2001', '%d %b %Y'),
('Sunday 15 MAY 2001', '%W %d %b %Y'),
('Sund 15 MAY 2001', '%W %d %b %Y'),
('Tuesday 00 2002', '%W %U %Y'),
('Thursday 53 1998', '%W %u %Y'),
('15-01-2001', '%d-%m-%Y %H:%i:%S'),
('15-01-20', '%d-%m-%y'),
('15-2001-1', '%d-%Y-%c');
# Use through protocol functions
select date,format,str_to_date(date, format) as str_to_date from t1;
# Use as a string
select date,format,concat('',str_to_date(date, format)) as con from t1;
# Use as datetime
select date,format,cast(str_to_date(date, format) as datetime) as datetime from t1;
select date,format,DATE(str_to_date(date, format)) as date2 from t1;
select date,format,TIME(str_to_date(date, format)) as time from t1;
select date,format,concat(TIME(str_to_date(date, format))) as time2 from t1;
# Test wrong dates
truncate table t1;
insert into t1 values
('2003-01-02 10:11:12 PM', '%Y-%m-%d %H:%i:%S %p'),
('2003-01-02 10:11:12.123456', '%Y-%m-%d %h:%i:%S %p'),
('2003-01-02 10:11:12AM', '%Y-%m-%d %h:%i:%S.%f %p'),
('2003-01-02 10:11:12AN', '%Y-%m-%d %h:%i:%S%p'),
('2003-01-02 10:11:12 PM', '%y-%m-%d %H:%i:%S %p'),
('10:20:10AM', '%H:%i:%s%p'),
('15 Septembei 2001', '%d %M %Y'),
('15 Ju 2001', '%d %M %Y'),
('Sund 15 MA', '%W %d %b %Y'),
('Sunday 01 2001', '%W %V %X'),
('Thursdai 12 1998', '%W %u %Y'),
(NULL, get_format(DATE,'USA')),
('Tuesday 52 2001', '%W %V %X');
select date,format,str_to_date(date, format) as str_to_date from t1;
select date,format,concat(str_to_date(date, format),'') as con from t1;
# Test 'maybe' date formats and 'strange but correct' results
truncate table t1;
insert into t1 values
('10:20:10AM', '%h:%i:%s'),
('2003-01-02 10:11:12', '%Y-%m-%d %h:%i:%S'),
('03-01-02 10:11:12 PM', '%Y-%m-%d %h:%i:%S %p');
select date,format,str_to_date(date, format) as str_to_date from t1;
select date,format,concat(str_to_date(date, format),'') as con from t1;
drop table t1;
#
# Test of get_format
#
select get_format(DATE, 'USA') as a; select get_format(DATE, 'USA') as a;
select get_format(TIME, 'internal') as a; select get_format(TIME, 'internal') as a;
select get_format(DATETIME, 'eur') as a; select get_format(DATETIME, 'eur') as a;
select get_format(DATE, 'TEST') as a;
select str_to_date('15-01-2001 12:59:59', GET_FORMAT(DATE,'USA'));
explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"),cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME), maketime(23,11,12),microsecond("1997-12-31 23:59:59.000001"); explain extended select makedate(1997,1), addtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),subtime("31.12.97 11.59.59.999999 PM", "1 1.1.1.000002"),timediff("01.01.97 11:59:59.000001 PM","31.12.95 11:59:59.000002 PM"),cast(str_to_date("15-01-2001 12:59:59", "%d-%m-%Y %H:%i:%S") as TIME), maketime(23,11,12),microsecond("1997-12-31 23:59:59.000001");
connect (con1,localhost,boo,,); connect (con1,localhost,boo,,);
connection con1; connection con1;
-- error 1064,1102 -- error 1064,1102,1279
drop database AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA; drop database AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;
...@@ -108,3 +108,11 @@ drop temporary table t3; ...@@ -108,3 +108,11 @@ drop temporary table t3;
select * from t2; select * from t2;
drop table t1,t2; drop table t1,t2;
# Create last a temporary table that is not dropped at end to ensure that we
# don't get any memory leaks for this
create temporary table t3 (f int);
sync_with_master;
# The server will now close done
...@@ -65,7 +65,7 @@ drop table t1; ...@@ -65,7 +65,7 @@ drop table t1;
# #
disable_query_log; disable_query_log;
--error 1103,1103 --error 1279,1279
create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="tmp"; create table t1 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam data directory="tmp";
# Check that we cannot link over a table from another database. # Check that we cannot link over a table from another database.
...@@ -75,7 +75,7 @@ create database mysqltest; ...@@ -75,7 +75,7 @@ create database mysqltest;
--error 1,1 --error 1,1
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="/this-dir-does-not-exist"; create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="/this-dir-does-not-exist";
--error 1103,1103 --error 1279,1279
create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="not-hard-path"; create table mysqltest.t9 (a int not null auto_increment, b char(16) not null, primary key (a)) type=myisam index directory="not-hard-path";
--error 1,1 --error 1,1
......
/* Copyright (C) 2000 MySQL AB /* Copyright (C) 2000-2003 MySQL AB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -214,6 +214,7 @@ int load_defaults(const char *conf_file, const char **groups, ...@@ -214,6 +214,7 @@ int load_defaults(const char *conf_file, const char **groups,
res= (char**) (ptr+sizeof(alloc)); res= (char**) (ptr+sizeof(alloc));
/* copy name + found arguments + command line arguments to new array */ /* copy name + found arguments + command line arguments to new array */
res[0]= argv[0][0]; /* Name MUST be set, even by embedded library */
memcpy((gptr) (res+1), args.buffer, args.elements*sizeof(char*)); memcpy((gptr) (res+1), args.buffer, args.elements*sizeof(char*));
/* Skipp --defaults-file and --defaults-extra-file */ /* Skipp --defaults-file and --defaults-extra-file */
(*argc)-= args_used; (*argc)-= args_used;
......
...@@ -63,7 +63,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \ ...@@ -63,7 +63,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \ item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \
thr_malloc.cc item_create.cc item_subselect.cc \ thr_malloc.cc item_create.cc item_subselect.cc \
item_row.cc item_geofunc.cc \ item_row.cc item_geofunc.cc \
field.cc key.cc sql_class.cc sql_list.cc \ field.cc strfunc.cc key.cc sql_class.cc sql_list.cc \
net_serv.cc protocol.cc sql_state.c \ net_serv.cc protocol.cc sql_state.c \
lock.cc my_lock.c \ lock.cc my_lock.c \
sql_string.cc sql_manager.cc sql_map.cc \ sql_string.cc sql_manager.cc sql_map.cc \
......
...@@ -117,7 +117,7 @@ Check that the above file is the right version for this program!", ...@@ -117,7 +117,7 @@ Check that the above file is the right version for this program!",
point[i]= *point +uint2korr(head+10+i+i); point[i]= *point +uint2korr(head+10+i+i);
} }
VOID(my_close(file,MYF(0))); VOID(my_close(file,MYF(0)));
DBUG_RETURN(FALSE); DBUG_RETURN(0);
err: err:
switch (funktpos) { switch (funktpos) {
...@@ -136,7 +136,7 @@ Check that the above file is the right version for this program!", ...@@ -136,7 +136,7 @@ Check that the above file is the right version for this program!",
if (file != FERR) if (file != FERR)
VOID(my_close(file,MYF(MY_WME))); VOID(my_close(file,MYF(MY_WME)));
unireg_abort(1); unireg_abort(1);
return 1; DEBUG_RETURN(1); // Impossible
} /* read_texts */ } /* read_texts */
......
This diff is collapsed.
...@@ -224,7 +224,7 @@ class Field ...@@ -224,7 +224,7 @@ class Field
uint offset(); // Should be inline ... uint offset(); // Should be inline ...
void copy_from_tmp(int offset); void copy_from_tmp(int offset);
uint fill_cache_field(struct st_cache_field *copy); uint fill_cache_field(struct st_cache_field *copy);
virtual bool get_date(TIME *ltime,bool fuzzydate); virtual bool get_date(TIME *ltime,uint fuzzydate);
virtual bool get_time(TIME *ltime); virtual bool get_time(TIME *ltime);
virtual CHARSET_INFO *charset(void) const { return &my_charset_bin; } virtual CHARSET_INFO *charset(void) const { return &my_charset_bin; }
virtual bool has_charset(void) const { return FALSE; } virtual bool has_charset(void) const { return FALSE; }
...@@ -647,7 +647,7 @@ class Field_timestamp :public Field_str { ...@@ -647,7 +647,7 @@ class Field_timestamp :public Field_str {
longget(tmp,ptr); longget(tmp,ptr);
return tmp; return tmp;
} }
bool get_date(TIME *ltime,bool fuzzydate); bool get_date(TIME *ltime,uint fuzzydate);
bool get_time(TIME *ltime); bool get_time(TIME *ltime);
}; };
...@@ -735,7 +735,7 @@ class Field_newdate :public Field_str { ...@@ -735,7 +735,7 @@ class Field_newdate :public Field_str {
void sql_type(String &str) const; void sql_type(String &str) const;
bool store_for_compare() { return 1; } bool store_for_compare() { return 1; }
bool zero_pack() const { return 1; } bool zero_pack() const { return 1; }
bool get_date(TIME *ltime,bool fuzzydate); bool get_date(TIME *ltime,uint fuzzydate);
bool get_time(TIME *ltime); bool get_time(TIME *ltime);
}; };
...@@ -805,7 +805,7 @@ class Field_datetime :public Field_str { ...@@ -805,7 +805,7 @@ class Field_datetime :public Field_str {
void sql_type(String &str) const; void sql_type(String &str) const;
bool store_for_compare() { return 1; } bool store_for_compare() { return 1; }
bool zero_pack() const { return 1; } bool zero_pack() const { return 1; }
bool get_date(TIME *ltime,bool fuzzydate); bool get_date(TIME *ltime,uint fuzzydate);
bool get_time(TIME *ltime); bool get_time(TIME *ltime);
}; };
...@@ -1160,9 +1160,6 @@ uint pack_length_to_packflag(uint type); ...@@ -1160,9 +1160,6 @@ uint pack_length_to_packflag(uint type);
uint32 calc_pack_length(enum_field_types type,uint32 length); uint32 calc_pack_length(enum_field_types type,uint32 length);
bool set_field_to_null(Field *field); bool set_field_to_null(Field *field);
bool set_field_to_null_with_conversions(Field *field, bool no_conversions); bool set_field_to_null_with_conversions(Field *field, bool no_conversions);
uint find_enum(TYPELIB *typelib,const char *x, uint length);
ulonglong find_set(TYPELIB *typelib,const char *x, uint length,
char **err_pos, uint *err_len, bool *set_warning);
bool test_if_int(const char *str, int length, const char *int_end, bool test_if_int(const char *str, int length, const char *int_end,
CHARSET_INFO *cs); CHARSET_INFO *cs);
......
...@@ -42,8 +42,6 @@ void unireg_init(ulong options) ...@@ -42,8 +42,6 @@ void unireg_init(ulong options)
#endif #endif
VOID(strmov(reg_ext,".frm")); VOID(strmov(reg_ext,".frm"));
for (i=0 ; i < 6 ; i++) // YYMMDDHHMMSS
dayord.pos[i]=i;
specialflag=SPECIAL_SAME_DB_NAME; specialflag=SPECIAL_SAME_DB_NAME;
/* Make a tab of powers of 10 */ /* Make a tab of powers of 10 */
for (i=0,nr=1.0; i < array_elements(log_10) ; i++) for (i=0,nr=1.0; i < array_elements(log_10) ; i++)
......
...@@ -46,8 +46,10 @@ Item::Item(): ...@@ -46,8 +46,10 @@ Item::Item():
collation.set(default_charset(), DERIVATION_COERCIBLE); collation.set(default_charset(), DERIVATION_COERCIBLE);
name= 0; name= 0;
decimals= 0; max_length= 0; decimals= 0; max_length= 0;
thd= current_thd;
next= thd->free_list; // Put in free list /* Put item in free list so that we can free all items at end */
THD *thd= current_thd;
next= thd->free_list;
thd->free_list= this; thd->free_list= this;
/* /*
Item constructor can be called during execution other then SQL_COM Item constructor can be called during execution other then SQL_COM
...@@ -69,7 +71,7 @@ Item::Item(): ...@@ -69,7 +71,7 @@ Item::Item():
Used for duplicating lists in processing queries with temporary Used for duplicating lists in processing queries with temporary
tables tables
*/ */
Item::Item(THD *c_thd, Item &item): Item::Item(THD *thd, Item &item):
str_value(item.str_value), str_value(item.str_value),
name(item.name), name(item.name),
max_length(item.max_length), max_length(item.max_length),
...@@ -82,8 +84,7 @@ Item::Item(THD *c_thd, Item &item): ...@@ -82,8 +84,7 @@ Item::Item(THD *c_thd, Item &item):
fixed(item.fixed), fixed(item.fixed),
collation(item.collation) collation(item.collation)
{ {
next=c_thd->free_list; // Put in free list next= thd->free_list; // Put in free list
thd= c_thd;
thd->free_list= this; thd->free_list= this;
} }
...@@ -183,13 +184,13 @@ bool Item_string::eq(const Item *item, bool binary_cmp) const ...@@ -183,13 +184,13 @@ bool Item_string::eq(const Item *item, bool binary_cmp) const
As a extra convenience the time structure is reset on error! As a extra convenience the time structure is reset on error!
*/ */
bool Item::get_date(TIME *ltime,bool fuzzydate) bool Item::get_date(TIME *ltime,uint fuzzydate)
{ {
char buff[40]; char buff[40];
String tmp(buff,sizeof(buff), &my_charset_bin),*res; String tmp(buff,sizeof(buff), &my_charset_bin),*res;
if (!(res=val_str(&tmp)) || if (!(res=val_str(&tmp)) ||
str_to_TIME(res->ptr(),res->length(),ltime,fuzzydate, thd) <= str_to_TIME(res->ptr(),res->length(),ltime,fuzzydate) <=
WRONG_TIMESTAMP_FULL) TIMESTAMP_DATETIME_ERROR)
{ {
bzero((char*) ltime,sizeof(*ltime)); bzero((char*) ltime,sizeof(*ltime));
return 1; return 1;
...@@ -207,7 +208,7 @@ bool Item::get_time(TIME *ltime) ...@@ -207,7 +208,7 @@ bool Item::get_time(TIME *ltime)
char buff[40]; char buff[40];
String tmp(buff,sizeof(buff),&my_charset_bin),*res; String tmp(buff,sizeof(buff),&my_charset_bin),*res;
if (!(res=val_str(&tmp)) || if (!(res=val_str(&tmp)) ||
str_to_time(res->ptr(),res->length(),ltime, thd)) str_to_time(res->ptr(),res->length(),ltime))
{ {
bzero((char*) ltime,sizeof(*ltime)); bzero((char*) ltime,sizeof(*ltime));
return 1; return 1;
...@@ -360,7 +361,7 @@ String *Item_field::str_result(String *str) ...@@ -360,7 +361,7 @@ String *Item_field::str_result(String *str)
return result_field->val_str(str,&str_value); return result_field->val_str(str,&str_value);
} }
bool Item_field::get_date(TIME *ltime,bool fuzzydate) bool Item_field::get_date(TIME *ltime,uint fuzzydate)
{ {
if ((null_value=field->is_null()) || field->get_date(ltime,fuzzydate)) if ((null_value=field->is_null()) || field->get_date(ltime,fuzzydate))
{ {
...@@ -370,7 +371,7 @@ bool Item_field::get_date(TIME *ltime,bool fuzzydate) ...@@ -370,7 +371,7 @@ bool Item_field::get_date(TIME *ltime,bool fuzzydate)
return 0; return 0;
} }
bool Item_field::get_date_result(TIME *ltime,bool fuzzydate) bool Item_field::get_date_result(TIME *ltime,uint fuzzydate)
{ {
if ((null_value=result_field->is_null()) || if ((null_value=result_field->is_null()) ||
result_field->get_date(ltime,fuzzydate)) result_field->get_date(ltime,fuzzydate))
...@@ -692,28 +693,25 @@ String *Item_param::query_val_str(String* str) ...@@ -692,28 +693,25 @@ String *Item_param::query_val_str(String* str)
} }
else else
{ {
DATETIME_FORMAT *tmp_format= 0; char buff[40];
bool is_time_only= 0; String tmp(buff,sizeof(buff), &my_charset_bin);
switch (ltime.time_type) { switch (ltime.time_type) {
case TIMESTAMP_NONE: case TIMESTAMP_NONE:
case WRONG_TIMESTAMP_FULL: case TIMESTAMP_DATETIME_ERROR:
tmp.length(0); // Should never happen
break; break;
case TIMESTAMP_DATE: case TIMESTAMP_DATE:
tmp_format= &t_datetime_frm(thd, DATE_FORMAT_TYPE).datetime_format; make_date((DATE_TIME_FORMAT*) 0, &ltime, &tmp);
break; break;
case TIMESTAMP_FULL: case TIMESTAMP_DATETIME:
tmp_format= &t_datetime_frm(thd, DATETIME_FORMAT_TYPE).datetime_format; make_datetime((DATE_TIME_FORMAT*) 0, &ltime, &tmp);
break; break;
case TIMESTAMP_TIME: case TIMESTAMP_TIME:
{ make_time((DATE_TIME_FORMAT*) 0, &ltime, &tmp);
tmp_format= &t_datetime_frm(thd, TIME_FORMAT_TYPE).datetime_format;
is_time_only= 1;
break; break;
} }
} str->append(tmp);
make_datetime(str, &ltime, is_time_only, 0,
tmp_format->format, tmp_format->format_length, 0);
} }
str->append('\''); str->append('\'');
} }
...@@ -769,7 +767,7 @@ String* Item_ref_null_helper::val_str(String* s) ...@@ -769,7 +767,7 @@ String* Item_ref_null_helper::val_str(String* s)
owner->was_null|= null_value= (*ref)->null_value; owner->was_null|= null_value= (*ref)->null_value;
return tmp; return tmp;
} }
bool Item_ref_null_helper::get_date(TIME *ltime, bool fuzzydate) bool Item_ref_null_helper::get_date(TIME *ltime, uint fuzzydate)
{ {
return (owner->was_null|= null_value= (*ref)->get_date(ltime, fuzzydate)); return (owner->was_null|= null_value= (*ref)->get_date(ltime, fuzzydate));
} }
...@@ -990,6 +988,7 @@ enum_field_types Item::field_type() const ...@@ -990,6 +988,7 @@ enum_field_types Item::field_type() const
FIELD_TYPE_DOUBLE); FIELD_TYPE_DOUBLE);
} }
Field *Item::tmp_table_field_from_field_type(TABLE *table) Field *Item::tmp_table_field_from_field_type(TABLE *table)
{ {
switch (field_type()) switch (field_type())
...@@ -1366,7 +1365,7 @@ bool Item::send(Protocol *protocol, String *buffer) ...@@ -1366,7 +1365,7 @@ bool Item::send(Protocol *protocol, String *buffer)
case MYSQL_TYPE_TIMESTAMP: case MYSQL_TYPE_TIMESTAMP:
{ {
TIME tm; TIME tm;
get_date(&tm, 1); get_date(&tm, TIME_FUZZY_DATE);
if (!null_value) if (!null_value)
{ {
if (type == MYSQL_TYPE_DATE) if (type == MYSQL_TYPE_DATE)
......
...@@ -114,14 +114,6 @@ class Item { ...@@ -114,14 +114,6 @@ class Item {
my_bool fixed; /* If item fixed with fix_fields */ my_bool fixed; /* If item fixed with fix_fields */
DTCollation collation; DTCollation collation;
/*
thd is current_thd value. Like some other Item's fields it
will be a problem for using one Item in different threads
(as stored procedures may want to do in the future)
*/
THD *thd;
// alloc & destruct is done as start of select using sql_alloc // alloc & destruct is done as start of select using sql_alloc
Item(); Item();
/* /*
...@@ -132,7 +124,7 @@ class Item { ...@@ -132,7 +124,7 @@ class Item {
top AND/OR ctructure of WHERE clause to protect it of top AND/OR ctructure of WHERE clause to protect it of
optimisation changes in prepared statements optimisation changes in prepared statements
*/ */
Item(THD *c_thd, Item &item); Item(THD *thd, Item &item);
virtual ~Item() { name=0; } /*lint -e1509 */ virtual ~Item() { name=0; } /*lint -e1509 */
void set_name(const char *str,uint length, CHARSET_INFO *cs); void set_name(const char *str,uint length, CHARSET_INFO *cs);
void init_make_field(Send_field *tmp_field,enum enum_field_types type); void init_make_field(Send_field *tmp_field,enum enum_field_types type);
...@@ -185,9 +177,9 @@ class Item { ...@@ -185,9 +177,9 @@ class Item {
void print_item_w_name(String *); void print_item_w_name(String *);
virtual void update_used_tables() {} virtual void update_used_tables() {}
virtual void split_sum_func(Item **ref_pointer_array, List<Item> &fields) {} virtual void split_sum_func(Item **ref_pointer_array, List<Item> &fields) {}
virtual bool get_date(TIME *ltime,bool fuzzydate); virtual bool get_date(TIME *ltime,uint fuzzydate);
virtual bool get_time(TIME *ltime); virtual bool get_time(TIME *ltime);
virtual bool get_date_result(TIME *ltime,bool fuzzydate) virtual bool get_date_result(TIME *ltime,uint fuzzydate)
{ return get_date(ltime,fuzzydate); } { return get_date(ltime,fuzzydate); }
virtual bool is_null() { return 0; } virtual bool is_null() { return 0; }
virtual void top_level_item() {} virtual void top_level_item() {}
...@@ -286,8 +278,8 @@ class Item_field :public Item_ident ...@@ -286,8 +278,8 @@ class Item_field :public Item_ident
} }
Field *get_tmp_table_field() { return result_field; } Field *get_tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg) { return result_field; } Field *tmp_table_field(TABLE *t_arg) { return result_field; }
bool get_date(TIME *ltime,bool fuzzydate); bool get_date(TIME *ltime,uint fuzzydate);
bool get_date_result(TIME *ltime,bool fuzzydate); bool get_date_result(TIME *ltime,uint fuzzydate);
bool get_time(TIME *ltime); bool get_time(TIME *ltime);
bool is_null() { return field->is_null(); } bool is_null() { return field->is_null(); }
Item *get_tmp_table_item(THD *thd); Item *get_tmp_table_item(THD *thd);
...@@ -469,6 +461,13 @@ class Item_string :public Item ...@@ -469,6 +461,13 @@ class Item_string :public Item
{ {
collation.set(cs, dv); collation.set(cs, dv);
str_value.set(str,length,cs); str_value.set(str,length,cs);
/*
We have to have a different max_length than 'length' here to
ensure that we get the right length if we do use the item
to create a new table. In this case max_length must be the maximum
number of chars for a string of this type because we in create_field::
divide the max_length with mbmaxlen).
*/
max_length= str_value.numchars()*cs->mbmaxlen; max_length= str_value.numchars()*cs->mbmaxlen;
set_name(str, length, cs); set_name(str, length, cs);
decimals=NOT_FIXED_DEC; decimals=NOT_FIXED_DEC;
...@@ -623,7 +622,7 @@ class Item_ref :public Item_ident ...@@ -623,7 +622,7 @@ class Item_ref :public Item_ident
(void) (*ref)->val_int_result(); (void) (*ref)->val_int_result();
return (*ref)->null_value; return (*ref)->null_value;
} }
bool get_date(TIME *ltime,bool fuzzydate) bool get_date(TIME *ltime,uint fuzzydate)
{ {
return (null_value=(*ref)->get_date_result(ltime,fuzzydate)); return (null_value=(*ref)->get_date_result(ltime,fuzzydate));
} }
...@@ -658,7 +657,7 @@ class Item_ref_null_helper: public Item_ref ...@@ -658,7 +657,7 @@ class Item_ref_null_helper: public Item_ref
double val(); double val();
longlong val_int(); longlong val_int();
String* val_str(String* s); String* val_str(String* s);
bool get_date(TIME *ltime, bool fuzzydate); bool get_date(TIME *ltime, uint fuzzydate);
void print(String *str); void print(String *str);
}; };
......
...@@ -450,7 +450,8 @@ Item *create_load_file(Item* a) ...@@ -450,7 +450,8 @@ Item *create_load_file(Item* a)
} }
Item *create_func_cast(Item *a, Cast_target cast_type, int len, CHARSET_INFO *cs) Item *create_func_cast(Item *a, Cast_target cast_type, int len,
CHARSET_INFO *cs)
{ {
Item *res; Item *res;
LINT_INIT(res); LINT_INIT(res);
......
...@@ -1323,8 +1323,8 @@ void Item_func_find_in_set::fix_length_and_dec() ...@@ -1323,8 +1323,8 @@ void Item_func_find_in_set::fix_length_and_dec()
String *find=args[0]->val_str(&value); String *find=args[0]->val_str(&value);
if (find) if (find)
{ {
enum_value=find_enum(((Field_enum*) field)->typelib,find->ptr(), enum_value= find_type(((Field_enum*) field)->typelib,find->ptr(),
find->length()); find->length(), 0);
enum_bit=0; enum_bit=0;
if (enum_value) if (enum_value)
enum_bit=LL(1) << (enum_value-1); enum_bit=LL(1) << (enum_value-1);
...@@ -2146,8 +2146,8 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name, ...@@ -2146,8 +2146,8 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
} }
/* /*
When a user variable is updated (in a SET command or a query like SELECT @a:= When a user variable is updated (in a SET command or a query like
). SELECT @a:= ).
*/ */
bool Item_func_set_user_var::fix_fields(THD *thd, TABLE_LIST *tables, bool Item_func_set_user_var::fix_fields(THD *thd, TABLE_LIST *tables,
...@@ -2506,14 +2506,15 @@ void Item_func_get_user_var::fix_length_and_dec() ...@@ -2506,14 +2506,15 @@ void Item_func_get_user_var::fix_length_and_dec()
sql_set_variables() is what is called from 'case SQLCOM_SET_OPTION' sql_set_variables() is what is called from 'case SQLCOM_SET_OPTION'
in dispatch_command()). Instead of building a one-element list to pass to in dispatch_command()). Instead of building a one-element list to pass to
sql_set_variables(), we could instead manually call check() and update(); sql_set_variables(), we could instead manually call check() and update();
this would save memory and time; but calling sql_set_variables() makes one this would save memory and time; but calling sql_set_variables() makes
unique place to maintain (sql_set_variables()). one unique place to maintain (sql_set_variables()).
*/ */
List<set_var_base> tmp_var_list; List<set_var_base> tmp_var_list;
tmp_var_list.push_back(new set_var_user(new Item_func_set_user_var(name, tmp_var_list.push_back(new set_var_user(new Item_func_set_user_var(name,
new Item_null()))); new Item_null())));
if (sql_set_variables(thd, &tmp_var_list)) /* this will create the variable */ /* Create the variable */
if (sql_set_variables(thd, &tmp_var_list))
goto err; goto err;
if (!(var_entry= get_variable(&thd->user_vars, name, 0))) if (!(var_entry= get_variable(&thd->user_vars, name, 0)))
goto err; goto err;
......
...@@ -127,9 +127,9 @@ class Item_func :public Item_result_field ...@@ -127,9 +127,9 @@ class Item_func :public Item_result_field
void print_op(String *str); void print_op(String *str);
void print_args(String *str, uint from); void print_args(String *str, uint from);
void fix_num_length_and_dec(); void fix_num_length_and_dec();
inline bool get_arg0_date(TIME *ltime,bool fuzzy_date) inline bool get_arg0_date(TIME *ltime, uint fuzzy_date)
{ {
return (null_value=args[0]->get_date(ltime,fuzzy_date)); return (null_value=args[0]->get_date(ltime, fuzzy_date));
} }
inline bool get_arg0_time(TIME *ltime) inline bool get_arg0_time(TIME *ltime)
{ {
......
This diff is collapsed.
This diff is collapsed.
...@@ -756,6 +756,13 @@ bool open_log(MYSQL_LOG *log, const char *hostname, ...@@ -756,6 +756,13 @@ bool open_log(MYSQL_LOG *log, const char *hostname,
/* mysqld.cc */ /* mysqld.cc */
extern void yyerror(const char*); extern void yyerror(const char*);
/* strfunc.cc */
ulonglong find_set(TYPELIB *typelib,const char *x, uint length,
char **err_pos, uint *err_len, bool *set_warning);
uint find_type(TYPELIB *lib, const char *find, uint length, bool part_match);
uint check_word(TYPELIB *lib, const char *val, const char *end,
const char **end_of_word);
/* /*
External variables External variables
*/ */
...@@ -849,7 +856,6 @@ extern pthread_attr_t connection_attrib; ...@@ -849,7 +856,6 @@ extern pthread_attr_t connection_attrib;
extern I_List<THD> threads; extern I_List<THD> threads;
extern I_List<NAMED_LIST> key_caches; extern I_List<NAMED_LIST> key_caches;
extern MY_BITMAP temp_pool; extern MY_BITMAP temp_pool;
extern DATE_FORMAT dayord;
extern String my_empty_string; extern String my_empty_string;
extern String my_null_string; extern String my_null_string;
extern SHOW_VAR init_vars[],status_vars[], internal_vars[]; extern SHOW_VAR init_vars[],status_vars[], internal_vars[];
...@@ -861,12 +867,8 @@ extern struct system_variables global_system_variables; ...@@ -861,12 +867,8 @@ extern struct system_variables global_system_variables;
extern struct system_variables max_system_variables; extern struct system_variables max_system_variables;
extern struct rand_struct sql_rand; extern struct rand_struct sql_rand;
#define g_datetime_frm(a) (global_system_variables.datetime_formats[(a)]) extern const char *opt_date_time_formats[];
#define t_datetime_frm(a, b) ((a)->variables.datetime_formats[(b)]) extern KNOWN_DATE_TIME_FORMAT known_date_time_formats[];
extern const char *datetime_formats[4][5];
extern const char *opt_datetime_format_names[3];
extern const char *opt_datetime_formats[3];
extern String null_string; extern String null_string;
extern HASH open_cache; extern HASH open_cache;
...@@ -938,23 +940,26 @@ void get_date_from_daynr(long daynr,uint *year, uint *month, ...@@ -938,23 +940,26 @@ void get_date_from_daynr(long daynr,uint *year, uint *month,
uint *day); uint *day);
void init_time(void); void init_time(void);
long my_gmt_sec(TIME *, long *current_timezone); long my_gmt_sec(TIME *, long *current_timezone);
time_t str_to_timestamp(const char *str,uint length, THD *thd); time_t str_to_timestamp(const char *str,uint length);
bool str_to_time(const char *str,uint length,TIME *l_time, THD *thd); bool str_to_time(const char *str,uint length,TIME *l_time);
longlong str_to_datetime(const char *str,uint length,bool fuzzy_date, THD *thd); longlong str_to_datetime(const char *str,uint length, uint fuzzy_date);
timestamp_type str_to_TIME(const char *str, uint length, TIME *l_time, timestamp_type str_to_TIME(const char *str, uint length, TIME *l_time,
bool fuzzy_date, THD *thd); uint flags);
void localtime_to_TIME(TIME *to, struct tm *from); void localtime_to_TIME(TIME *to, struct tm *from);
void calc_time_from_sec(TIME *to, long seconds, long microseconds); void calc_time_from_sec(TIME *to, long seconds, long microseconds);
extern DATETIME_FORMAT *make_format(DATETIME_FORMAT *datetime_format, extern DATE_TIME_FORMAT *date_time_format_make(timestamp_type format_type,
datetime_format_types format_type,
const char *format_str, const char *format_str,
uint format_length, bool is_alloc); uint format_length);
extern String *make_datetime(String *str, TIME *l_time, extern DATE_TIME_FORMAT *date_time_format_copy(THD *thd,
const bool is_time_only, DATE_TIME_FORMAT *format);
const bool add_second_frac, const char *get_date_time_format_str(KNOWN_DATE_TIME_FORMAT *format,
const char *ptr, uint format_length, timestamp_type type);
bool set_len_to_zero); extern bool make_date_time(DATE_TIME_FORMAT *format, TIME *l_time,
timestamp_type type, String *str);
extern void make_time(DATE_TIME_FORMAT *format, TIME *l_time, String *str);
void make_date(DATE_TIME_FORMAT *format, TIME *l_time, String *str);
void make_datetime(DATE_TIME_FORMAT *format, TIME *l_time, String *str);
int test_if_number(char *str,int *res,bool allow_wildcards); int test_if_number(char *str,int *res,bool allow_wildcards);
void change_byte(byte *,uint,char,char); void change_byte(byte *,uint,char,char);
......
...@@ -318,10 +318,7 @@ char mysql_real_data_home[FN_REFLEN], ...@@ -318,10 +318,7 @@ char mysql_real_data_home[FN_REFLEN],
language[LIBLEN],reg_ext[FN_EXTLEN], mysql_charsets_dir[FN_REFLEN], language[LIBLEN],reg_ext[FN_EXTLEN], mysql_charsets_dir[FN_REFLEN],
max_sort_char,*mysqld_user,*mysqld_chroot, *opt_init_file; max_sort_char,*mysqld_user,*mysqld_chroot, *opt_init_file;
const char *opt_datetime_formats[3]; const char *opt_date_time_formats[3];
const char *opt_datetime_format_names[3]= {"date_format",
"time_format",
"datetime_format"};
char *language_ptr, *default_collation_name, *default_character_set_name; char *language_ptr, *default_collation_name, *default_character_set_name;
char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home; char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home;
...@@ -357,7 +354,6 @@ struct system_variables global_system_variables; ...@@ -357,7 +354,6 @@ struct system_variables global_system_variables;
struct system_variables max_system_variables; struct system_variables max_system_variables;
MY_TMPDIR mysql_tmpdir_list; MY_TMPDIR mysql_tmpdir_list;
DATE_FORMAT dayord;
MY_BITMAP temp_pool; MY_BITMAP temp_pool;
CHARSET_INFO *system_charset_info, *files_charset_info ; CHARSET_INFO *system_charset_info, *files_charset_info ;
...@@ -921,9 +917,12 @@ void clean_up(bool print_message) ...@@ -921,9 +917,12 @@ void clean_up(bool print_message)
#ifdef USE_RAID #ifdef USE_RAID
end_raid(); end_raid();
#endif #endif
g_datetime_frm(DATE_FORMAT_TYPE).clean(); my_free((char*) global_system_variables.date_format,
g_datetime_frm(TIME_FORMAT_TYPE).clean(); MYF(MY_ALLOW_ZERO_PTR));
g_datetime_frm(DATETIME_FORMAT_TYPE).clean(); my_free((char*) global_system_variables.time_format,
MYF(MY_ALLOW_ZERO_PTR));
my_free((char*) global_system_variables.datetime_format,
MYF(MY_ALLOW_ZERO_PTR));
if (defaults_argv) if (defaults_argv)
free_defaults(defaults_argv); free_defaults(defaults_argv);
free_tmpdir(&mysql_tmpdir_list); free_tmpdir(&mysql_tmpdir_list);
...@@ -2019,33 +2018,46 @@ bool open_log(MYSQL_LOG *log, const char *hostname, ...@@ -2019,33 +2018,46 @@ bool open_log(MYSQL_LOG *log, const char *hostname,
} }
int init_global_datetime_format(datetime_format_types format_type, bool is_alloc) /*
Initialize one of the global date/time format variables
SYNOPSIS
init_global_datetime_format()
format_type What kind of format should be supported
var_ptr Pointer to variable that should be updated
NOTES
The default value is taken from either opt_date_time_formats[] or
the ISO format (ANSI SQL)
RETURN
0 ok
1 error
*/
bool init_global_datetime_format(timestamp_type format_type,
DATE_TIME_FORMAT **var_ptr)
{ {
const char *format_str= opt_datetime_formats[format_type]; /* Get command line option */
uint format_length= 0; const char *str= opt_date_time_formats[format_type];
DATETIME_FORMAT *tmp_format= &g_datetime_frm(format_type).datetime_format; DATE_TIME_FORMAT *format;
if (format_str) if (!str) // No specified format
{ {
format_str= opt_datetime_formats[format_type]; str= get_date_time_format_str(&known_date_time_formats[ISO_FORMAT],
format_length= strlen(format_str); format_type);
/*
Set the "command line" option to point to the generated string so
that we can set global formats back to default
*/
opt_date_time_formats[format_type]= str;
} }
else if (!(*var_ptr= date_time_format_make(format_type, str, strlen(str))))
{ {
format_str= datetime_formats[format_type][ISO_FORMAT]; fprintf(stderr, "Wrong date/time format specifier: %s\n", str);
format_length= strlen(datetime_formats[format_type][ISO_FORMAT]); return 1;
opt_datetime_formats[format_type]= format_str;
} }
if (make_format(tmp_format, format_type, format_str,
format_length, is_alloc))
{
g_datetime_frm(format_type).name= opt_datetime_format_names[format_type];
g_datetime_frm(format_type).name_length=
strlen(opt_datetime_format_names[format_type]);
g_datetime_frm(format_type).format_type= format_type;
return 0; return 0;
}
return 1;
} }
...@@ -2160,17 +2172,12 @@ static int init_common_variables(const char *conf_file_name, int argc, ...@@ -2160,17 +2172,12 @@ static int init_common_variables(const char *conf_file_name, int argc,
} }
default_charset_info= default_collation; default_charset_info= default_collation;
} }
/* Set collactions that depends on the default collation */
global_system_variables.collation_server= default_charset_info; global_system_variables.collation_server= default_charset_info;
global_system_variables.collation_database= default_charset_info; global_system_variables.collation_database= default_charset_info;
global_system_variables.collation_connection= default_charset_info; global_system_variables.collation_connection= default_charset_info;
global_system_variables.character_set_results= default_charset_info; global_system_variables.character_set_results= default_charset_info;
global_system_variables.character_set_client= default_charset_info; global_system_variables.character_set_client= default_charset_info;
global_system_variables.collation_connection= default_charset_info;
if (init_global_datetime_format(DATE_FORMAT_TYPE, 1) ||
init_global_datetime_format(TIME_FORMAT_TYPE, 1) ||
init_global_datetime_format(DATETIME_FORMAT_TYPE, 1))
return 1;
if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1)) if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1))
return 1; return 1;
...@@ -4606,7 +4613,7 @@ The minimum value for this variable is 4096.", ...@@ -4606,7 +4613,7 @@ The minimum value for this variable is 4096.",
(gptr*) &max_system_variables.net_wait_timeout, 0, GET_ULONG, (gptr*) &max_system_variables.net_wait_timeout, 0, GET_ULONG,
REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0}, REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
{"expire_logs_days", OPT_EXPIRE_LOGS_DAYS, {"expire_logs_days", OPT_EXPIRE_LOGS_DAYS,
"Logs will be rotated after expire-log-days days. ", "Logs will be rotated after expire-log-days days ",
(gptr*) &expire_logs_days, (gptr*) &expire_logs_days,
(gptr*) &expire_logs_days, 0, GET_ULONG, (gptr*) &expire_logs_days, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, 99, 0, 1, 0}, REQUIRED_ARG, 0, 0, 99, 0, 1, 0},
...@@ -4616,23 +4623,24 @@ The minimum value for this variable is 4096.", ...@@ -4616,23 +4623,24 @@ The minimum value for this variable is 4096.",
(gptr*) &max_system_variables.default_week_format, (gptr*) &max_system_variables.default_week_format,
0, GET_ULONG, REQUIRED_ARG, 0, 0, 3L, 0, 1, 0}, 0, GET_ULONG, REQUIRED_ARG, 0, 0, 3L, 0, 1, 0},
{ "date-format", OPT_DATE_FORMAT, { "date-format", OPT_DATE_FORMAT,
"The DATE format.", "The DATE format (For future).",
(gptr*) &opt_datetime_formats[DATE_FORMAT_TYPE], (gptr*) &opt_date_time_formats[TIMESTAMP_DATE],
(gptr*) &opt_datetime_formats[DATE_FORMAT_TYPE], (gptr*) &opt_date_time_formats[TIMESTAMP_DATE],
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "datetime-format", OPT_DATETIME_FORMAT, { "datetime-format", OPT_DATETIME_FORMAT,
"The DATETIME/TIMESTAMP format.", "The DATETIME/TIMESTAMP format (for future).",
(gptr*) &opt_datetime_formats[DATETIME_FORMAT_TYPE], (gptr*) &opt_date_time_formats[TIMESTAMP_DATETIME],
(gptr*) &opt_datetime_formats[DATETIME_FORMAT_TYPE], (gptr*) &opt_date_time_formats[TIMESTAMP_DATETIME],
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "time-format", OPT_TIME_FORMAT, { "time-format", OPT_TIME_FORMAT,
"The TIME format.", "The TIME format (for future).",
(gptr*) &opt_datetime_formats[TIME_FORMAT_TYPE], (gptr*) &opt_date_time_formats[TIMESTAMP_TIME],
(gptr*) &opt_datetime_formats[TIME_FORMAT_TYPE], (gptr*) &opt_date_time_formats[TIMESTAMP_TIME],
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
}; };
struct show_var_st status_vars[]= { struct show_var_st status_vars[]= {
{"Aborted_clients", (char*) &aborted_threads, SHOW_LONG}, {"Aborted_clients", (char*) &aborted_threads, SHOW_LONG},
{"Aborted_connects", (char*) &aborted_connects, SHOW_LONG}, {"Aborted_connects", (char*) &aborted_connects, SHOW_LONG},
...@@ -4944,6 +4952,8 @@ static void mysql_init_variables(void) ...@@ -4944,6 +4952,8 @@ static void mysql_init_variables(void)
national_charset_info= &my_charset_utf8_general_ci; national_charset_info= &my_charset_utf8_general_ci;
table_alias_charset= &my_charset_bin; table_alias_charset= &my_charset_bin;
opt_date_time_formats[0]= opt_date_time_formats[1]= opt_date_time_formats[2]= 0;
/* Things with default values that are not zero */ /* Things with default values that are not zero */
delay_key_write_options= (uint) DELAY_KEY_WRITE_ON; delay_key_write_options= (uint) DELAY_KEY_WRITE_ON;
opt_specialflag= SPECIAL_ENGLISH; opt_specialflag= SPECIAL_ENGLISH;
...@@ -5001,11 +5011,6 @@ static void mysql_init_variables(void) ...@@ -5001,11 +5011,6 @@ static void mysql_init_variables(void)
/* Set default values for some option variables */ /* Set default values for some option variables */
global_system_variables.collation_server= default_charset_info;
global_system_variables.collation_database= default_charset_info;
global_system_variables.collation_connection= default_charset_info;
global_system_variables.character_set_results= default_charset_info;
global_system_variables.character_set_client= default_charset_info;
global_system_variables.table_type= DB_TYPE_MYISAM; global_system_variables.table_type= DB_TYPE_MYISAM;
global_system_variables.tx_isolation= ISO_REPEATABLE_READ; global_system_variables.tx_isolation= ISO_REPEATABLE_READ;
global_system_variables.select_limit= (ulonglong) HA_POS_ERROR; global_system_variables.select_limit= (ulonglong) HA_POS_ERROR;
...@@ -5014,10 +5019,6 @@ static void mysql_init_variables(void) ...@@ -5014,10 +5019,6 @@ static void mysql_init_variables(void)
max_system_variables.max_join_size= (ulonglong) HA_POS_ERROR; max_system_variables.max_join_size= (ulonglong) HA_POS_ERROR;
global_system_variables.old_passwords= 0; global_system_variables.old_passwords= 0;
init_global_datetime_format(DATE_FORMAT_TYPE, 0);
init_global_datetime_format(TIME_FORMAT_TYPE, 0);
init_global_datetime_format(DATETIME_FORMAT_TYPE, 0);
/* Variables that depends on compile options */ /* Variables that depends on compile options */
#ifndef DBUG_OFF #ifndef DBUG_OFF
default_dbug_option=IF_WIN("d:t:i:O,\\mysqld.trace", default_dbug_option=IF_WIN("d:t:i:O,\\mysqld.trace",
...@@ -5626,7 +5627,7 @@ static void get_options(int argc,char **argv) ...@@ -5626,7 +5627,7 @@ static void get_options(int argc,char **argv)
exit(ho_error); exit(ho_error);
if (argc > 0) if (argc > 0)
{ {
fprintf(stderr, "%s: Too many arguments.\nUse --help to get a list of available options\n", my_progname); fprintf(stderr, "%s: Too many arguments (first extra is '%s').\nUse --help to get a list of available options\n", my_progname, *argv);
exit(ho_error); exit(ho_error);
} }
...@@ -5681,6 +5682,15 @@ static void get_options(int argc,char **argv) ...@@ -5681,6 +5682,15 @@ static void get_options(int argc,char **argv)
opt_specialflag|= SPECIAL_SHORT_LOG_FORMAT; opt_specialflag|= SPECIAL_SHORT_LOG_FORMAT;
if (opt_log_queries_not_using_indexes) if (opt_log_queries_not_using_indexes)
opt_specialflag|= SPECIAL_LOG_QUERIES_NOT_USING_INDEXES; opt_specialflag|= SPECIAL_LOG_QUERIES_NOT_USING_INDEXES;
if (init_global_datetime_format(TIMESTAMP_DATE,
&global_system_variables.date_format) ||
init_global_datetime_format(TIMESTAMP_TIME,
&global_system_variables.time_format) ||
init_global_datetime_format(TIMESTAMP_DATETIME,
&global_system_variables.datetime_format))
exit(1);
/* Set up default values for a key cache */ /* Set up default values for a key cache */
KEY_CACHE_VAR *key_cache= &dflt_key_cache_var; KEY_CACHE_VAR *key_cache= &dflt_key_cache_var;
dflt_key_cache_block_size= key_cache->block_size; dflt_key_cache_block_size= key_cache->block_size;
......
...@@ -833,12 +833,17 @@ bool Protocol_simple::store(TIME *tm) ...@@ -833,12 +833,17 @@ bool Protocol_simple::store(TIME *tm)
field_pos++; field_pos++;
#endif #endif
char buff[40]; char buff[40];
String tmp((char*) buff,sizeof(buff),&my_charset_bin); uint length;
DATETIME_FORMAT *tmp_format= (&t_datetime_frm length= my_sprintf(buff,(buff, "%04d-%02d-%02d %02d:%02d:%02d",
(current_thd, DATETIME_FORMAT_TYPE).datetime_format); (int) tm->year,
make_datetime(&tmp, tm, 1, tm->second_part, (int) tm->month,
tmp_format->format, tmp_format->format_length, 1); (int) tm->day,
return net_store_data((char*) tmp.ptr(), tmp.length()); (int) tm->hour,
(int) tm->minute,
(int) tm->second));
if (tm->second_part)
length+= my_sprintf(buff+length,(buff+length, ".%06d", (int)tm->second_part));
return net_store_data((char*) buff, length);
} }
...@@ -851,10 +856,7 @@ bool Protocol_simple::store_date(TIME *tm) ...@@ -851,10 +856,7 @@ bool Protocol_simple::store_date(TIME *tm)
#endif #endif
char buff[40]; char buff[40];
String tmp((char*) buff,sizeof(buff),&my_charset_bin); String tmp((char*) buff,sizeof(buff),&my_charset_bin);
DATETIME_FORMAT *tmp_format= (&t_datetime_frm make_date((DATE_TIME_FORMAT *) 0, tm, &tmp);
(current_thd, DATE_FORMAT_TYPE).datetime_format);
make_datetime(&tmp, tm, 1, 0,
tmp_format->format, tmp_format->format_length, 1);
return net_store_data((char*) tmp.ptr(), tmp.length()); return net_store_data((char*) tmp.ptr(), tmp.length());
} }
...@@ -873,14 +875,16 @@ bool Protocol_simple::store_time(TIME *tm) ...@@ -873,14 +875,16 @@ bool Protocol_simple::store_time(TIME *tm)
field_pos++; field_pos++;
#endif #endif
char buff[40]; char buff[40];
String tmp((char*) buff,sizeof(buff),&my_charset_bin); uint length;
DATETIME_FORMAT *tmp_format= (&t_datetime_frm
(current_thd, TIME_FORMAT_TYPE).datetime_format);
uint day= (tm->year || tm->month) ? 0 : tm->day; uint day= (tm->year || tm->month) ? 0 : tm->day;
tm->hour= (long) day*24L+(long) tm->hour; length= my_sprintf(buff,(buff, "%s%02ld:%02d:%02d",
make_datetime(&tmp, tm, 0, tm->second_part, tm->neg ? "-" : "",
tmp_format->format, tmp_format->format_length, 1); (long) day*24L+(long) tm->hour,
return net_store_data((char*) tmp.ptr(), tmp.length()); (int) tm->minute,
(int) tm->second));
if (tm->second_part)
length+= my_sprintf(buff+length,(buff+length, ".%06d", (int)tm->second_part));
return net_store_data((char*) buff, length);
} }
......
...@@ -304,9 +304,20 @@ sys_var_thd_ulong sys_net_wait_timeout("wait_timeout", ...@@ -304,9 +304,20 @@ sys_var_thd_ulong sys_net_wait_timeout("wait_timeout",
sys_var_long_ptr sys_innodb_max_dirty_pages_pct("innodb_max_dirty_pages_pct", sys_var_long_ptr sys_innodb_max_dirty_pages_pct("innodb_max_dirty_pages_pct",
&srv_max_buf_pool_modified_pct); &srv_max_buf_pool_modified_pct);
#endif #endif
/*
Variables that are bits in THD /* Time/date/datetime formats */
*/
sys_var_thd_date_time_format sys_time_format("time_format",
&SV::time_format,
TIMESTAMP_TIME);
sys_var_thd_date_time_format sys_date_format("date_format",
&SV::date_format,
TIMESTAMP_DATE);
sys_var_thd_date_time_format sys_datetime_format("datetime_format",
&SV::datetime_format,
TIMESTAMP_DATETIME);
/* Variables that are bits in THD */
static sys_var_thd_bit sys_autocommit("autocommit", static sys_var_thd_bit sys_autocommit("autocommit",
set_option_autocommit, set_option_autocommit,
...@@ -413,9 +424,8 @@ sys_var *sys_variables[]= ...@@ -413,9 +424,8 @@ sys_var *sys_variables[]=
&sys_collation_server, &sys_collation_server,
&sys_concurrent_insert, &sys_concurrent_insert,
&sys_connect_timeout, &sys_connect_timeout,
&g_datetime_frm(DATE_FORMAT_TYPE), &sys_date_format,
&g_datetime_frm(DATETIME_FORMAT_TYPE), &sys_datetime_format,
&g_datetime_frm(TIME_FORMAT_TYPE),
&sys_default_week_format, &sys_default_week_format,
&sys_delay_key_write, &sys_delay_key_write,
&sys_delayed_insert_limit, &sys_delayed_insert_limit,
...@@ -485,6 +495,7 @@ sys_var *sys_variables[]= ...@@ -485,6 +495,7 @@ sys_var *sys_variables[]=
&sys_rand_seed1, &sys_rand_seed1,
&sys_rand_seed2, &sys_rand_seed2,
&sys_range_alloc_block_size, &sys_range_alloc_block_size,
&sys_readonly,
&sys_read_buff_size, &sys_read_buff_size,
&sys_read_rnd_buff_size, &sys_read_rnd_buff_size,
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
...@@ -500,7 +511,6 @@ sys_var *sys_variables[]= ...@@ -500,7 +511,6 @@ sys_var *sys_variables[]=
&sys_slave_net_timeout, &sys_slave_net_timeout,
&sys_slave_skip_counter, &sys_slave_skip_counter,
#endif #endif
&sys_readonly,
&sys_slow_launch_time, &sys_slow_launch_time,
&sys_sort_buffer, &sys_sort_buffer,
&sys_sql_big_tables, &sys_sql_big_tables,
...@@ -511,6 +521,7 @@ sys_var *sys_variables[]= ...@@ -511,6 +521,7 @@ sys_var *sys_variables[]=
&sys_table_cache_size, &sys_table_cache_size,
&sys_table_type, &sys_table_type,
&sys_thread_cache_size, &sys_thread_cache_size,
&sys_time_format,
&sys_timestamp, &sys_timestamp,
&sys_tmp_table_size, &sys_tmp_table_size,
&sys_trans_alloc_block_size, &sys_trans_alloc_block_size,
...@@ -556,9 +567,9 @@ struct show_var_st init_vars[]= { ...@@ -556,9 +567,9 @@ struct show_var_st init_vars[]= {
{sys_concurrent_insert.name,(char*) &sys_concurrent_insert, SHOW_SYS}, {sys_concurrent_insert.name,(char*) &sys_concurrent_insert, SHOW_SYS},
{sys_connect_timeout.name, (char*) &sys_connect_timeout, SHOW_SYS}, {sys_connect_timeout.name, (char*) &sys_connect_timeout, SHOW_SYS},
{"datadir", mysql_real_data_home, SHOW_CHAR}, {"datadir", mysql_real_data_home, SHOW_CHAR},
{"date_format", (char*) &g_datetime_frm(DATE_FORMAT_TYPE), SHOW_SYS}, {sys_date_format.name, (char*) &sys_date_format, SHOW_SYS},
{"datetime_format", (char*) &g_datetime_frm(DATETIME_FORMAT_TYPE), SHOW_SYS}, {sys_datetime_format.name, (char*) &sys_datetime_format, SHOW_SYS},
{"default_week_format", (char*) &sys_default_week_format, SHOW_SYS}, {sys_default_week_format.name, (char*) &sys_default_week_format, SHOW_SYS},
{sys_delay_key_write.name, (char*) &sys_delay_key_write, SHOW_SYS}, {sys_delay_key_write.name, (char*) &sys_delay_key_write, SHOW_SYS},
{sys_delayed_insert_limit.name, (char*) &sys_delayed_insert_limit,SHOW_SYS}, {sys_delayed_insert_limit.name, (char*) &sys_delayed_insert_limit,SHOW_SYS},
{sys_delayed_insert_timeout.name, (char*) &sys_delayed_insert_timeout, SHOW_SYS}, {sys_delayed_insert_timeout.name, (char*) &sys_delayed_insert_timeout, SHOW_SYS},
...@@ -720,7 +731,7 @@ struct show_var_st init_vars[]= { ...@@ -720,7 +731,7 @@ struct show_var_st init_vars[]= {
#endif #endif
{"thread_stack", (char*) &thread_stack, SHOW_LONG}, {"thread_stack", (char*) &thread_stack, SHOW_LONG},
{sys_tx_isolation.name, (char*) &sys_tx_isolation, SHOW_SYS}, {sys_tx_isolation.name, (char*) &sys_tx_isolation, SHOW_SYS},
{"time_format", (char*) &g_datetime_frm(TIME_FORMAT_TYPE), SHOW_SYS}, {sys_time_format.name, (char*) &sys_time_format, SHOW_SYS},
#ifdef HAVE_TZNAME #ifdef HAVE_TZNAME
{"timezone", time_zone, SHOW_CHAR}, {"timezone", time_zone, SHOW_CHAR},
#endif #endif
...@@ -744,71 +755,6 @@ bool sys_var::check(THD *thd, set_var *var) ...@@ -744,71 +755,6 @@ bool sys_var::check(THD *thd, set_var *var)
/* /*
Functions to check and update variables Functions to check and update variables
*/ */
char *update_datetime_format(THD *thd, enum enum_var_type type,
enum datetime_format_types format_type,
DATETIME_FORMAT *tmp_format)
{
char *old_value;
if (type == OPT_GLOBAL)
{
pthread_mutex_lock(&LOCK_global_system_variables);
old_value= g_datetime_frm(format_type).datetime_format.format;
g_datetime_frm(format_type).datetime_format= *tmp_format;
pthread_mutex_unlock(&LOCK_global_system_variables);
}
else
{
old_value= t_datetime_frm(thd,format_type).datetime_format.format;
t_datetime_frm(thd, format_type).datetime_format= *tmp_format;
}
return old_value;
}
bool sys_var_datetime_format::update(THD *thd, set_var *var)
{
DATETIME_FORMAT tmp_format;
char *old_value;
uint new_length;
if ((new_length= var->value->str_value.length()))
{
if (!make_format(&tmp_format, format_type,
var->value->str_value.ptr(),
new_length, 1))
return 1;
}
old_value= update_datetime_format(thd, var->type, format_type, &tmp_format);
my_free(old_value, MYF(MY_ALLOW_ZERO_PTR));
return 0;
}
byte *sys_var_datetime_format::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
if (type == OPT_GLOBAL)
return (byte*) g_datetime_frm(format_type).datetime_format.format;
return (byte*) t_datetime_frm(thd, format_type).datetime_format.format;
}
void sys_var_datetime_format::set_default(THD *thd, enum_var_type type)
{
DATETIME_FORMAT tmp_format;
char *old_value;
uint new_length;
if ((new_length= strlen(opt_datetime_formats[format_type])))
{
if (!make_format(&tmp_format, format_type,
opt_datetime_formats[format_type],
new_length, 1))
return;
}
old_value= update_datetime_format(thd, type, format_type, &tmp_format);
my_free(old_value, MYF(MY_ALLOW_ZERO_PTR));
}
/* /*
The following 3 functions need to be changed in 4.1 when we allow The following 3 functions need to be changed in 4.1 when we allow
...@@ -1226,8 +1172,8 @@ bool sys_var::check_enum(THD *thd, set_var *var, TYPELIB *enum_names) ...@@ -1226,8 +1172,8 @@ bool sys_var::check_enum(THD *thd, set_var *var, TYPELIB *enum_names)
{ {
if (!(res=var->value->val_str(&str)) || if (!(res=var->value->val_str(&str)) ||
((long) (var->save_result.ulong_value= ((long) (var->save_result.ulong_value=
(ulong) find_type(res->c_ptr(), enum_names, 3)-1)) (ulong) find_type(enum_names, res->ptr(),
< 0) res->length(),1)-1)) < 0)
{ {
value= res ? res->c_ptr() : "NULL"; value= res ? res->c_ptr() : "NULL";
goto err; goto err;
...@@ -1341,8 +1287,12 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base) ...@@ -1341,8 +1287,12 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
return new Item_int((int32) *(my_bool*) value_ptr(thd, var_type, base),1); return new Item_int((int32) *(my_bool*) value_ptr(thd, var_type, base),1);
case SHOW_CHAR: case SHOW_CHAR:
{ {
Item_string *tmp;
pthread_mutex_lock(&LOCK_global_system_variables);
char *str= (char*) value_ptr(thd, var_type, base); char *str= (char*) value_ptr(thd, var_type, base);
return new Item_string(str, strlen(str), system_charset_info); tmp= new Item_string(str, strlen(str), system_charset_info);
pthread_mutex_unlock(&LOCK_global_system_variables);
return tmp;
} }
default: default:
net_printf(thd, ER_VAR_CANT_BE_READ, name); net_printf(thd, ER_VAR_CANT_BE_READ, name);
...@@ -1401,6 +1351,112 @@ byte *sys_var_thd_bit::value_ptr(THD *thd, enum_var_type type, ...@@ -1401,6 +1351,112 @@ byte *sys_var_thd_bit::value_ptr(THD *thd, enum_var_type type,
} }
/* Update a date_time format variable based on given value */
void sys_var_thd_date_time_format::update2(THD *thd, enum_var_type type,
DATE_TIME_FORMAT *new_value)
{
DATE_TIME_FORMAT *old;
DBUG_ENTER("sys_var_date_time_format::update2");
DBUG_DUMP("positions",(char*) new_value->positions,
sizeof(new_value->positions));
if (type == OPT_GLOBAL)
{
pthread_mutex_lock(&LOCK_global_system_variables);
old= (global_system_variables.*offset);
(global_system_variables.*offset)= new_value;
pthread_mutex_unlock(&LOCK_global_system_variables);
}
else
{
old= (thd->variables.*offset);
(thd->variables.*offset)= new_value;
}
my_free((char*) old, MYF(MY_ALLOW_ZERO_PTR));
DBUG_VOID_RETURN;
}
bool sys_var_thd_date_time_format::update(THD *thd, set_var *var)
{
DATE_TIME_FORMAT *new_value;
/* We must make a copy of the last value to get it into normal memory */
new_value= date_time_format_copy((THD*) 0,
var->save_result.date_time_format);
if (!new_value)
return 1; // Out of memory
update2(thd, var->type, new_value); // Can't fail
return 0;
}
bool sys_var_thd_date_time_format::check(THD *thd, set_var *var)
{
char buff[80];
String str(buff,sizeof(buff), system_charset_info), *res;
DATE_TIME_FORMAT *format;
if (!(res=var->value->val_str(&str)))
res= &my_empty_string;
if (!(format= date_time_format_make(date_time_type,
res->ptr(), res->length())))
{
my_error(ER_WRONG_VALUE_FOR_VAR, MYF(0), name, res->c_ptr());
return 1;
}
/*
We must copy result to thread space to not get a memory leak if
update is aborted
*/
var->save_result.date_time_format= date_time_format_copy(thd, format);
my_free((char*) format, MYF(0));
return var->save_result.date_time_format == 0;
}
void sys_var_thd_date_time_format::set_default(THD *thd, enum_var_type type)
{
DATE_TIME_FORMAT *res= 0;
if (type == OPT_GLOBAL)
{
const char *format;
if ((format= opt_date_time_formats[date_time_type]))
res= date_time_format_make(date_time_type, format, strlen(format));
}
else
{
/* Make copy with malloc */
res= date_time_format_copy((THD *) 0, global_system_variables.*offset);
}
if (res) // Should always be true
update2(thd, type, res);
}
byte *sys_var_thd_date_time_format::value_ptr(THD *thd, enum_var_type type,
LEX_STRING *base)
{
if (type == OPT_GLOBAL)
{
char *res;
/*
We do a copy here just to be sure things will work even if someone
is modifying the original string while the copy is accessed
(Can't happen now in SQL SHOW, but this is a good safety for the future)
*/
res= thd->strmake((global_system_variables.*offset)->format.str,
(global_system_variables.*offset)->format.length);
return (byte*) res;
}
return (byte*) (thd->variables.*offset)->format.str;
}
typedef struct old_names_map_st typedef struct old_names_map_st
{ {
const char *old_name; const char *old_name;
......
...@@ -54,8 +54,6 @@ class sys_var ...@@ -54,8 +54,6 @@ class sys_var
const char *name; const char *name;
sys_after_update_func after_update; sys_after_update_func after_update;
sys_var()
{}
sys_var(const char *name_arg) :name(name_arg),after_update(0) sys_var(const char *name_arg) :name(name_arg),after_update(0)
{} {}
sys_var(const char *name_arg,sys_after_update_func func) sys_var(const char *name_arg,sys_after_update_func func)
...@@ -195,9 +193,6 @@ class sys_var_enum :public sys_var ...@@ -195,9 +193,6 @@ class sys_var_enum :public sys_var
class sys_var_thd :public sys_var class sys_var_thd :public sys_var
{ {
public: public:
sys_var_thd()
:sys_var()
{}
sys_var_thd(const char *name_arg) sys_var_thd(const char *name_arg)
:sys_var(name_arg) :sys_var(name_arg)
{} {}
...@@ -621,46 +616,26 @@ class sys_var_key_cache_age_threshold :public sys_var_key_cache_param ...@@ -621,46 +616,26 @@ class sys_var_key_cache_age_threshold :public sys_var_key_cache_param
}; };
class sys_var_datetime_format :public sys_var_thd class sys_var_thd_date_time_format :public sys_var_thd
{ {
DATE_TIME_FORMAT *SV::*offset;
enum timestamp_type date_time_type;
public: public:
enum datetime_format_types format_type; sys_var_thd_date_time_format(const char *name_arg,
DATETIME_FORMAT datetime_format; DATE_TIME_FORMAT *SV::*offset_arg,
sys_var_datetime_format(): sys_var_thd() timestamp_type date_time_type_arg)
:sys_var_thd(name_arg), offset(offset_arg),
date_time_type(date_time_type_arg)
{} {}
void clean()
{
my_free(datetime_format.format, MYF(MY_ALLOW_ZERO_PTR));
datetime_format.format=0;
}
/*
It's for copying of global_system_variables structure
in THD constructor.
*/
inline sys_var_datetime_format& operator= (sys_var_datetime_format& s)
{
if (&s != this)
{
name= s.name; name_length= s.name_length;
datetime_format= s.datetime_format;
datetime_format.format= (my_strdup_with_length
(s.datetime_format.format,
s.datetime_format.
format_length, MYF(0)));
format_type= s.format_type;
}
return *this;
}
SHOW_TYPE type() { return SHOW_CHAR; } SHOW_TYPE type() { return SHOW_CHAR; }
bool check_update_type(Item_result type) bool check_update_type(Item_result type)
{ {
return type != STRING_RESULT; /* Only accept strings */ return type != STRING_RESULT; /* Only accept strings */
} }
bool check_default(enum_var_type type) { return 0; } bool check_default(enum_var_type type) { return 0; }
bool check(THD *thd, set_var *var);
bool update(THD *thd, set_var *var); bool update(THD *thd, set_var *var);
void update2(THD *thd, enum_var_type type, DATE_TIME_FORMAT *new_value);
byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base); byte *value_ptr(THD *thd, enum_var_type type, LEX_STRING *base);
void set_default(THD *thd, enum_var_type type); void set_default(THD *thd, enum_var_type type);
}; };
...@@ -718,6 +693,7 @@ class set_var :public set_var_base ...@@ -718,6 +693,7 @@ class set_var :public set_var_base
CHARSET_INFO *charset; CHARSET_INFO *charset;
ulong ulong_value; ulong ulong_value;
ulonglong ulonglong_value; ulonglong ulonglong_value;
DATE_TIME_FORMAT *date_time_format;
} save_result; } save_result;
LEX_STRING base; /* for structs */ LEX_STRING base; /* for structs */
......
...@@ -276,21 +276,26 @@ character-set=latin2 ...@@ -276,21 +276,26 @@ character-set=latin2
"Record count is more than the column count at row %ld"; "Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; "Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld"; "Data truncated, out of range for column '%s' at row %ld";
"Data truncated for column '%s' at row %ld" "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'", "Unknown collation: '%-.64s'",
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started." "SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format" "Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", "Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "Wrong parameter or combination of parameters for START SLAVE UNTIL",
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart",
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored",
"Incorrect index name '%-.100s'", "Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"Query cache failed to set size %lu, new query cache size is %lu", "Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index",
...@@ -270,21 +270,26 @@ character-set=latin1 ...@@ -270,21 +270,26 @@ character-set=latin1
"Record count is more than the column count at row %ld"; "Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; "Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld"; "Data truncated, out of range for column '%s' at row %ld";
"Data truncated for column '%s' at row %ld" "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'", "Unknown collation: '%-.64s'",
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started." "SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format" "Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", "Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "Wrong parameter or combination of parameters for START SLAVE UNTIL",
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart",
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored",
"Incorrect index name '%-.100s'", "Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"Query cache failed to set size %lu, new query cache size is %lu", "Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index",
...@@ -278,21 +278,26 @@ character-set=latin1 ...@@ -278,21 +278,26 @@ character-set=latin1
"Record count is more than the column count at row %ld"; "Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; "Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld"; "Data truncated, out of range for column '%s' at row %ld";
"Data truncated for column '%s' at row %ld" "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'", "Unknown collation: '%-.64s'",
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started." "SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format" "Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", "Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "Wrong parameter or combination of parameters for START SLAVE UNTIL",
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart",
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored",
"Incorrect index name '%-.100s'", "Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"Query cache failed to set size %lu, new query cache size is %lu", "Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index",
...@@ -252,36 +252,41 @@ character-set=latin1 ...@@ -252,36 +252,41 @@ character-set=latin1
"Reference '%-.64s' not supported (%s)", "Reference '%-.64s' not supported (%s)",
"Every derived table must have it's own alias", "Every derived table must have it's own alias",
"Select %u was reduced during optimisation", "Select %u was reduced during optimisation",
"Table '%-.64s' from one of SELECT's can not be used in %-.32s" "Table '%-.64s' from one of SELECT's can not be used in %-.32s",
"Client does not support authentication protocol requested by server; consider upgrading MySQL client" "Client does not support authentication protocol requested by server; consider upgrading MySQL client",
"All parts of a SPATIAL KEY must be NOT NULL" "All parts of a SPATIAL KEY must be NOT NULL",
"COLLATION '%s' is not valid for CHARACTER SET '%s'" "COLLATION '%s' is not valid for CHARACTER SET '%s'",
"Slave is already running" "Slave is already running",
"Slave has already been stopped" "Slave has already been stopped",
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)" "Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",
"Z_MEM_ERROR: Not enough memory available for zlib" "ZLIB: Not enough memory available for zlib",
"Z_BUF_ERROR: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)" "ZLIB: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"Z_DATA_ERROR: Input data was corrupted for zlib" "ZLIB: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()" "%d line(s) was(were) cut by group_concat()",
"Record count is fewer than the column count at row %ld"; "Record count is fewer than the column count at row %ld";
"Record count is more than the column count at row %ld"; "Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; "Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld"; "Data truncated, out of range for column '%s' at row %ld";
"Data truncated for column '%s' at row %ld" "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'", "Unknown collation: '%-.64s'",
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started." "SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
"Server is running in --secure-auth mode, but '%s'@'%s' has a password in the old format; please change the password to the new format", "Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", "Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "Wrong parameter or combination of parameters for START SLAVE UNTIL",
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to use --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL. Otherwise you will get problems if you get an unexpected slave's mysqld restart",
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored",
"Incorrect index name '%-.100s'", "Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"Query cache failed to set size %lu, new query cache size is %lu", "Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index",
...@@ -272,21 +272,26 @@ character-set=latin7 ...@@ -272,21 +272,26 @@ character-set=latin7
"Record count is more than the column count at row %ld"; "Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; "Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld"; "Data truncated, out of range for column '%s' at row %ld";
"Data truncated for column '%s' at row %ld" "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'", "Unknown collation: '%-.64s'",
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started." "SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format" "Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", "Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "Wrong parameter or combination of parameters for START SLAVE UNTIL",
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart",
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored",
"Incorrect index name '%-.100s'", "Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"Query cache failed to set size %lu, new query cache size is %lu", "Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index",
...@@ -267,21 +267,26 @@ character-set=latin1 ...@@ -267,21 +267,26 @@ character-set=latin1
"Record count is more than the column count at row %ld"; "Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; "Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld"; "Data truncated, out of range for column '%s' at row %ld";
"Data truncated for column '%s' at row %ld" "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'", "Unknown collation: '%-.64s'",
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started." "SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format" "Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", "Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "Wrong parameter or combination of parameters for START SLAVE UNTIL",
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart",
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored",
"Incorrect index name '%-.100s'", "Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"Query cache failed to set size %lu, new query cache size is %lu", "Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index",
...@@ -293,7 +293,12 @@ character-set=latin1 ...@@ -293,7 +293,12 @@ character-set=latin1
"Feld oder Verweis '%-.64s%s%-.64s%s%-.64s' im SELECT-Befehl Nr. %d wurde im SELECT-Befehl Nr. %d aufgelöst", "Feld oder Verweis '%-.64s%s%-.64s%s%-.64s' im SELECT-Befehl Nr. %d wurde im SELECT-Befehl Nr. %d aufgelöst",
"Falscher Parameter oder falsche Kombination von Parametern für START SLAVE UNTIL", "Falscher Parameter oder falsche Kombination von Parametern für START SLAVE UNTIL",
"Es wird empfohlen, mit --skip-slave-start zu starten, wenn mit START SLAVE UNTIL eine Schritt-für-Schritt-Replikation ausgeführt wird. Ansonsten gibt es Probleme, wenn der Slave-Server unerwartet neu startet", "Es wird empfohlen, mit --skip-slave-start zu starten, wenn mit START SLAVE UNTIL eine Schritt-für-Schritt-Replikation ausgeführt wird. Ansonsten gibt es Probleme, wenn der Slave-Server unerwartet neu startet",
"SQL-Thread soll nicht gestartet werden. Daher werden UNTIL-Optionen ignoriert" "SQL-Thread soll nicht gestartet werden. Daher werden UNTIL-Optionen ignoriert",
"Incorrect index name '%-.100s'", "Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"Query cache failed to set size %lu, new query cache size is %lu", "Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index",
...@@ -267,21 +267,26 @@ character-set=greek ...@@ -267,21 +267,26 @@ character-set=greek
"Record count is more than the column count at row %ld"; "Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; "Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld"; "Data truncated, out of range for column '%s' at row %ld";
"Data truncated for column '%s' at row %ld" "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'", "Unknown collation: '%-.64s'",
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started." "SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format" "Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", "Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "Wrong parameter or combination of parameters for START SLAVE UNTIL",
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart",
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored",
"Incorrect index name '%-.100s'", "Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"Query cache failed to set size %lu, new query cache size is %lu", "Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index",
...@@ -269,21 +269,26 @@ character-set=latin2 ...@@ -269,21 +269,26 @@ character-set=latin2
"Record count is more than the column count at row %ld"; "Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; "Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld"; "Data truncated, out of range for column '%s' at row %ld";
"Data truncated for column '%s' at row %ld" "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'", "Unknown collation: '%-.64s'",
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started." "SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format" "Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", "Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "Wrong parameter or combination of parameters for START SLAVE UNTIL",
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart",
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored",
"Incorrect index name '%-.100s'", "Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"Query cache failed to set size %lu, new query cache size is %lu", "Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index",
...@@ -267,21 +267,27 @@ character-set=latin1 ...@@ -267,21 +267,27 @@ character-set=latin1
"Record count is more than the column count at row %ld"; "Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; "Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld"; "Data truncated, out of range for column '%s' at row %ld";
"Data truncated for column '%s' at row %ld" "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'", "Unknown collation: '%-.64s'",
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started." "SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format" "Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", "Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "Wrong parameter or combination of parameters for START SLAVE UNTIL",
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart",
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored",
"Incorrect index name '%-.100s'", "Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"Query cache failed to set size %lu, new query cache size is %lu", "Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index",
...@@ -269,21 +269,26 @@ character-set=ujis ...@@ -269,21 +269,26 @@ character-set=ujis
"Record count is more than the column count at row %ld"; "Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; "Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld"; "Data truncated, out of range for column '%s' at row %ld";
"Data truncated for column '%s' at row %ld" "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'", "Unknown collation: '%-.64s'",
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started." "SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format" "Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", "Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "Wrong parameter or combination of parameters for START SLAVE UNTIL",
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart",
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored",
"Incorrect index name '%-.100s'", "Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"Query cache failed to set size %lu, new query cache size is %lu", "Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index",
...@@ -267,21 +267,27 @@ character-set=euckr ...@@ -267,21 +267,27 @@ character-set=euckr
"Record count is more than the column count at row %ld"; "Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; "Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld"; "Data truncated, out of range for column '%s' at row %ld";
"Data truncated for column '%s' at row %ld" "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'", "Unknown collation: '%-.64s'",
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started." "SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format" "Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", "Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "Wrong parameter or combination of parameters for START SLAVE UNTIL",
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart",
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored",
"Incorrect index name '%-.100s'", "Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"Query cache failed to set size %lu, new query cache size is %lu", "Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index",
...@@ -269,21 +269,26 @@ character-set=latin1 ...@@ -269,21 +269,26 @@ character-set=latin1
"Record count is more than the column count at row %ld"; "Record count is more than the column count at row %ld";
"Data truncated, NULL supplied to NOT NULL column '%s' at row %ld"; "Data truncated, NULL supplied to NOT NULL column '%s' at row %ld";
"Data truncated, out of range for column '%s' at row %ld"; "Data truncated, out of range for column '%s' at row %ld";
"Data truncated for column '%s' at row %ld" "Data truncated for column '%s' at row %ld",
"Using storage engine %s for table '%s'", "Using storage engine %s for table '%s'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"Can't drop one or more of the requested users" "Can't drop one or more of the requested users",
"Can't revoke all privileges, grant for one or more of the requested users" "Can't revoke all privileges, grant for one or more of the requested users",
"Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'", "Illegal mix of collations (%s,%s), (%s,%s), (%s,%s) for operation '%s'",
"Illegal mix of collations for operation '%s'", "Illegal mix of collations for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)", "Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"Unknown collation: '%-.64s'", "Unknown collation: '%-.64s'",
"SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started." "SSL parameters in CHANGE MASTER are ignored because this MySQL slave was compiled without SSL support. They can be used later when MySQL slave with SSL will be started.",
"Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format" "Server is running in --secure-auth mode, but '%s@%s' has a password in the old format; please change the password to the new format",
"Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d", "Field or reference '%-.64s%s%-.64s%s%-.64s' of SELECT #%d was resolved in SELECT #%d",
"Wrong parameter or combination of parameters for START SLAVE UNTIL" "Wrong parameter or combination of parameters for START SLAVE UNTIL",
"It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart" "It is recommended to run with --skip-slave-start when doing step-by-step replication with START SLAVE UNTIL, otherwise you are not safe in case of unexpected slave's mysqld restart",
"SQL thread is not to be started so UNTIL options are ignored" "SQL thread is not to be started so UNTIL options are ignored",
"Incorrect index name '%-.100s'", "Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"Query cache failed to set size %lu, new query cache size is %lu", "Query cache failed to set size %lu, new query cache size is %lu",
"Column '%-.64s' cannot be part of FULLTEXT index" "Column '%-.64s' cannot be part of FULLTEXT index",
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -2210,7 +2210,8 @@ void get_key_map_from_key_list(key_map *map, TABLE *table, ...@@ -2210,7 +2210,8 @@ void get_key_map_from_key_list(key_map *map, TABLE *table,
map->clear_all(); map->clear_all();
while ((name=it++)) while ((name=it++))
{ {
if ((pos=find_type(name->c_ptr(), &table->keynames, 1+2)) <= 0) if ((pos= find_type(&table->keynames, name->ptr(), name->length(), 1)) <=
0)
{ {
my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), name->c_ptr(), my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), name->c_ptr(),
table->real_name); table->real_name);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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