Commit cca3fc67 authored by mskold@mysql.com's avatar mskold@mysql.com

Merge mskold@bk-internal.mysql.com:/home/bk/mysql-4.1

into mysql.com:/usr/local/home/marty/MySQL/test/mysql-4.1
parents da1f5728 985400e0
...@@ -940,3 +940,6 @@ ndbcluster-1186/ndb_3_out.log ...@@ -940,3 +940,6 @@ ndbcluster-1186/ndb_3_out.log
ndbcluster-1186/ndbcluster.pid ndbcluster-1186/ndbcluster.pid
ndb/tools/ndb_restore ndb/tools/ndb_restore
ac_available_languages_fragment ac_available_languages_fragment
libmysqld/ha_archive.cc
libmysqld/ha_example.cc
libmysqld/ha_tina.cc
...@@ -825,10 +825,17 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv) ...@@ -825,10 +825,17 @@ static int execute_commands(MYSQL *mysql,int argc, char **argv)
} }
if (argv[1][0]) if (argv[1][0])
{ {
char *pw= argv[1];
#ifdef __WIN__
uint pw_len= strlen(pw);
if (pw_len > 1 && pw[0] == '\'' && pw[pw_len-1] == '\'')
printf("Warning: single quotes were not trimmed from the password by"
" your command\nline client, as you might have expected.\n");
#endif
if (find_type(argv[0], &command_typelib, 2) == ADMIN_OLD_PASSWORD) if (find_type(argv[0], &command_typelib, 2) == ADMIN_OLD_PASSWORD)
make_scrambled_password_323(crypted_pw, argv[1]); make_scrambled_password_323(crypted_pw, pw);
else else
make_scrambled_password(crypted_pw, argv[1]); make_scrambled_password(crypted_pw, pw);
} }
else else
crypted_pw[0]=0; /* No password */ crypted_pw[0]=0; /* No password */
......
...@@ -41,6 +41,13 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef, ...@@ -41,6 +41,13 @@ int heap_create(const char *name, uint keys, HP_KEYDEF *keydef,
{ {
HP_KEYDEF *keyinfo; HP_KEYDEF *keyinfo;
DBUG_PRINT("info",("Initializing new table")); DBUG_PRINT("info",("Initializing new table"));
/*
We have to store sometimes byte* del_link in records,
so the record length should be at least sizeof(byte*)
*/
set_if_bigger(reclength, sizeof (byte*));
for (i= key_segs= max_length= 0, keyinfo= keydef; i < keys; i++, keyinfo++) for (i= key_segs= max_length= 0, keyinfo= keydef; i < keys; i++, keyinfo++)
{ {
bzero((char*) &keyinfo->block,sizeof(keyinfo->block)); bzero((char*) &keyinfo->block,sizeof(keyinfo->block));
......
...@@ -41,7 +41,9 @@ AC_CHECK_SIZEOF(long, 4) ...@@ -41,7 +41,9 @@ AC_CHECK_SIZEOF(long, 4)
AC_CHECK_SIZEOF(void*, 4) AC_CHECK_SIZEOF(void*, 4)
AC_CHECK_FUNCS(sched_yield) AC_CHECK_FUNCS(sched_yield)
AC_CHECK_FUNCS(fdatasync) AC_CHECK_FUNCS(fdatasync)
#AC_CHECK_FUNCS(localtime_r) # Already checked by MySQL AC_CHECK_FUNCS(localtime_r)
#AC_CHECK_FUNCS(readdir_r) MySQL checks that it has also the right args.
# Some versions of Unix only take 2 arguments.
#AC_C_INLINE Already checked in MySQL #AC_C_INLINE Already checked in MySQL
AC_C_BIGENDIAN AC_C_BIGENDIAN
......
...@@ -711,13 +711,41 @@ dbname.sym can redirect a database directory: ...@@ -711,13 +711,41 @@ dbname.sym can redirect a database directory:
char* full_path; char* full_path;
int ret; int ret;
struct stat statinfo; struct stat statinfo;
#ifdef HAVE_READDIR_R
char dirent_buf[sizeof(struct dirent) + _POSIX_PATH_MAX +
100];
/* In /mysys/my_lib.c, _POSIX_PATH_MAX + 1 is used as
the max file name len; but in most standards, the
length is NAME_MAX; we add 100 to be even safer */
#endif
next_file: next_file:
ent = readdir(dir);
#ifdef HAVE_READDIR_R
ret = readdir_r(dir, (struct dirent*)dirent_buf, &ent);
if (ret != 0) {
fprintf(stderr,
"InnoDB: cannot read directory %s, error %lu\n", dirname, (ulong)ret);
return(-1);
}
if (ent == NULL) { if (ent == NULL) {
/* End of directory */
return(1); return(1);
} }
ut_a(strlen(ent->d_name) < _POSIX_PATH_MAX + 100 - 1);
#else
ent = readdir(dir);
if (ent == NULL) {
return(1);
}
#endif
ut_a(strlen(ent->d_name) < OS_FILE_MAX_PATH); ut_a(strlen(ent->d_name) < OS_FILE_MAX_PATH);
if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) { if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0) {
......
...@@ -235,13 +235,18 @@ ut_get_year_month_day( ...@@ -235,13 +235,18 @@ ut_get_year_month_day(
*month = (ulint)cal_tm.wMonth; *month = (ulint)cal_tm.wMonth;
*day = (ulint)cal_tm.wDay; *day = (ulint)cal_tm.wDay;
#else #else
struct tm cal_tm;
struct tm* cal_tm_ptr; struct tm* cal_tm_ptr;
time_t tm; time_t tm;
time(&tm); time(&tm);
#ifdef HAVE_LOCALTIME_R
localtime_r(&tm, &cal_tm);
cal_tm_ptr = &cal_tm;
#else
cal_tm_ptr = localtime(&tm); cal_tm_ptr = localtime(&tm);
#endif
*year = (ulint)cal_tm_ptr->tm_year + 1900; *year = (ulint)cal_tm_ptr->tm_year + 1900;
*month = (ulint)cal_tm_ptr->tm_mon + 1; *month = (ulint)cal_tm_ptr->tm_mon + 1;
*day = (ulint)cal_tm_ptr->tm_mday; *day = (ulint)cal_tm_ptr->tm_mday;
......
...@@ -26,7 +26,7 @@ DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \ ...@@ -26,7 +26,7 @@ DEFS = -DEMBEDDED_LIBRARY -DMYSQL_SERVER \
-DDATADIR="\"$(MYSQLDATAdir)\"" \ -DDATADIR="\"$(MYSQLDATAdir)\"" \
-DSHAREDIR="\"$(MYSQLSHAREdir)\"" -DSHAREDIR="\"$(MYSQLSHAREdir)\""
INCLUDES= @MT_INCLUDES@ @bdb_includes@ -I$(top_srcdir)/include \ INCLUDES= @MT_INCLUDES@ @bdb_includes@ -I$(top_srcdir)/include \
-I$(top_srcdir)/sql -I$(top_srcdir)/regex \ -I$(top_srcdir)/sql -I$(top_srcdir)/sql/examples -I$(top_srcdir)/regex \
$(openssl_includes) @ZLIB_INCLUDES@ $(openssl_includes) @ZLIB_INCLUDES@
noinst_LIBRARIES = libmysqld_int.a noinst_LIBRARIES = libmysqld_int.a
...@@ -35,6 +35,7 @@ SUBDIRS = . examples ...@@ -35,6 +35,7 @@ SUBDIRS = . examples
libmysqld_sources= libmysqld.c lib_sql.cc emb_qcache.cc libmysqld_sources= libmysqld.c lib_sql.cc emb_qcache.cc
libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c \ libmysqlsources = errmsg.c get_password.c libmysql.c client.c pack.c \
my_time.c my_time.c
sqlexamplessources = ha_example.cc ha_archive.cc ha_tina.cc
noinst_HEADERS = embedded_priv.h emb_qcache.h noinst_HEADERS = embedded_priv.h emb_qcache.h
...@@ -59,7 +60,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \ ...@@ -59,7 +60,7 @@ sqlsources = derror.cc field.cc field_conv.cc strfunc.cc filesort.cc \
unireg.cc uniques.cc stacktrace.c sql_union.cc hash_filo.cc \ unireg.cc uniques.cc stacktrace.c sql_union.cc hash_filo.cc \
spatial.cc gstream.cc sql_help.cc tztime.cc spatial.cc gstream.cc sql_help.cc tztime.cc
libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) libmysqld_int_a_SOURCES= $(libmysqld_sources) $(libmysqlsources) $(sqlsources) $(sqlexamplessources)
libmysqld_a_SOURCES= libmysqld_a_SOURCES=
# automake misses these # automake misses these
...@@ -123,12 +124,16 @@ link_sources: ...@@ -123,12 +124,16 @@ link_sources:
rm -f $(srcdir)/$$f; \ rm -f $(srcdir)/$$f; \
@LN_CP_F@ $(srcdir)/../libmysql/$$f $(srcdir)/$$f; \ @LN_CP_F@ $(srcdir)/../libmysql/$$f $(srcdir)/$$f; \
done; \ done; \
for f in $(sqlexamplessources); do \
rm -f $(srcdir)/$$f; \
@LN_CP_F@ $(srcdir)/../sql/examples/$$f $(srcdir)/$$f; \
done; \
rm -f $(srcdir)/client_settings.h; \ rm -f $(srcdir)/client_settings.h; \
@LN_CP_F@ $(srcdir)/../libmysql/client_settings.h $(srcdir)/client_settings.h; @LN_CP_F@ $(srcdir)/../libmysql/client_settings.h $(srcdir)/client_settings.h;
clean-local: clean-local:
rm -f `echo $(sqlsources) $(libmysqlsources) | sed "s;\.lo;.c;g"` \ rm -f `echo $(sqlsources) $(libmysqlsources) $(sqlexamplessources) | sed "s;\.lo;.c;g"` \
$(top_srcdir)/linked_libmysqld_sources; \ $(top_srcdir)/linked_libmysqld_sources; \
rm -f client_settings.h rm -f client_settings.h
......
select 'a' = 'a', 'a' = 'a ', 'a ' = 'a';
select 'a\0' = 'a', 'a\0' < 'a', 'a\0' > 'a';
select 'a' = 'a\0', 'a' < 'a\0', 'a' > 'a\0';
select 'a\0' = 'a ', 'a\0' < 'a ', 'a\0' > 'a ';
select 'a ' = 'a\0', 'a ' < 'a\0', 'a ' > 'a\0';
select 'a a' > 'a', 'a \0' < 'a';
select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a';
...@@ -1387,13 +1387,18 @@ run_testcase () ...@@ -1387,13 +1387,18 @@ run_testcase ()
# script soon anyway so it is not worth it spending the time # script soon anyway so it is not worth it spending the time
if [ "x$USE_EMBEDDED_SERVER" = "x1" -a -z "$DO_TEST" ] ; then if [ "x$USE_EMBEDDED_SERVER" = "x1" -a -z "$DO_TEST" ] ; then
for t in \ for t in \
"alter_table" \
"bdb-deadlock" \ "bdb-deadlock" \
"connect" \ "connect" \
"ctype_latin1_de" \
"ctype_ucs" \
"flush_block_commit" \ "flush_block_commit" \
"grant2" \ "grant2" \
"grant_cache" \ "grant_cache" \
"grant" \ "grant" \
"init_connect" \ "init_connect" \
"init_file" \
"innodb" \
"innodb-deadlock" \ "innodb-deadlock" \
"innodb-lock" \ "innodb-lock" \
"mix_innodb_myisam_binlog" \ "mix_innodb_myisam_binlog" \
...@@ -1401,10 +1406,12 @@ run_testcase () ...@@ -1401,10 +1406,12 @@ run_testcase ()
"mysqlbinlog" \ "mysqlbinlog" \
"mysqldump" \ "mysqldump" \
"mysql_protocols" \ "mysql_protocols" \
"packet" \
"ps_1general" \ "ps_1general" \
"rename" \ "rename" \
"show_check" \ "show_check" \
"system_mysql_db_fix" \ "system_mysql_db_fix" \
"timezone2" \
"user_var" \ "user_var" \
"variables" "variables"
do do
......
drop table if exists t1;
SET @test_character_set= 'big5';
SET @test_collation= 'big5_chinese_ci';
SET @safe_character_set_server= @@character_set_server;
SET @safe_collation_server= @@collation_server;
SET character_set_server= @test_character_set;
SET collation_server= @test_collation;
CREATE DATABASE d1;
USE d1;
CREATE TABLE t1 (c CHAR(10), KEY(c));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c char(10) big5_chinese_ci YES MUL NULL
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
want3results
aaa
aaaa
aaaaa
DROP TABLE t1;
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
SHOW FULL COLUMNS FROM t1;
Field Type Collation Null Key Default Extra Privileges Comment
c1 varchar(15) big5_chinese_ci YES MUL NULL
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
SELECT c1 as want3results from t1 where c1 like 'l%';
want3results
location
loberge
lotre
SELECT c1 as want3results from t1 where c1 like 'lo%';
want3results
location
loberge
lotre
SELECT c1 as want1result from t1 where c1 like 'loc%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'loca%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locat%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locati%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'locatio%';
want1result
location
SELECT c1 as want1result from t1 where c1 like 'location%';
want1result
location
DROP TABLE t1;
DROP DATABASE d1;
USE test;
SET character_set_server= @safe_character_set_server;
SET collation_server= @safe_collation_server;
SET CHARACTER SET koi8r;
DROP TABLE IF EXISTS , t1, t2;
SET CHARACTER SET koi8r;
CREATE TABLE t1 (a CHAR(10) CHARACTER SET cp1251) SELECT _koi8r'' AS a;
CREATE TABLE t2 (a CHAR(10) CHARACTER SET utf8);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(10) character set cp1251 default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT a FROM t1;
a
SELECT HEX(a) FROM t1;
HEX(a)
EFF0EEE1E0
INSERT t2 SELECT * FROM t1;
SELECT HEX(a) FROM t2;
HEX(a)
D0BFD180D0BED0B1D0B0
DROP TABLE t1, t2;
CREATE TABLE t1 (description text character set cp1250 NOT NULL);
INSERT INTO t1 (description) VALUES (_latin2'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddde');
SELECT description FROM t1;
description
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasssssssssssaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddde
DROP TABLE t1;
CREATE TABLE t1 (a TEXT CHARACTER SET cp1251) SELECT _koi8r'' AS a;
CREATE TABLE t2 (a TEXT CHARACTER SET utf8);
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` text character set cp1251
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SELECT HEX(a) FROM t1;
HEX(a)
EFF0EEE1E0
INSERT t2 SELECT * FROM t1;
SELECT HEX(a) FROM t2;
HEX(a)
D0BFD180D0BED0B1D0B0
DROP TABLE t1, t2;
CREATE TABLE ``
(
CHAR(32) CHARACTER SET koi8r NOT NULL COMMENT " "
) COMMENT " ";
SHOW TABLES;
Tables_in_test
SHOW CREATE TABLE ;
Table Create Table
CREATE TABLE `` (
`` char(32) character set koi8r NOT NULL default '' COMMENT ' '
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT=' '
SHOW FIELDS FROM ;
Field Type Null Key Default Extra
char(32)
SET CHARACTER SET cp1251;
SHOW TABLES;
Tables_in_test
SHOW CREATE TABLE ;
Table Create Table
CREATE TABLE `` (
`` char(32) character set koi8r NOT NULL default '' COMMENT ' '
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT=' '
SHOW FIELDS FROM ;
Field Type Null Key Default Extra
char(32)
SET CHARACTER SET utf8;
SHOW TABLES;
Tables_in_test
таблица
SHOW CREATE TABLE таблица;
Table Create Table
таблица CREATE TABLE `таблица` (
`поле` char(32) character set koi8r NOT NULL default '' COMMENT 'комментарий поля'
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='комментарий таблицы'
SHOW FIELDS FROM таблица;
Field Type Null Key Default Extra
поле char(32)
SET CHARACTER SET koi8r;
DROP TABLE ;
SET CHARACTER SET default;
SET NAMES UTF8;
CREATE TABLE t1 (t text) DEFAULT CHARSET UTF8;
INSERT INTO t1 (t) VALUES ('x');
SELECT 1 FROM t1 WHERE CONCAT(_latin1'x') = t;
1
1
DROP TABLE t1;
SET CHARACTER SET koi8r;
CREATE DATABASE ;
USE ;
SHOW TABLES;
Tables_in_тест
SHOW TABLES IN ;
Tables_in_тест
SET CHARACTER SET cp1251;
SHOW TABLES;
Tables_in_тест
SHOW TABLES IN ;
Tables_in_тест
SET CHARACTER SET koi8r;
DROP DATABASE ;
SET NAMES koi8r;
SELECT hex('');
hex('тест')
D4C5D3D4
SET character_set_connection=cp1251;
SELECT hex('');
hex('тест')
F2E5F1F2
USE test;
SET NAMES binary;
CREATE TABLE `тест` (`тест` int);
SHOW CREATE TABLE `тест`;
Table Create Table
тест CREATE TABLE `тест` (
`тест` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SET NAMES utf8;
SHOW CREATE TABLE `тест`;
Table Create Table
тест CREATE TABLE `тест` (
`тест` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE `тест`;
SET NAMES binary;
SET character_set_connection=utf8;
SELECT 'тест' as s;
s
тест
SET NAMES utf8;
SET character_set_connection=binary;
SELECT 'тест' as s;
s
тест
SET NAMES latin1;
CREATE TABLE t1 (`` CHAR(128) DEFAULT '', `1` ENUM('1','2') DEFAULT '2');
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`` char(128) default '',
`1` enum('1','2') default '2'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW COLUMNS FROM t1;
Field Type Null Key Default Extra
char(128) YES
1 enum('1','2') YES 2
SET NAMES binary;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`ä` char(128) default 'ä',
`ä1` enum('ä1','ä2') default 'ä2'
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SHOW COLUMNS FROM t1;
Field Type Null Key Default Extra
ä char(128) YES ä
ä1 enum('ä1','ä2') YES ä2
DROP TABLE t1;
SET NAMES binary;
CREATE TABLE `good` (a int);
ERROR HY000: Invalid utf8 character string: ''
SET NAMES utf8;
CREATE TABLE `good` (a int);
ERROR HY000: Invalid utf8 character string: '` (a int)'
set names latin1;
create table t1 (a char(10) character set koi8r, b text character set koi8r);
insert into t1 values ('test','test');
insert into t1 values ('','');
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
Warning 1265 Data truncated for column 'b' at row 1
drop table t1;
set names koi8r;
create table t1 (a char(10) character set cp1251);
insert into t1 values (_koi8r'');
select * from t1 where a=_koi8r'';
a
select * from t1 where a=concat(_koi8r'');
ERROR HY000: Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (koi8r_general_ci,COERCIBLE) for operation '='
select * from t1 where a=_latin1'';
ERROR HY000: Illegal mix of collations (cp1251_general_ci,IMPLICIT) and (latin1_swedish_ci,COERCIBLE) for operation '='
drop table t1;
set names latin1;
set names koi8r;
create table t1 (c1 char(10) character set cp1251);
insert into t1 values ('');
select c1 from t1 where c1 between '' and '';
c1
select ifnull(c1,''), ifnull(null,c1) from t1;
ifnull(c1,'ъ') ifnull(null,c1)
select if(1,c1,''), if(0,c1,'') from t1;
if(1,c1,'Ж') if(0,c1,'Ж')
select coalesce('',c1), coalesce(null,c1) from t1;
coalesce('Ж',c1) coalesce(null,c1)
select least(c1,''), greatest(c1,'') from t1;
least(c1,'Ж') greatest(c1,'Ж')
select locate(c1,''), locate('',c1) from t1;
locate(c1,'ъ') locate('ъ',c1)
1 1
select field(c1,''),field('',c1) from t1;
field(c1,'ъ') field('ъ',c1)
1 1
select concat(c1,''), concat('',c1) from t1;
concat(c1,'Ж') concat('Ж',c1)
select concat_ws(c1,'',''), concat_ws('',c1,'') from t1;
concat_ws(c1,'Ж','ъ') concat_ws('Ж',c1,'ъ')
select replace(c1,'',''), replace('',c1,'') from t1;
replace(c1,'ъ','Ж') replace('ъ',c1,'Ж')
select substring_index(c1,'',2) from t1;
substring_index(c1,'ЖЖъъ',2)
select elt(1,c1,''),elt(1,'',c1) from t1;
elt(1,c1,'Ж') elt(1,'Ж',c1)
select make_set(3,c1,''), make_set(3,'',c1) from t1;
make_set(3,c1,'Ж') make_set(3,'Ж',c1)
, ,
select insert(c1,1,2,''),insert('',1,2,c1) from t1;
insert(c1,1,2,'Ж') insert('Ж',1,2,c1)
select trim(c1 from ''),trim('' from c1) from t1;
trim(c1 from 'ъ') trim('ъ' from c1)
select lpad(c1,3,''), lpad('',3,c1) from t1;
lpad(c1,3,'Ж') lpad('Ж',3,c1)
select rpad(c1,3,''), rpad('',3,c1) from t1;
rpad(c1,3,'Ж') rpad('Ж',3,c1)
This diff is collapsed.
DROP TABLE IF EXISTS t1; DROP TABLE IF EXISTS t1;
SET NAMES latin1;
SET character_set_connection=ucs2;
select 'a' = 'a', 'a' = 'a ', 'a ' = 'a';
'a' = 'a' 'a' = 'a ' 'a ' = 'a'
1 1 1
select 'a\0' = 'a', 'a\0' < 'a', 'a\0' > 'a';
'a\0' = 'a' 'a\0' < 'a' 'a\0' > 'a'
0 1 0
select 'a' = 'a\0', 'a' < 'a\0', 'a' > 'a\0';
'a' = 'a\0' 'a' < 'a\0' 'a' > 'a\0'
0 0 1
select 'a\0' = 'a ', 'a\0' < 'a ', 'a\0' > 'a ';
'a\0' = 'a ' 'a\0' < 'a ' 'a\0' > 'a '
0 1 0
select 'a ' = 'a\0', 'a ' < 'a\0', 'a ' > 'a\0';
'a ' = 'a\0' 'a ' < 'a\0' 'a ' > 'a\0'
0 0 1
select 'a a' > 'a', 'a \0' < 'a';
'a a' > 'a' 'a \0' < 'a'
1 1
select binary 'a a' > 'a', binary 'a \0' > 'a', binary 'a\0' > 'a';
binary 'a a' > 'a' binary 'a \0' > 'a' binary 'a\0' > 'a'
1 1 1
SET CHARACTER SET koi8r; SET CHARACTER SET koi8r;
CREATE TABLE t1 (word VARCHAR(64) CHARACTER SET ucs2); CREATE TABLE t1 (word VARCHAR(64) CHARACTER SET ucs2);
INSERT INTO t1 VALUES (_koi8r''), (X'2004'); INSERT INTO t1 VALUES (_koi8r''), (X'2004');
......
This diff is collapsed.
...@@ -321,3 +321,23 @@ DROP DATABASE testdb7; ...@@ -321,3 +321,23 @@ DROP DATABASE testdb7;
DROP DATABASE testdb8; DROP DATABASE testdb8;
DROP DATABASE testdb9; DROP DATABASE testdb9;
DROP DATABASE testdb10; DROP DATABASE testdb10;
create table t1(a int, b int, c int, d int);
grant insert(b), insert(c), insert(d), insert(a) on t1 to grant_user@localhost;
show grants for grant_user@localhost;
Grants for grant_user@localhost
GRANT USAGE ON *.* TO 'grant_user'@'localhost'
GRANT INSERT (a, d, c, b) ON `test`.`t1` TO 'grant_user'@'localhost'
select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv;
Host Db User Table_name Column_name Column_priv
localhost test grant_user t1 c Insert
localhost test grant_user t1 b Insert
localhost test grant_user t1 a Insert
localhost test grant_user t1 d Insert
revoke ALL PRIVILEGES on t1 from grant_user@localhost;
show grants for grant_user@localhost;
Grants for grant_user@localhost
GRANT USAGE ON *.* TO 'grant_user'@'localhost'
select Host,Db,User,Table_name,Column_name,Column_priv from mysql.columns_priv;
Host Db User Table_name Column_name Column_priv
drop user grant_user@localhost;
drop table t1;
...@@ -240,3 +240,12 @@ SELECT * FROM t1; ...@@ -240,3 +240,12 @@ SELECT * FROM t1;
pseudo date pseudo date
ZoomZip 1101106546 ZoomZip 1101106546
DROP TABLE t1; DROP TABLE t1;
create table t1(a char(2)) engine=memory;
insert into t1 values (NULL), (NULL);
delete from t1 where a is null;
insert into t1 values ('2'), ('3');
select * from t1;
a
3
2
drop table t1;
This diff is collapsed.
drop table if exists t1;
CREATE TABLE t1 (data LONGBLOB) ENGINE=myisam;
INSERT INTO t1 (data) VALUES (NULL);
UPDATE t1 set data=repeat('a',18*1024*1024);
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
select length(data) from t1;
length(data)
NULL
delete from t1 where left(data,1)='a';
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
truncate table t1;
INSERT INTO t1 (data) VALUES (repeat('a',1*1024*1024));
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
INSERT INTO t1 (data) VALUES (repeat('b',16*1024*1024-1024));
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
delete from t1 where left(data,1)='b';
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
UPDATE t1 set data=repeat('c',17*1024*1024);
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
delete from t1 where left(data,1)='c';
check table t1;
Table Op Msg_type Msg_text
test.t1 check status OK
INSERT INTO t1 set data=repeat('a',18*1024*1024);
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
select length(data) from t1;
length(data)
NULL
NULL
NULL
alter table t1 modify data blob;
select length(data) from t1;
length(data)
NULL
NULL
NULL
drop table t1;
CREATE TABLE t1 (data BLOB) ENGINE=myisam;
INSERT INTO t1 (data) VALUES (NULL);
UPDATE t1 set data=repeat('a',18*1024*1024);
Warnings:
Warning 1301 Result of repeat() was larger than max_allowed_packet (24) - truncated
select length(data) from t1;
length(data)
NULL
drop table t1;
...@@ -189,3 +189,13 @@ p a ...@@ -189,3 +189,13 @@ p a
5 aaa 5 aaa
6 AAA 6 AAA
drop table t1; drop table t1;
create table t1 (
a varchar(10) primary key
) engine=ndb;
insert into t1 values ('jonas % ');
replace into t1 values ('jonas % ');
replace into t1 values ('jonas % ');
select * from t1;
a
jonas %
drop table t1;
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -791,6 +791,19 @@ Qcache_queries_in_cache 1 ...@@ -791,6 +791,19 @@ Qcache_queries_in_cache 1
unlock table; unlock table;
drop table t1,t2; drop table t1,t2;
set query_cache_wlock_invalidate=default; set query_cache_wlock_invalidate=default;
CREATE TABLE t1 (id INT PRIMARY KEY);
insert into t1 values (1),(2),(3);
select * from t1;
id
1
2
3
create temporary table t1 (a int not null auto_increment
primary key);
select * from t1;
a
drop table t1;
drop table t1;
SET NAMES koi8r; SET NAMES koi8r;
CREATE TABLE t1 (a char(1) character set koi8r); CREATE TABLE t1 (a char(1) character set koi8r);
INSERT INTO t1 VALUES (_koi8r''),(_koi8r''); INSERT INTO t1 VALUES (_koi8r''),(_koi8r'');
...@@ -901,6 +914,8 @@ set group_concat_max_len=10; ...@@ -901,6 +914,8 @@ set group_concat_max_len=10;
select group_concat(a) FROM t1 group by b; select group_concat(a) FROM t1 group by b;
group_concat(a) group_concat(a)
1234567890 1234567890
Warnings:
Warning 1260 1 line(s) were cut by GROUP_CONCAT()
set group_concat_max_len=1024; set group_concat_max_len=1024;
select group_concat(a) FROM t1 group by b; select group_concat(a) FROM t1 group by b;
group_concat(a) group_concat(a)
......
drop table if exists t1,t2,t3,t4; drop table if exists t1,t2,t3,t4;
drop table if exists t1_1,t1_2,t9_1,t9_2;
CREATE TABLE t1 ( CREATE TABLE t1 (
Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL,
Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL Varor_period smallint(4) unsigned DEFAULT '0' NOT NULL
...@@ -2056,6 +2057,10 @@ t2 1 fld3 1 fld3 A NULL NULL NULL BTREE ...@@ -2056,6 +2057,10 @@ t2 1 fld3 1 fld3 A NULL NULL NULL BTREE
drop table t4, t3, t2, t1; drop table t4, t3, t2, t1;
DO 1; DO 1;
DO benchmark(100,1+1),1,1; DO benchmark(100,1+1),1,1;
do default;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
do foobar;
ERROR 42S22: Unknown column 'foobar' in 'field list'
CREATE TABLE t1 ( CREATE TABLE t1 (
id mediumint(8) unsigned NOT NULL auto_increment, id mediumint(8) unsigned NOT NULL auto_increment,
pseudo varchar(35) NOT NULL default '', pseudo varchar(35) NOT NULL default '',
...@@ -2348,6 +2353,27 @@ select * from t2,t3 where t2.s = t3.s; ...@@ -2348,6 +2353,27 @@ select * from t2,t3 where t2.s = t3.s;
s s s s
two two two two
drop table t1, t2, t3; drop table t1, t2, t3;
create table t1 (a integer, b integer, index(a), index(b));
create table t2 (c integer, d integer, index(c), index(d));
insert into t1 values (1,2), (2,2), (3,2), (4,2);
insert into t2 values (1,3), (2,3), (3,4), (4,4);
explain select * from t1 left join t2 on a=c where d in (4);
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref c,d d 5 const 2 Using where
1 SIMPLE t1 ALL a NULL NULL NULL 3 Using where
select * from t1 left join t2 on a=c where d in (4);
a b c d
3 2 3 4
4 2 4 4
explain select * from t1 left join t2 on a=c where d = 4;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t2 ref c,d d 5 const 2 Using where
1 SIMPLE t1 ALL a NULL NULL NULL 3 Using where
select * from t1 left join t2 on a=c where d = 4;
a b c d
3 2 3 4
4 2 4 4
drop table t1, t2;
CREATE TABLE t1 ( CREATE TABLE t1 (
i int(11) NOT NULL default '0', i int(11) NOT NULL default '0',
c char(10) NOT NULL default '', c char(10) NOT NULL default '',
...@@ -2360,7 +2386,4 @@ INSERT INTO t1 VALUES (3,'c'); ...@@ -2360,7 +2386,4 @@ INSERT INTO t1 VALUES (3,'c');
EXPLAIN SELECT i FROM t1 WHERE i=1; EXPLAIN SELECT i FROM t1 WHERE i=1;
id select_type table type possible_keys key key_len ref rows Extra id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index 1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
EXPLAIN SELECT i FROM t1 WHERE i=1;
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 Using index
DROP TABLE t1; DROP TABLE t1;
...@@ -684,8 +684,8 @@ id txt ...@@ -684,8 +684,8 @@ id txt
3 NULL 3 NULL
1 Chevy 1 Chevy
drop table t1; drop table t1;
CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, PRIMARY KEY (i), KEY (c(1),c(1))); CREATE TABLE t1 ( i int(11) NOT NULL default '0', c text NOT NULL, d varchar(1) NOT NULL DEFAULT ' ', PRIMARY KEY (i), KEY (c(1),d));
INSERT t1 VALUES (1,''),(2,''),(3,'asdfh'),(4,''); INSERT t1 (i, c) VALUES (1,''),(2,''),(3,'asdfh'),(4,'');
select max(i) from t1 where c = ''; select max(i) from t1 where c = '';
max(i) max(i)
4 4
......
...@@ -1693,3 +1693,47 @@ oe ...@@ -1693,3 +1693,47 @@ oe
ue ue
ss ss
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (
a ENUM('','','') character set utf8 default ''
);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('','','') character set utf8 default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
insert into t1 values (''), (''), ('');
select a from t1 order by a;
a
drop table t1;
set names utf8;
CREATE TABLE t1 (
a ENUM('ä','ö','ü') character set latin1 default 'ü'
);
insert into t1 values ('ä'),('ö'),('ü');
set names latin1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` enum('','','') default ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1
select a from t1 order by a;
a
drop table t1;
create table t1 (a enum ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin);
insert into t1 values ('Y');
alter table t1 add b set ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin;
alter table t1 add c enum ('Y','N') CHARACTER SET utf8 COLLATE utf8_bin;
select * from t1;
Catalog Database Table Table_alias Column Column_alias Name Type Length Max length Is_null Flags Decimals Charsetnr
def test t1 t1 a a 254 3 1 Y 384 0 8
def test t1 t1 b b 254 9 0 Y 2176 0 8
def test t1 t1 c c 254 3 0 Y 384 0 8
a b c
Y NULL NULL
drop table t1;
...@@ -22,14 +22,14 @@ select * from t1; ...@@ -22,14 +22,14 @@ select * from t1;
f1 f2 f1 f2
10 10 10 10
100000 100000 100000 100000
1.23457e+09 1234567890 1.23457e+9 1234567890
1e+10 10000000000 1e+10 10000000000
1e+15 1e+15 1e+15 1e+15
1e+20 1e+20 1e+20 1e+20
3.40282e+38 1e+50 3.40282e+38 1e+50
3.40282e+38 1e+150 3.40282e+38 1e+150
-10 -10 -10 -10
1e-05 1e-05 1e-5 1e-5
1e-10 1e-10 1e-10 1e-10
1e-15 1e-15 1e-15 1e-15
1e-20 1e-20 1e-20 1e-20
...@@ -137,6 +137,8 @@ t1 CREATE TABLE `t1` ( ...@@ -137,6 +137,8 @@ t1 CREATE TABLE `t1` (
drop table t1; drop table t1;
create table t1 (c20 char); create table t1 (c20 char);
insert into t1 values (5000.0); insert into t1 values (5000.0);
Warnings:
Warning 1265 Data truncated for column 'c20' at row 1
drop table t1; drop table t1;
create table t1 (f float(54)); create table t1 (f float(54));
ERROR 42000: Incorrect column specifier for column 'f' ERROR 42000: Incorrect column specifier for column 'f'
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -471,4 +471,3 @@ execute stmt using @var, @var, @var; ...@@ -471,4 +471,3 @@ execute stmt using @var, @var, @var;
set @var=null; set @var=null;
select @var is null, @var is not null, @var; select @var is null, @var is not null, @var;
execute stmt using @var, @var, @var; execute stmt using @var, @var, @var;
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.
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