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
libmysqld/sql_update.cc
libmysqld/sql_yacc.cc
libmysqld/stacktrace.c
libmysqld/strfunc.cc
libmysqld/table.cc
libmysqld/thr_malloc.cc
libmysqld/time.cc
......
......@@ -14,6 +14,7 @@ extra_configs="$extra_configs --with-berkeley-db --with-innodb --without-isam --
if test -z "$just_print"
then
set +v
echo "\
******************************************************************************
Note that by default BUILD/compile-pentium-valgrind-max calls 'configure' with
......
......@@ -446,6 +446,10 @@ SOURCE=..\strings\strcont.c
# End Source File
# Begin Source File
SOURCE=..\sql\strfunc.cpp
# End Source File
# Begin Source File
SOURCE=..\strings\strinstr.c
# End Source File
# Begin Source File
......
......@@ -1253,6 +1253,26 @@ SOURCE=.\sql_yacc.cpp
# End 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
# End Source File
# Begin Source File
......
......@@ -945,6 +945,22 @@ SOURCE=.\sql_yacc.cpp
# End 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
# End Source File
# Begin Source File
......
......@@ -188,6 +188,10 @@ SOURCE=.\longlong2str.c
# End Source File
# Begin Source File
SOURCE=.\my_strtoll10.c
# End Source File
# Begin Source File
SOURCE=.\my_vsnprintf.c
# End Source File
# Begin Source File
......
......@@ -86,7 +86,7 @@ enum my_lex_states
{
MY_LEX_START, MY_LEX_CHAR, MY_LEX_IDENT,
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_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,
......
......@@ -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 *str2int(const char *src,int radix,long lower,long upper,
long *val);
longlong my_strtoll10(const char *nptr, char **endptr, int *error);
#if SIZEOF_LONG == SIZEOF_LONG_LONG
#define longlong2str(A,B,C) int2str((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;
#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_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
#define thread_safe_increment(V,L) \
pthread_mutex_lock((L)); (V)++; pthread_mutex_unlock((L));
......@@ -678,6 +676,7 @@ extern pthread_t shutdown_th, main_th, signal_th;
pthread_mutex_lock((L)); (V)+=(C); pthread_mutex_unlock((L));
#define thread_safe_sub(V,C,L) \
pthread_mutex_lock((L)); (V)-=(C); pthread_mutex_unlock((L));
#endif /* HAVE_ATOMIC_ADD */
#ifdef SAFE_STATISTICS
#define statistic_increment(V,L) thread_safe_increment((V),(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;
#define statistic_increment(V,L) (V)++
#define statistic_add(V,C,L) (V)+=(C)
#endif /* SAFE_STATISTICS */
#endif /* HAVE_ATOMIC_ADD */
#endif /* thread_safe_increment */
#ifdef __cplusplus
......
......@@ -295,7 +295,12 @@
#define ER_BAD_SLAVE_UNTIL_COND 1276
#define ER_MISSING_SKIP_SLAVE 1277
#define ER_UNTIL_COND_IGNORED 1278
#define ER_WRONG_INDEX_NAME 1279
#define ER_WARN_QC_RESIZE 1280
#define ER_BAD_FT_COLUMN 1281
#define ER_ERROR_MESSAGES 282
#define ER_WRONG_NAME 1279
#define ER_TABLE 1280
#define ER_DATABASE 1281
#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", "",
ER_WARN_NULL_TO_NOTNULL, "01000", "",
ER_WARN_DATA_OUT_OF_RANGE, "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
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_myisam.cc ha_myisammrg.cc handler.cc sql_handler.cc \
hostname.cc init.cc password.c \
......
......@@ -394,7 +394,7 @@ SLAVE_MYLOG="$MYSQL_TEST_DIR/var/log/slave.log"
SLAVE_MYERR="$MYSQL_TEST_DIR/var/log/slave.err"
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 SLAVE_MYPORT
......@@ -795,13 +795,13 @@ manager_launch()
ident=$1
shift
if [ $USE_MANAGER = 0 ] ; then
$@ >> $CUR_MYERR 2>&1 &
$@ >> $CUR_MYERR 2>&1 &
sleep 2 #hack
return
fi
$MYSQL_MANAGER_CLIENT $MANAGER_QUIET_OPT --user=$MYSQL_MANAGER_USER \
--password=$MYSQL_MANAGER_PW --port=$MYSQL_MANAGER_PORT <<EOF
def_exec $ident $@
def_exec $ident "$@"
set_exec_stdout $ident $CUR_MYERR
set_exec_stderr $ident $CUR_MYERR
set_exec_con $ident root localhost $CUR_MYSOCK
......
......@@ -219,6 +219,13 @@ a
test
drop table t1;
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');
update t1 set word2=word;
select word, word=binary 0xdf as t from t1 having t > 0;
......@@ -273,6 +280,11 @@ drop table t1;
CREATE TABLE t1 (
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 ('ue');
SELECT DISTINCT s1 FROM t1;
......
SET CHARACTER SET koi8r;
DROP TABLE IF EXISTS ;
DROP TABLE IF EXISTS , t1;
SET CHARACTER SET koi8r;
CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp1251) SELECT _koi8r'' AS a;
SHOW CREATE TABLE t1;
......@@ -14,7 +14,7 @@ SELECT HEX(a) FROM t1;
HEX(a)
EFF0EEE1E0
DROP TABLE t1;
CREATE TABLE
CREATE TABLE ``
(
CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT " "
) COMMENT " ";
......
This diff is collapsed.
......@@ -65,6 +65,6 @@ NULL
50000
NULL
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)
drop table t1;
......@@ -74,3 +74,4 @@ f
5
7
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
-- error 1044,1
create table not_existing_database.test (a int);
--error 1103
--error 1279
create table `a/a` (a int);
--error 1103
--error 1279
create table `aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa int);
--error 1059
create table a (`aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa` int);
......@@ -66,11 +66,11 @@ create table test_$1.test2$ (a int);
drop table test_$1.test2$;
drop database test_$1;
--error 1103
--error 1279
create table `` (a int);
--error 1103
--error 1279
drop table if exists ``;
--error 1166
--error 1279
create table t1 (`` int);
--error 1279
create table t1 (i int, index `` (i));
......@@ -254,12 +254,16 @@ create table t2 like t3;
show create table t2;
select * from t2;
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
create table non_existing_database.t1 like t1;
!$1051 create table t3 like non_existing_table;
!$1050 create temporary table t3 like t1;
!$1103 create table t3 like `a/a`;
--error 1051
create table t3 like non_existing_table;
--error 1050
create temporary table t3 like t1;
--error 1279
create table t3 like `a/a`;
drop table t1, t2, t3;
drop table t3;
drop database test_$1;
......
......@@ -64,6 +64,7 @@ drop table t1;
# The below checks both binary and character comparisons.
#
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');
update t1 set word2=word;
select word, word=binary 0xdf as t from t1 having t > 0;
......@@ -85,6 +86,7 @@ drop table t1;
CREATE TABLE t1 (
s1 CHAR(5) CHARACTER SET latin1 COLLATE latin1_german2_ci
);
show create table t1;
INSERT INTO t1 VALUES ('');
INSERT INTO t1 VALUES ('ue');
SELECT DISTINCT s1 FROM t1;
......
SET CHARACTER SET koi8r;
--disable_warnings
DROP TABLE IF EXISTS ;
DROP TABLE IF EXISTS , t1;
--enable_warnings
SET CHARACTER SET koi8r;
......@@ -11,7 +11,7 @@ SELECT a FROM t1;
SELECT HEX(a) FROM t1;
DROP TABLE t1;
CREATE TABLE
CREATE TABLE ``
(
CHAR(32) CHARACTER SET koi8r NOT NULL 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 SESSION VARIABLES LIKE "%_format%";
SET date_format="%d.%m.%Y";
select CAST("01.01.2001" as DATE) as a;
SET datetime_format="%d.%m.%Y %H.%i.%s";
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 datetime_format="%d.%m.%Y %h:%i:%s %p";
select CAST("01.01.2001 05:12:06AM" as DATETIME) as a;
select CAST("01.01.2001 05:12:06 PM" as DATETIME) as a;
SET time_format="%h:%i:%s %p";
select CAST("05:12:06 AM" as TIME) as a;
select CAST("05:12:06.1234PM" as TIME) as a;
SET time_format="%h.%i.%s %p";
SET date_format='%d.%m.%y';
SET datetime_format="%d.%m.%y %h.%i.%s %p";
select CAST("12-12-06" as DATE) as a;
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="%H%i%s";
--error 1105
SET time_format="%h%i%s";
--error 1105
#
# Test setting a lot of different formats to see which formats are accepted and
# which aren't
#
SET time_format='%H%i%s';
SET time_format='%H:%i:%s.%f';
SET time_format='%h-%i-%s.%f%p';
SET time_format='%h:%i:%s.%f %p';
SET time_format='%h:%i:%s%p';
SET date_format='%Y%m%d';
SET date_format='%Y.%m.%d';
SET date_format='%d.%m.%Y';
SET date_format='%m-%d-%Y';
set datetime_format= '%Y%m%d%H%i%s';
set datetime_format= '%Y-%m-%d %H:%i:%s';
set datetime_format= '%m-%d-%y %H:%i:%s.%f';
set datetime_format= '%d-%m-%Y %h:%i:%s%p';
set datetime_format= '%H:%i:%s %Y-%m-%d';
set datetime_format= '%H:%i:%s.%f %m-%d-%Y';
set datetime_format= '%h:%i:%s %p %Y-%m-%d';
set datetime_format= '%h:%i:%s.%f %p %Y-%m-%d';
SHOW SESSION VARIABLES LIKE "%format";
--error 1231
SET time_format='%h:%i:%s';
--error 1231
SET time_format='%H %i:%s';
--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';
--error 1105
SET datetime_format="%d.%m.%y %h.%i.%s";
--error 1231
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;
SHOW GLOBAL VARIABLES LIKE "date_format%";
SET GLOBAL time_format=default;
SHOW GLOBAL VARIABLES LIKE "time_format%";
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;
SHOW SESSION VARIABLES LIKE "time_format%";
SET date_format=default;
SET datetime_format=default;
SHOW SESSION VARIABLES LIKE "datetime_format%";
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);
SET GLOBAL date_format='%Y-%m-%d';
SET GLOBAL time_format='%H:%i:%s';
SET GLOBAL datetime_format='%Y-%m-%d %H:%i:%s';
SET date_format='%Y-%m-%d';
SET time_format='%H:%i:%s';
SET datetime_format='%Y-%m-%d %H:%i:%s';
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");
select str_to_date("15 Septembeb 2001", "%d %M %Y");
select str_to_date("15 MAY 2001", "%d %b %Y");
select str_to_date("Sunday 15 MAY 2001", "%W %d %b %Y");
select str_to_date("Sundai 15 MAY 2001", "%W %d %b %Y");
select str_to_date("Sundai 15 MA", "%W %d %b %Y");
select str_to_date("Tuesday 52 2001", "%W %V %X");
select str_to_date("Sunday 01 2001", "%W %V %X");
select str_to_date("Tuesday 00 2002", "%W %U %Y");
select str_to_date("Thursday 53 1998", "%W %u %Y");
select str_to_date("15-01-2001", "%d-%m-%Y %H:%i:%S");
select str_to_date("15-01-20", "%d-%m-%Y");
select str_to_date("15-2001-1", "%d-%Y-%c");
#
# The following tests will work only when we at some point will enable
# dynamic changing of formats
#
# SET date_format='%d.%m.%Y';
# select CAST('01.01.2001' as DATE) as a;
# SET datetime_format='%d.%m.%Y %H.%i.%s';
# 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 datetime_format='%d.%m.%Y %h:%i:%s %p';
# select CAST('01.01.2001 05:12:06AM' as DATETIME) as a;
# select CAST('01.01.2001 05:12:06 PM' as DATETIME) as a;
#
# SET time_format='%h:%i:%s %p';
# select CAST('05:12:06 AM' as TIME) as a;
# select CAST('05:12:06.1234PM' as TIME) as a;
#
# SET time_format='%h.%i.%s %p';
# SET date_format='%d.%m.%y';
# SET datetime_format='%d.%m.%y %h.%i.%s %p';
# select CAST('12-12-06' as DATE) as a;
#
# 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(TIME, 'internal') 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");
connect (con1,localhost,boo,,);
connection con1;
-- error 1064,1102
-- error 1064,1102,1279
drop database AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA;
......@@ -108,3 +108,11 @@ drop temporary table t3;
select * from 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;
#
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";
# Check that we cannot link over a table from another database.
......@@ -75,7 +75,7 @@ create database mysqltest;
--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";
--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";
--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
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,
res= (char**) (ptr+sizeof(alloc));
/* 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*));
/* Skipp --defaults-file and --defaults-extra-file */
(*argc)-= args_used;
......
......@@ -63,7 +63,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \
thr_malloc.cc item_create.cc item_subselect.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 \
lock.cc my_lock.c \
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!",
point[i]= *point +uint2korr(head+10+i+i);
}
VOID(my_close(file,MYF(0)));
DBUG_RETURN(FALSE);
DBUG_RETURN(0);
err:
switch (funktpos) {
......@@ -136,7 +136,7 @@ Check that the above file is the right version for this program!",
if (file != FERR)
VOID(my_close(file,MYF(MY_WME)));
unireg_abort(1);
return 1;
DEBUG_RETURN(1); // Impossible
} /* read_texts */
......
This diff is collapsed.
......@@ -224,7 +224,7 @@ class Field
uint offset(); // Should be inline ...
void copy_from_tmp(int offset);
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 CHARSET_INFO *charset(void) const { return &my_charset_bin; }
virtual bool has_charset(void) const { return FALSE; }
......@@ -647,7 +647,7 @@ class Field_timestamp :public Field_str {
longget(tmp,ptr);
return tmp;
}
bool get_date(TIME *ltime,bool fuzzydate);
bool get_date(TIME *ltime,uint fuzzydate);
bool get_time(TIME *ltime);
};
......@@ -735,7 +735,7 @@ class Field_newdate :public Field_str {
void sql_type(String &str) const;
bool store_for_compare() { 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);
};
......@@ -805,7 +805,7 @@ class Field_datetime :public Field_str {
void sql_type(String &str) const;
bool store_for_compare() { 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);
};
......@@ -1160,9 +1160,6 @@ uint pack_length_to_packflag(uint type);
uint32 calc_pack_length(enum_field_types type,uint32 length);
bool set_field_to_null(Field *field);
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,
CHARSET_INFO *cs);
......
......@@ -42,8 +42,6 @@ void unireg_init(ulong options)
#endif
VOID(strmov(reg_ext,".frm"));
for (i=0 ; i < 6 ; i++) // YYMMDDHHMMSS
dayord.pos[i]=i;
specialflag=SPECIAL_SAME_DB_NAME;
/* Make a tab of powers of 10 */
for (i=0,nr=1.0; i < array_elements(log_10) ; i++)
......
......@@ -46,8 +46,10 @@ Item::Item():
collation.set(default_charset(), DERIVATION_COERCIBLE);
name= 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;
/*
Item constructor can be called during execution other then SQL_COM
......@@ -69,7 +71,7 @@ Item::Item():
Used for duplicating lists in processing queries with temporary
tables
*/
Item::Item(THD *c_thd, Item &item):
Item::Item(THD *thd, Item &item):
str_value(item.str_value),
name(item.name),
max_length(item.max_length),
......@@ -82,8 +84,7 @@ Item::Item(THD *c_thd, Item &item):
fixed(item.fixed),
collation(item.collation)
{
next=c_thd->free_list; // Put in free list
thd= c_thd;
next= thd->free_list; // Put in free list
thd->free_list= this;
}
......@@ -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!
*/
bool Item::get_date(TIME *ltime,bool fuzzydate)
bool Item::get_date(TIME *ltime,uint fuzzydate)
{
char buff[40];
String tmp(buff,sizeof(buff), &my_charset_bin),*res;
if (!(res=val_str(&tmp)) ||
str_to_TIME(res->ptr(),res->length(),ltime,fuzzydate, thd) <=
WRONG_TIMESTAMP_FULL)
str_to_TIME(res->ptr(),res->length(),ltime,fuzzydate) <=
TIMESTAMP_DATETIME_ERROR)
{
bzero((char*) ltime,sizeof(*ltime));
return 1;
......@@ -207,7 +208,7 @@ bool Item::get_time(TIME *ltime)
char buff[40];
String tmp(buff,sizeof(buff),&my_charset_bin),*res;
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));
return 1;
......@@ -360,7 +361,7 @@ String *Item_field::str_result(String *str)
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))
{
......@@ -370,7 +371,7 @@ bool Item_field::get_date(TIME *ltime,bool fuzzydate)
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()) ||
result_field->get_date(ltime,fuzzydate))
......@@ -692,28 +693,25 @@ String *Item_param::query_val_str(String* str)
}
else
{
DATETIME_FORMAT *tmp_format= 0;
bool is_time_only= 0;
char buff[40];
String tmp(buff,sizeof(buff), &my_charset_bin);
switch (ltime.time_type) {
case TIMESTAMP_NONE:
case WRONG_TIMESTAMP_FULL:
break;
case TIMESTAMP_DATE:
tmp_format= &t_datetime_frm(thd, DATE_FORMAT_TYPE).datetime_format;
break;
case TIMESTAMP_FULL:
tmp_format= &t_datetime_frm(thd, DATETIME_FORMAT_TYPE).datetime_format;
break;
case TIMESTAMP_TIME:
{
tmp_format= &t_datetime_frm(thd, TIME_FORMAT_TYPE).datetime_format;
is_time_only= 1;
break;
}
case TIMESTAMP_NONE:
case TIMESTAMP_DATETIME_ERROR:
tmp.length(0); // Should never happen
break;
case TIMESTAMP_DATE:
make_date((DATE_TIME_FORMAT*) 0, &ltime, &tmp);
break;
case TIMESTAMP_DATETIME:
make_datetime((DATE_TIME_FORMAT*) 0, &ltime, &tmp);
break;
case TIMESTAMP_TIME:
make_time((DATE_TIME_FORMAT*) 0, &ltime, &tmp);
break;
}
make_datetime(str, &ltime, is_time_only, 0,
tmp_format->format, tmp_format->format_length, 0);
str->append(tmp);
}
str->append('\'');
}
......@@ -769,7 +767,7 @@ String* Item_ref_null_helper::val_str(String* s)
owner->was_null|= null_value= (*ref)->null_value;
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));
}
......@@ -990,6 +988,7 @@ enum_field_types Item::field_type() const
FIELD_TYPE_DOUBLE);
}
Field *Item::tmp_table_field_from_field_type(TABLE *table)
{
switch (field_type())
......@@ -1366,7 +1365,7 @@ bool Item::send(Protocol *protocol, String *buffer)
case MYSQL_TYPE_TIMESTAMP:
{
TIME tm;
get_date(&tm, 1);
get_date(&tm, TIME_FUZZY_DATE);
if (!null_value)
{
if (type == MYSQL_TYPE_DATE)
......
......@@ -114,14 +114,6 @@ class Item {
my_bool fixed; /* If item fixed with fix_fields */
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
Item();
/*
......@@ -132,7 +124,7 @@ class Item {
top AND/OR ctructure of WHERE clause to protect it of
optimisation changes in prepared statements
*/
Item(THD *c_thd, Item &item);
Item(THD *thd, Item &item);
virtual ~Item() { name=0; } /*lint -e1509 */
void set_name(const char *str,uint length, CHARSET_INFO *cs);
void init_make_field(Send_field *tmp_field,enum enum_field_types type);
......@@ -185,9 +177,9 @@ class Item {
void print_item_w_name(String *);
virtual void update_used_tables() {}
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_date_result(TIME *ltime,bool fuzzydate)
virtual bool get_date_result(TIME *ltime,uint fuzzydate)
{ return get_date(ltime,fuzzydate); }
virtual bool is_null() { return 0; }
virtual void top_level_item() {}
......@@ -286,8 +278,8 @@ class Item_field :public Item_ident
}
Field *get_tmp_table_field() { return result_field; }
Field *tmp_table_field(TABLE *t_arg) { return result_field; }
bool get_date(TIME *ltime,bool fuzzydate);
bool get_date_result(TIME *ltime,bool fuzzydate);
bool get_date(TIME *ltime,uint fuzzydate);
bool get_date_result(TIME *ltime,uint fuzzydate);
bool get_time(TIME *ltime);
bool is_null() { return field->is_null(); }
Item *get_tmp_table_item(THD *thd);
......@@ -469,6 +461,13 @@ class Item_string :public Item
{
collation.set(cs, dv);
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;
set_name(str, length, cs);
decimals=NOT_FIXED_DEC;
......@@ -623,7 +622,7 @@ class Item_ref :public Item_ident
(void) (*ref)->val_int_result();
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));
}
......@@ -658,7 +657,7 @@ class Item_ref_null_helper: public Item_ref
double val();
longlong val_int();
String* val_str(String* s);
bool get_date(TIME *ltime, bool fuzzydate);
bool get_date(TIME *ltime, uint fuzzydate);
void print(String *str);
};
......
......@@ -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;
LINT_INIT(res);
......
......@@ -1323,8 +1323,8 @@ void Item_func_find_in_set::fix_length_and_dec()
String *find=args[0]->val_str(&value);
if (find)
{
enum_value=find_enum(((Field_enum*) field)->typelib,find->ptr(),
find->length());
enum_value= find_type(((Field_enum*) field)->typelib,find->ptr(),
find->length(), 0);
enum_bit=0;
if (enum_value)
enum_bit=LL(1) << (enum_value-1);
......@@ -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,
......@@ -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'
in dispatch_command()). Instead of building a one-element list to pass to
sql_set_variables(), we could instead manually call check() and update();
this would save memory and time; but calling sql_set_variables() makes one
unique place to maintain (sql_set_variables()).
this would save memory and time; but calling sql_set_variables() makes
one unique place to maintain (sql_set_variables()).
*/
List<set_var_base> tmp_var_list;
tmp_var_list.push_back(new set_var_user(new Item_func_set_user_var(name,
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;
if (!(var_entry= get_variable(&thd->user_vars, name, 0)))
goto err;
......
......@@ -127,9 +127,9 @@ class Item_func :public Item_result_field
void print_op(String *str);
void print_args(String *str, uint from);
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)
{
......
......@@ -361,7 +361,7 @@ class Item_func_database :public Item_str_func
String *val_str(String *);
void fix_length_and_dec()
{
max_length= MAX_FIELD_NAME * system_charset_info->mbmaxlen;
max_length= MAX_FIELD_NAME * system_charset_info->mbmaxlen;
}
const char *func_name() const { return "database"; }
};
......@@ -373,7 +373,7 @@ class Item_func_user :public Item_str_func
String *val_str(String *);
void fix_length_and_dec()
{
max_length= (USERNAME_LENGTH+HOSTNAME_LENGTH+1)*system_charset_info->mbmaxlen;
max_length= (USERNAME_LENGTH+HOSTNAME_LENGTH+1)*system_charset_info->mbmaxlen;
}
const char *func_name() const { return "user"; }
};
......
This diff is collapsed.
This diff is collapsed.
......@@ -756,6 +756,13 @@ bool open_log(MYSQL_LOG *log, const char *hostname,
/* mysqld.cc */
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
*/
......@@ -849,7 +856,6 @@ extern pthread_attr_t connection_attrib;
extern I_List<THD> threads;
extern I_List<NAMED_LIST> key_caches;
extern MY_BITMAP temp_pool;
extern DATE_FORMAT dayord;
extern String my_empty_string;
extern String my_null_string;
extern SHOW_VAR init_vars[],status_vars[], internal_vars[];
......@@ -861,12 +867,8 @@ extern struct system_variables global_system_variables;
extern struct system_variables max_system_variables;
extern struct rand_struct sql_rand;
#define g_datetime_frm(a) (global_system_variables.datetime_formats[(a)])
#define t_datetime_frm(a, b) ((a)->variables.datetime_formats[(b)])
extern const char *datetime_formats[4][5];
extern const char *opt_datetime_format_names[3];
extern const char *opt_datetime_formats[3];
extern const char *opt_date_time_formats[];
extern KNOWN_DATE_TIME_FORMAT known_date_time_formats[];
extern String null_string;
extern HASH open_cache;
......@@ -938,23 +940,26 @@ void get_date_from_daynr(long daynr,uint *year, uint *month,
uint *day);
void init_time(void);
long my_gmt_sec(TIME *, long *current_timezone);
time_t str_to_timestamp(const char *str,uint length, THD *thd);
bool str_to_time(const char *str,uint length,TIME *l_time, THD *thd);
longlong str_to_datetime(const char *str,uint length,bool fuzzy_date, THD *thd);
time_t str_to_timestamp(const char *str,uint length);
bool str_to_time(const char *str,uint length,TIME *l_time);
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,
bool fuzzy_date, THD *thd);
uint flags);
void localtime_to_TIME(TIME *to, struct tm *from);
void calc_time_from_sec(TIME *to, long seconds, long microseconds);
extern DATETIME_FORMAT *make_format(DATETIME_FORMAT *datetime_format,
datetime_format_types format_type,
const char *format_str,
uint format_length, bool is_alloc);
extern String *make_datetime(String *str, TIME *l_time,
const bool is_time_only,
const bool add_second_frac,
const char *ptr, uint format_length,
bool set_len_to_zero);
extern DATE_TIME_FORMAT *date_time_format_make(timestamp_type format_type,
const char *format_str,
uint format_length);
extern DATE_TIME_FORMAT *date_time_format_copy(THD *thd,
DATE_TIME_FORMAT *format);
const char *get_date_time_format_str(KNOWN_DATE_TIME_FORMAT *format,
timestamp_type type);
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);
void change_byte(byte *,uint,char,char);
......
......@@ -318,10 +318,7 @@ char mysql_real_data_home[FN_REFLEN],
language[LIBLEN],reg_ext[FN_EXTLEN], mysql_charsets_dir[FN_REFLEN],
max_sort_char,*mysqld_user,*mysqld_chroot, *opt_init_file;
const char *opt_datetime_formats[3];
const char *opt_datetime_format_names[3]= {"date_format",
"time_format",
"datetime_format"};
const char *opt_date_time_formats[3];
char *language_ptr, *default_collation_name, *default_character_set_name;
char mysql_data_home_buff[2], *mysql_data_home=mysql_real_data_home;
......@@ -357,7 +354,6 @@ struct system_variables global_system_variables;
struct system_variables max_system_variables;
MY_TMPDIR mysql_tmpdir_list;
DATE_FORMAT dayord;
MY_BITMAP temp_pool;
CHARSET_INFO *system_charset_info, *files_charset_info ;
......@@ -921,9 +917,12 @@ void clean_up(bool print_message)
#ifdef USE_RAID
end_raid();
#endif
g_datetime_frm(DATE_FORMAT_TYPE).clean();
g_datetime_frm(TIME_FORMAT_TYPE).clean();
g_datetime_frm(DATETIME_FORMAT_TYPE).clean();
my_free((char*) global_system_variables.date_format,
MYF(MY_ALLOW_ZERO_PTR));
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)
free_defaults(defaults_argv);
free_tmpdir(&mysql_tmpdir_list);
......@@ -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];
uint format_length= 0;
DATETIME_FORMAT *tmp_format= &g_datetime_frm(format_type).datetime_format;
/* Get command line option */
const char *str= opt_date_time_formats[format_type];
DATE_TIME_FORMAT *format;
if (format_str)
if (!str) // No specified format
{
format_str= opt_datetime_formats[format_type];
format_length= strlen(format_str);
}
else
{
format_str= datetime_formats[format_type][ISO_FORMAT];
format_length= strlen(datetime_formats[format_type][ISO_FORMAT]);
opt_datetime_formats[format_type]= format_str;
str= get_date_time_format_str(&known_date_time_formats[ISO_FORMAT],
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;
}
if (make_format(tmp_format, format_type, format_str,
format_length, is_alloc))
if (!(*var_ptr= date_time_format_make(format_type, str, strlen(str))))
{
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;
fprintf(stderr, "Wrong date/time format specifier: %s\n", str);
return 1;
}
return 1;
return 0;
}
......@@ -2160,17 +2172,12 @@ static int init_common_variables(const char *conf_file_name, int argc,
}
default_charset_info= default_collation;
}
global_system_variables.collation_server= default_charset_info;
global_system_variables.collation_database= default_charset_info;
global_system_variables.collation_connection= default_charset_info;
/* Set collactions that depends on the default collation */
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.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;
global_system_variables.character_set_client= default_charset_info;
if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1))
return 1;
......@@ -4606,7 +4613,7 @@ The minimum value for this variable is 4096.",
(gptr*) &max_system_variables.net_wait_timeout, 0, GET_ULONG,
REQUIRED_ARG, NET_WAIT_TIMEOUT, 1, LONG_TIMEOUT, 0, 1, 0},
{"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, 0, GET_ULONG,
REQUIRED_ARG, 0, 0, 99, 0, 1, 0},
......@@ -4616,23 +4623,24 @@ The minimum value for this variable is 4096.",
(gptr*) &max_system_variables.default_week_format,
0, GET_ULONG, REQUIRED_ARG, 0, 0, 3L, 0, 1, 0},
{ "date-format", OPT_DATE_FORMAT,
"The DATE format.",
(gptr*) &opt_datetime_formats[DATE_FORMAT_TYPE],
(gptr*) &opt_datetime_formats[DATE_FORMAT_TYPE],
"The DATE format (For future).",
(gptr*) &opt_date_time_formats[TIMESTAMP_DATE],
(gptr*) &opt_date_time_formats[TIMESTAMP_DATE],
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "datetime-format", OPT_DATETIME_FORMAT,
"The DATETIME/TIMESTAMP format.",
(gptr*) &opt_datetime_formats[DATETIME_FORMAT_TYPE],
(gptr*) &opt_datetime_formats[DATETIME_FORMAT_TYPE],
"The DATETIME/TIMESTAMP format (for future).",
(gptr*) &opt_date_time_formats[TIMESTAMP_DATETIME],
(gptr*) &opt_date_time_formats[TIMESTAMP_DATETIME],
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
{ "time-format", OPT_TIME_FORMAT,
"The TIME format.",
(gptr*) &opt_datetime_formats[TIME_FORMAT_TYPE],
(gptr*) &opt_datetime_formats[TIME_FORMAT_TYPE],
"The TIME format (for future).",
(gptr*) &opt_date_time_formats[TIMESTAMP_TIME],
(gptr*) &opt_date_time_formats[TIMESTAMP_TIME],
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}
};
struct show_var_st status_vars[]= {
{"Aborted_clients", (char*) &aborted_threads, SHOW_LONG},
{"Aborted_connects", (char*) &aborted_connects, SHOW_LONG},
......@@ -4944,6 +4952,8 @@ static void mysql_init_variables(void)
national_charset_info= &my_charset_utf8_general_ci;
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 */
delay_key_write_options= (uint) DELAY_KEY_WRITE_ON;
opt_specialflag= SPECIAL_ENGLISH;
......@@ -5001,11 +5011,6 @@ static void mysql_init_variables(void)
/* 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.tx_isolation= ISO_REPEATABLE_READ;
global_system_variables.select_limit= (ulonglong) HA_POS_ERROR;
......@@ -5014,10 +5019,6 @@ static void mysql_init_variables(void)
max_system_variables.max_join_size= (ulonglong) HA_POS_ERROR;
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 */
#ifndef DBUG_OFF
default_dbug_option=IF_WIN("d:t:i:O,\\mysqld.trace",
......@@ -5626,7 +5627,7 @@ static void get_options(int argc,char **argv)
exit(ho_error);
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);
}
......@@ -5681,6 +5682,15 @@ static void get_options(int argc,char **argv)
opt_specialflag|= SPECIAL_SHORT_LOG_FORMAT;
if (opt_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 */
KEY_CACHE_VAR *key_cache= &dflt_key_cache_var;
dflt_key_cache_block_size= key_cache->block_size;
......
......@@ -833,12 +833,17 @@ bool Protocol_simple::store(TIME *tm)
field_pos++;
#endif
char buff[40];
String tmp((char*) buff,sizeof(buff),&my_charset_bin);
DATETIME_FORMAT *tmp_format= (&t_datetime_frm
(current_thd, DATETIME_FORMAT_TYPE).datetime_format);
make_datetime(&tmp, tm, 1, tm->second_part,
tmp_format->format, tmp_format->format_length, 1);
return net_store_data((char*) tmp.ptr(), tmp.length());
uint length;
length= my_sprintf(buff,(buff, "%04d-%02d-%02d %02d:%02d:%02d",
(int) tm->year,
(int) tm->month,
(int) tm->day,
(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)
#endif
char buff[40];
String tmp((char*) buff,sizeof(buff),&my_charset_bin);
DATETIME_FORMAT *tmp_format= (&t_datetime_frm
(current_thd, DATE_FORMAT_TYPE).datetime_format);
make_datetime(&tmp, tm, 1, 0,
tmp_format->format, tmp_format->format_length, 1);
make_date((DATE_TIME_FORMAT *) 0, tm, &tmp);
return net_store_data((char*) tmp.ptr(), tmp.length());
}
......@@ -873,14 +875,16 @@ bool Protocol_simple::store_time(TIME *tm)
field_pos++;
#endif
char buff[40];
String tmp((char*) buff,sizeof(buff),&my_charset_bin);
DATETIME_FORMAT *tmp_format= (&t_datetime_frm
(current_thd, TIME_FORMAT_TYPE).datetime_format);
uint length;
uint day= (tm->year || tm->month) ? 0 : tm->day;
tm->hour= (long) day*24L+(long) tm->hour;
make_datetime(&tmp, tm, 0, tm->second_part,
tmp_format->format, tmp_format->format_length, 1);
return net_store_data((char*) tmp.ptr(), tmp.length());
length= my_sprintf(buff,(buff, "%s%02ld:%02d:%02d",
tm->neg ? "-" : "",
(long) day*24L+(long) 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);
}
......
This diff is collapsed.
......@@ -54,8 +54,6 @@ class sys_var
const char *name;
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,sys_after_update_func func)
......@@ -195,9 +193,6 @@ class sys_var_enum :public sys_var
class sys_var_thd :public sys_var
{
public:
sys_var_thd()
:sys_var()
{}
sys_var_thd(const char *name_arg)
:sys_var(name_arg)
{}
......@@ -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:
enum datetime_format_types format_type;
DATETIME_FORMAT datetime_format;
sys_var_datetime_format(): sys_var_thd()
sys_var_thd_date_time_format(const char *name_arg,
DATE_TIME_FORMAT *SV::*offset_arg,
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; }
bool check_update_type(Item_result type)
{
return type != STRING_RESULT; /* Only accept strings */
}
bool check_default(enum_var_type type) { return 0; }
bool check(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);
void set_default(THD *thd, enum_var_type type);
};
......@@ -718,6 +693,7 @@ class set_var :public set_var_base
CHARSET_INFO *charset;
ulong ulong_value;
ulonglong ulonglong_value;
DATE_TIME_FORMAT *date_time_format;
} save_result;
LEX_STRING base; /* for structs */
......
......@@ -276,21 +276,26 @@ character-set=latin2
"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, 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'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"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 drop 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 for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"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."
"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"
"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",
"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"
"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"
"Incorrect index name '%-.100s'",
"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",
"SQL thread is not to be started so UNTIL options are ignored",
"Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"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
"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, 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'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"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 drop 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 for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"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."
"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"
"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",
"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"
"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"
"Incorrect index name '%-.100s'",
"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",
"SQL thread is not to be started so UNTIL options are ignored",
"Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"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
"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, 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'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"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 drop 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 for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"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."
"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"
"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",
"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"
"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"
"Incorrect index name '%-.100s'",
"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",
"SQL thread is not to be started so UNTIL options are ignored",
"Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"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
"Reference '%-.64s' not supported (%s)",
"Every derived table must have it's own alias",
"Select %u was reduced during optimisation",
"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"
"All parts of a SPATIAL KEY must be NOT NULL"
"COLLATION '%s' is not valid for CHARACTER SET '%s'"
"Slave is already running"
"Slave has already been stopped"
"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"
"Z_BUF_ERROR: 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"
"%d line(s) was(were) cut by group_concat()"
"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",
"All parts of a SPATIAL KEY must be NOT NULL",
"COLLATION '%s' is not valid for CHARACTER SET '%s'",
"Slave is already running",
"Slave has already been stopped",
"Too big size of uncompressed data. The maximum size is %d. (probably, length of uncompressed data was corrupted)",
"ZLIB: Not enough memory available for zlib",
"ZLIB: Not enough room in the output buffer for zlib (probably, length of uncompressed data was corrupted)",
"ZLIB: Input data was corrupted for zlib",
"%d line(s) was(were) cut by group_concat()",
"Record count is fewer 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, 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'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"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 drop 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 for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"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."
"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",
"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",
"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"
"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"
"Incorrect index name '%-.100s'",
"Wrong parameter or combination of parameters for START SLAVE UNTIL",
"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",
"Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"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
"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, 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'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"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 drop 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 for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"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."
"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"
"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",
"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"
"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"
"Incorrect index name '%-.100s'",
"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",
"SQL thread is not to be started so UNTIL options are ignored",
"Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"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
"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, 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'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"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 drop 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 for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"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."
"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"
"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",
"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"
"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"
"Incorrect index name '%-.100s'",
"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",
"SQL thread is not to be started so UNTIL options are ignored",
"Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"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
"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",
"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"
"Incorrect index name '%-.100s'",
"SQL-Thread soll nicht gestartet werden. Daher werden UNTIL-Optionen ignoriert",
"Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"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
"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, 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'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"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 drop 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 for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"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."
"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"
"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",
"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"
"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"
"Incorrect index name '%-.100s'",
"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",
"SQL thread is not to be started so UNTIL options are ignored",
"Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"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
"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, 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'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"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 drop 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 for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"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."
"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"
"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",
"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"
"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"
"Incorrect index name '%-.100s'",
"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",
"SQL thread is not to be started so UNTIL options are ignored",
"Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"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
"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, 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'",
"Illegal mix of collations (%s,%s) and (%s,%s) for operation '%s'",
"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 drop 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 for operation '%s'",
"Variable '%-.64s' is not a variable component (Can't be used as XXXX.variable_name)",
"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."
"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"
"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",
"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"
"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"
"Incorrect index name '%-.100s'",
"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",
"SQL thread is not to be started so UNTIL options are ignored",
"Incorrect %s name '%-.100s'",
"table",
"database",
"column",
"index",
"catalog",
"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.
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,
map->clear_all();
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(),
table->real_name);
......
This diff is collapsed.
......@@ -421,7 +421,11 @@ struct system_variables
CHARSET_INFO *collation_server;
CHARSET_INFO *collation_database;
CHARSET_INFO *collation_connection;
sys_var_datetime_format datetime_formats[3];
/* DATE, DATETIME and TIME formats */
DATE_TIME_FORMAT *date_format;
DATE_TIME_FORMAT *datetime_format;
DATE_TIME_FORMAT *time_format;
};
void free_tmp_table(THD *thd, TABLE *entry);
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -332,7 +332,7 @@ SETUP_PARAM_FUNCTION(setup_param_datetime)
tm.day= (uint) to[3];
tm.neg= 0;
param->set_time(&tm, TIMESTAMP_FULL);
param->set_time(&tm, TIMESTAMP_DATETIME);
}
*pos+= length;
}
......
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