Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-4.1

into sanja.is.com.ua:/home/bell/mysql/bk/work2-4.1
This commit is contained in:
bell@sanja.is.com.ua 2004-07-08 13:18:57 +03:00
commit a0ae383cbf
80 changed files with 944 additions and 208 deletions

View File

@ -11,6 +11,7 @@ administrador@light.hegel.local
ahlentz@co3064164-a.rochd1.qld.optusnet.com.au
akishkin@work.mysql.com
antony@ltantony.dsl-verizon.net
antony@ltantony.rdg.cyberkinetica.com
antony@ltantony.rdg.cyberkinetica.homeunix.net
arjen@bitbike.com
arjen@co3064164-a.bitbike.com
@ -123,6 +124,7 @@ mwagner@work.mysql.com
mydev@mysql.com
mysql@home.(none)
mysqldev@build.mysql2.com
mysqldev@melody.local
mysqldev@mysql.com
ndbdev@ndbmaster.mysql.com
nick@mysql.com

View File

@ -224,7 +224,6 @@ Q_ENABLE_QUERY_LOG, Q_DISABLE_QUERY_LOG,
Q_ENABLE_RESULT_LOG, Q_DISABLE_RESULT_LOG,
Q_SERVER_START, Q_SERVER_STOP,Q_REQUIRE_MANAGER,
Q_WAIT_FOR_SLAVE_TO_STOP,
Q_REQUIRE_VERSION, Q_REQUIRE_OS,
Q_ENABLE_WARNINGS, Q_DISABLE_WARNINGS,
Q_ENABLE_INFO, Q_DISABLE_INFO,
Q_ENABLE_METADATA, Q_DISABLE_METADATA,
@ -297,8 +296,6 @@ const char *command_names[]=
"server_stop",
"require_manager",
"wait_for_slave_to_stop",
"require_version",
"require_os",
"enable_warnings",
"disable_warnings",
"enable_info",
@ -818,63 +815,6 @@ int do_server_op(struct st_query* q,const char* op)
}
#endif
int do_require_version(struct st_query* q)
{
MYSQL* mysql = &cur_con->mysql;
MYSQL_RES* res;
MYSQL_ROW row;
char* p=q->first_argument, *ver_arg;
uint ver_arg_len,ver_len;
LINT_INIT(res);
if (!*p)
die("Missing version argument in require_version\n");
ver_arg = p;
while (*p && !my_isspace(charset_info,*p))
p++;
*p = 0;
ver_arg_len = p - ver_arg;
if (mysql_query(mysql, "select version()") ||
!(res=mysql_store_result(mysql)))
die("Query failed while check server version: %s",
mysql_error(mysql));
if (!(row=mysql_fetch_row(res)) || !row[0])
{
mysql_free_result(res);
die("Strange result from query while checking version");
}
ver_len = strlen(row[0]);
if (ver_len < ver_arg_len || memcmp(row[0],ver_arg,ver_arg_len))
{
mysql_free_result(res);
abort_not_supported_test();
}
mysql_free_result(res);
return 0;
}
int do_require_os(struct st_query* q)
{
char *p=q->first_argument, *os_arg;
DBUG_ENTER("do_require_os");
if (!*p)
die("Missing version argument in require_os\n");
os_arg= p;
while (*p && !my_isspace(charset_info,*p))
p++;
*p = 0;
if (strcmp(os_arg, "unix"))
die("For now only testing of os=unix is implemented\n");
#if defined(__NETWARE__) || defined(__WIN__) || defined(__OS2__)
abort_not_supported_test();
#endif
DBUG_RETURN(0);
}
int do_source(struct st_query* q)
{
char* p=q->first_argument, *name;
@ -1628,6 +1568,7 @@ int do_connect(struct st_query* q)
if (opt_compress)
mysql_options(&next_con->mysql,MYSQL_OPT_COMPRESS,NullS);
mysql_options(&next_con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
mysql_options(&next_con->mysql, MYSQL_SET_CHARSET_NAME, "latin1");
#ifdef HAVE_OPENSSL
if (opt_use_ssl)
@ -2692,6 +2633,8 @@ int main(int argc, char **argv)
if (opt_compress)
mysql_options(&cur_con->mysql,MYSQL_OPT_COMPRESS,NullS);
mysql_options(&cur_con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
mysql_options(&cur_con->mysql, MYSQL_SET_CHARSET_NAME, "latin1");
#ifdef HAVE_OPENSSL
if (opt_use_ssl)
mysql_ssl_set(&cur_con->mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca,
@ -2729,15 +2672,13 @@ int main(int argc, char **argv)
case Q_DISABLE_RESULT_LOG: disable_result_log=1; break;
case Q_ENABLE_WARNINGS: disable_warnings=0; break;
case Q_DISABLE_WARNINGS: disable_warnings=1; break;
case Q_ENABLE_INFO: disable_info=0; break;
case Q_DISABLE_INFO: disable_info=1; break;
case Q_ENABLE_INFO: disable_info=0; break;
case Q_DISABLE_INFO: disable_info=1; break;
case Q_ENABLE_METADATA: display_metadata=1; break;
case Q_DISABLE_METADATA: display_metadata=0; break;
case Q_DISABLE_METADATA: display_metadata=0; break;
case Q_SOURCE: do_source(q); break;
case Q_SLEEP: do_sleep(q, 0); break;
case Q_REAL_SLEEP: do_sleep(q, 1); break;
case Q_REQUIRE_VERSION: do_require_version(q); break;
case Q_REQUIRE_OS: do_require_os(q); break;
case Q_WAIT_FOR_SLAVE_TO_STOP: do_wait_for_slave_to_stop(q); break;
case Q_REQUIRE_MANAGER: do_require_manager(q); break;
#ifndef EMBEDDED_LIBRARY

View File

@ -348,6 +348,9 @@ inline double ulonglong2double(ulonglong value)
#define MYSQL_DEFAULT_CHARSET_NAME "latin1"
#define MYSQL_DEFAULT_COLLATION_NAME "latin1_swedish_ci"
#define HAVE_SPATIAL 1
#define HAVE_RTREE_KEYS 1
/* Define charsets you want */
/* #undef HAVE_CHARSET_armscii8 */
/* #undef HAVE_CHARSET_ascii */

View File

@ -316,4 +316,5 @@
#define ER_GET_TEMPORARY_ERRMSG 1297
#define ER_UNKNOWN_TIME_ZONE 1298
#define ER_WARN_INVALID_TIMESTAMP 1299
#define ER_ERROR_MESSAGES 300
#define ER_INVALID_CHARACTER_STRING 1300
#define ER_ERROR_MESSAGES 301

View File

@ -1,9 +1,23 @@
############### include/ps_create.inc ##################
# #
# drop + create the tables used in most PS test cases #
# t/ps_*.test #
# #
########################################################
#
# NOTE: PLEASE SEE ps_1general.test (bottom)
# BEFORE ADDING NEW TABLES HERE !!!
#
# Please be aware, that this file will be sourced by several
# test case files stored within the subdirectory 't'.
# So every change here will affect several test cases.
#----------- Please insert your table definitions here ----------#
#---- Please do not alter the following table definitions -------#
--disable_warnings
drop table if exists t1, t_many_col_types ;
--enable_warnings

View File

@ -4,6 +4,38 @@
# #
##############################################################
#
# NOTE: PLEASE SEE ps_1general.test (bottom)
# BEFORE ADDING NEW TEST CASES HERE !!!
#
# Please be aware, that this file will be sourced by several test case files
# stored within the subdirectory 't'. So every change here will affect
# several test cases.
#
# Please do not modify the structure (DROP/ALTER..) of the tables
# 't1' and 't_many_col_types'.
#
# But you are encouraged to use these two tables within your statements
# whenever possible.
# t1 - very simple table
# t_many_col_types - table with nearly all available column types
#
# The structure and the content of these tables can be found in
# include/ps_create.inc CREATE TABLE ...
# include/ps_renew.inc DELETE all rows and INSERT some rows
#
# Both tables are managed by the same storage engine.
# The type of the storage engine is stored in the variable '$type' .
#------------------- Please insert your test cases here -------------------#
#-------- Please be very carefull when editing behind this line ----------#
--disable_query_log
select '------ delete tests ------' as test_sequence ;
--enable_query_log

View File

@ -4,6 +4,43 @@
# #
##############################################################
#
# NOTE: THESE TESTS CANNOT BE APPLIED TO TABLES OF TYPE MERGE.
# Test which can be applied to MERGE tables should be stored in
# include/ps_modify.inc .
#
#
# NOTE: PLEASE SEE ps_1general.test (bottom)
# BEFORE ADDING NEW TEST CASES HERE !!!
#
# Please be aware, that this file will be sourced by several test case files
# stored within the subdirectory 't'. So every change here will affect
# several test cases.
#
# Please do not modify the structure (DROP/ALTER..) of the tables
# 't1' and 't_many_col_types'.
#
# But you are encouraged to use these two tables within your statements
# (DELETE/UPDATE/...) whenever possible.
# t1 - very simple table
# t_many_col_types - table with nearly all available column types
#
# The structure and the content of these tables can be found in
# include/ps_create.inc CREATE TABLE ...
# include/ps_renew.inc DELETE all rows and INSERT some rows
#
# Both tables are managed by the same storage engine.
# The type of the storage engine is stored in the variable '$type' .
#------------------- Please insert your test cases here -------------------#
#-------- Please be very carefull when editing behind this line ----------#
## big insert select statements
set @duplicate='duplicate ' ;
set @1000=1000 ;

View File

@ -4,10 +4,39 @@
# #
##############################################################
#
# NOTE: PLEASE SEE ps_1general.test (bottom)
# BEFORE ADDING NEW TEST CASES HERE !!!
# Please do not modify (INSERT/UPDATE/DELETE) the content of the tables
# t1 and t_many_col_types.
# Such tests should be done in include/ps_modify.inc
#
# Please be aware, that this file will be sourced by several test case files
# stored within the subdirectory 't'. So every change here will affect
# several test cases.
#
# Please do not modify (INSERT/UPDATE/DELETE) the content or the
# structure (DROP/ALTER..) of the tables
# 't1' and 't_many_col_types'.
# Such tests should be done in include/ps_modify.inc .
#
# But you are encouraged to use these two tables within your SELECT statements
# whenever possible.
# t1 - very simple table
# t_many_col_types - table with nearly all available column types
#
# The structure and the content of these tables can be found in
# include/ps_create.inc CREATE TABLE ...
# include/ps_renew.inc DELETE all rows and INSERT some rows
#
# Both tables are managed by the same storage engine.
# The type of the storage engine is stored in the variable '$type' .
#------------------- Please insert your test cases here -------------------#
#-------- Please be very carefull when editing behind this line ----------#
--disable_query_log
select '------ simple select tests ------' as test_sequence ;

View File

@ -525,7 +525,7 @@ fi
MYSQL_DUMP="$MYSQL_DUMP --no-defaults -uroot --socket=$MASTER_MYSOCK --password=$DBPASSWD $EXTRA_MYSQLDUMP_OPT"
MYSQL_BINLOG="$MYSQL_BINLOG --no-defaults --local-load=$MYSQL_TMP_DIR $EXTRA_MYSQLBINLOG_OPT"
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose=1"
MYSQL_FIX_SYSTEM_TABLES="$MYSQL_FIX_SYSTEM_TABLES --no-defaults --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD --basedir=$BASEDIR --bindir=$CLIENT_BINDIR --verbose"
MYSQL="$MYSQL --host=localhost --port=$MASTER_MYPORT --socket=$MASTER_MYSOCK --user=root --password=$DBPASSWD"
export MYSQL MYSQL_DUMP MYSQL_BINLOG MYSQL_FIX_SYSTEM_TABLES CLIENT_BINDIR

View File

@ -98,7 +98,7 @@ if [ ! -x $exec_ndb ]; then
echo "$exec_ndb missing"
exit 1
fi
if [ ! -x $exec_mgmtsrv ]; then
if [ ! -x $exec_mgmtsrvr ]; then
echo "$exec_mgmtsrvr missing"
exit 1
fi

View File

@ -785,7 +785,7 @@ Table Op Msg_type Msg_text
test.t1 optimize status OK
show keys from t1;
Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment
t1 0 PRIMARY 1 a A 2 NULL NULL BTREE
t1 0 PRIMARY 1 a NULL 2 NULL NULL BTREE
drop table t1;
create table t1 (i int, j int )ENGINE=BDB;
insert into t1 values (1,2);

View File

@ -1,15 +1,37 @@
SET @@character_set_server=latin5;
CREATE DATABASE db1 DEFAULT CHARACTER SET cp1251;
USE db1;
CREATE DATABASE db2;
SHOW CREATE DATABASE db1;
CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET cp1251;
USE mysqltest1;
CREATE DATABASE mysqltest2;
SHOW CREATE DATABASE mysqltest1;
Database Create Database
db1 CREATE DATABASE `db1` /*!40100 DEFAULT CHARACTER SET cp1251 */
SHOW CREATE DATABASE db2;
mysqltest1 CREATE DATABASE `mysqltest1` /*!40100 DEFAULT CHARACTER SET cp1251 */
SHOW CREATE DATABASE mysqltest2;
Database Create Database
db2 CREATE DATABASE `db2` /*!40100 DEFAULT CHARACTER SET latin5 */
DROP DATABASE db2;
USE db1;
mysqltest2 CREATE DATABASE `mysqltest2` /*!40100 DEFAULT CHARACTER SET latin5 */
CREATE TABLE mysqltest2.t1 (a char(10));
SHOW CREATE TABLE mysqltest2.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(10) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin5
DROP TABLE mysqltest2.t1;
ALTER DATABASE mysqltest2 DEFAULT CHARACTER SET latin7;
CREATE TABLE mysqltest2.t1 (a char(10));
SHOW CREATE TABLE mysqltest2.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(10) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin7
DROP DATABASE mysqltest2;
CREATE DATABASE mysqltest2 CHARACTER SET latin2;
CREATE TABLE mysqltest2.t1 (a char(10));
SHOW CREATE TABLE mysqltest2.t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` char(10) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin2
DROP DATABASE mysqltest2;
USE mysqltest1;
CREATE TABLE t1 (a char(10));
SHOW CREATE TABLE t1;
Table Create Table
@ -32,4 +54,4 @@ t1 CREATE TABLE `t1` (
`a` char(10) collate latin1_german1_ci default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german1_ci
DROP TABLE t1;
DROP DATABASE db1;
DROP DATABASE mysqltest1;

View File

@ -111,3 +111,34 @@ SET character_set_connection=cp1251;
SELECT hex('ÔÅÓÔ');
hex('ÔÅÓÔ')
F2E5F1F2
USE test;
SET NAMES binary;
CREATE TABLE `ÑеÑ<C2B5>Ñ` (`ÑеÑ<C2B5>Ñ` int);
SHOW CREATE TABLE `ÑеÑ<C2B5>Ñ`;
Table Create Table
ÑеÑ<EFBFBD>Ñ CREATE TABLE `ÑеÑ<C2B5>Ñ` (
еÑ<C2B5>Ñ` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
SET NAMES utf8;
SHOW CREATE TABLE `ÑеÑ<C2B5>Ñ`;
Table Create Table
ÑеÑ<EFBFBD>Ñ CREATE TABLE `ÑеÑ<C2B5>Ñ` (
еÑ<C2B5>Ñ` int(11) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE `ÑеÑ<C2B5>Ñ`;
SET NAMES binary;
SET character_set_connection=utf8;
SELECT 'ÑеÑ<C2B5>Ñ' as s;
s
ÑеÑ<EFBFBD>Ñ
SET NAMES utf8;
SET character_set_connection=binary;
SELECT 'ÑеÑ<C2B5>Ñ' as s;
s
ÑеÑ<EFBFBD>Ñ
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)'

View File

@ -1655,3 +1655,109 @@ Z,z,Ź,ź,Ż,ż,Ž,ž
ǁ
ǂ
ǃ
select group_concat(c1 order by c1) from t1 group by c1 collate utf8_roman_ci;
group_concat(c1 order by c1)
÷
×
A,a,À,Á,Â,Ã,Ä,Å,à,á,â,ã,ä,å,Ā,ā,Ă,ă,Ą,ą,Ǎ,ǎ,Ǟ,ǟ,Ǡ,ǡ,Ǻ,ǻ
AA,Aa,aA,aa
Æ,æ,Ǣ,ǣ,Ǽ,ǽ
B,b
ƀ
Ɓ
Ƃ,ƃ
C,c,Ç,ç,Ć,ć,Ĉ,ĉ,Ċ,ċ,Č,č
CH,Ch,cH,ch
Ƈ,ƈ
D,d,Ď,ď
DZ,Dz,dZ,dz,DŽ,Dž,dž,DZ,Dz,dz
Đ,đ
Ɖ
Ɗ
Ƌ,ƌ
Ð,ð
E,e,È,É,Ê,Ë,è,é,ê,ë,Ē,ē,Ĕ,ĕ,Ė,ė,Ę,ę,Ě,ě
Ǝ,ǝ
Ə
Ɛ
F,f
Ƒ,ƒ
G,g,Ĝ,ĝ,Ğ,ğ,Ġ,ġ,Ģ,ģ,Ǧ,ǧ,Ǵ,ǵ
Ǥ,ǥ
Ɠ
Ɣ
Ƣ,ƣ
H,h,Ĥ,ĥ
ƕ,Ƕ
Ħ,ħ
I,J,i,j,Ì,Í,Î,Ï,ì,í,î,ï,Ĩ,ĩ,Ī,ī,Ĭ,ĭ,Į,į,İ,Ǐ,ǐ
IJ,Ij,iJ,ij
IJ,ij
ı
Ɨ
Ɩ
Ĵ,ĵ,ǰ
K,k,Ķ,ķ,Ǩ,ǩ
Ƙ,ƙ
L,l,Ĺ,ĺ,Ļ,ļ,Ľ,ľ
Ŀ,ŀ
LJ,Lj,lJ,lj
LJ,Lj,lj
LL,Ll,lL,ll
Ł,ł
ƚ
ƛ
M,m
N,n,Ñ,ñ,Ń,ń,Ņ,ņ,Ň,ň,Ǹ,ǹ
NJ,Nj,nJ,nj
NJ,Nj,nj
Ɲ
ƞ
Ŋ,ŋ
O,o,Ò,Ó,Ô,Õ,Ö,ò,ó,ô,õ,ö,Ō,ō,Ŏ,ŏ,Ő,ő,Ơ,ơ,Ǒ,ǒ,Ǫ,ǫ,Ǭ,ǭ
OE,Oe,oE,oe,Œ,œ
Ø,ø,Ǿ,ǿ
Ɔ
Ɵ
P,p
Ƥ,ƥ
Q,q
ĸ
R,r,Ŕ,ŕ,Ŗ,ŗ,Ř,ř
RR,Rr,rR,rr
Ʀ
S,s,Ś,ś,Ŝ,ŝ,Ş,ş,Š,š,ſ
SS,Ss,sS,ss,ß
Ʃ
ƪ
T,t,Ţ,ţ,Ť,ť
ƾ
Ŧ,ŧ
ƫ
Ƭ,ƭ
Ʈ
U,V,u,v,Ù,Ú,Û,Ü,ù,ú,û,ü,Ũ,ũ,Ū,ū,Ŭ,ŭ,Ů,ů,Ű,ű,Ų,ų,Ư,ư,Ǔ,ǔ,Ǖ,ǖ,Ǘ,ǘ,Ǚ,ǚ,Ǜ,ǜ
Ɯ
Ʊ
Ʋ
W,w,Ŵ,ŵ
X,x
Y,y,Ý,ý,ÿ,Ŷ,ŷ,Ÿ
Ƴ,ƴ
Z,z,Ź,ź,Ż,ż,Ž,ž
ƍ
Ƶ,ƶ
Ʒ,Ǯ,ǯ
Ƹ,ƹ
ƺ
Þ,þ
ƿ,Ƿ
ƻ
Ƨ
Ƽ,ƽ
Ƅ
ʼn
ǀ
ǁ
ǂ
ǃ

View File

@ -192,9 +192,9 @@ length(quote(concat(char(0),"test")))
select hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))));
hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))))
27E0E3E6E7E8EAEB27
select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678");
unhex(hex("foobar")) hex(unhex("1234567890ABCDEF")) unhex("345678")
foobar 1234567890ABCDEF 4Vx
select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678"), unhex(NULL);
unhex(hex("foobar")) hex(unhex("1234567890ABCDEF")) unhex("345678") unhex(NULL)
foobar 1234567890ABCDEF 4Vx NULL
select hex(unhex("1")), hex(unhex("12")), hex(unhex("123")), hex(unhex("1234")), hex(unhex("12345")), hex(unhex("123456"));
hex(unhex("1")) hex(unhex("12")) hex(unhex("123")) hex(unhex("1234")) hex(unhex("12345")) hex(unhex("123456"))
01 12 0123 1234 012345 123456

View File

@ -175,10 +175,10 @@ insert into t1 values (19,4, 0);
select * from t1 where b<=5 and c=0;
a b c
19 4 0
select * from t1 where b=4 and c<=5;
select * from t1 where b=4 and c<=5 order by a;
a b c
19 4 0
17 4 4
19 4 0
select * from t1 where b<=4 and c<=5 order by a;
a b c
7 2 1

View File

@ -25,19 +25,19 @@ test2 CREATE DATABASE `test2` /*!40100 DEFAULT CHARACTER SET latin2 */
show create database test3;
Database Create Database
test3 CREATE DATABASE `test3` /*!40100 DEFAULT CHARACTER SET latin5 */
set @@collation_server=armscii_bin;
set @@collation_server=armscii8_bin;
drop database test3;
create database test3;
--- --master--
show create database test3;
Database Create Database
test3 CREATE DATABASE `test3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii_bin */
test3 CREATE DATABASE `test3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */
--- --slave--
show create database test3;
Database Create Database
test3 CREATE DATABASE `test3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii_bin */
test3 CREATE DATABASE `test3` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */
use test2;
create table t1 (a int auto_increment primary key, b varchar(100));
set character_set_client=cp850, collation_connection=latin2_croatian_ci;
@ -51,7 +51,7 @@ insert into t1 (b) values(@@collation_connection);
select * from t1 order by a;
a b
1 armscii8
2 armscii_bin
2 armscii8_bin
3 cp850
4 latin2
5 latin2_croatian_ci
@ -60,7 +60,7 @@ a b
select * from test2.t1 order by a;
a b
1 armscii8
2 armscii_bin
2 armscii8_bin
3 cp850
4 latin2
5 latin2_croatian_ci

View File

@ -13,25 +13,48 @@
SET @@character_set_server=latin5;
CREATE DATABASE db1 DEFAULT CHARACTER SET cp1251;
USE db1;
CREATE DATABASE db2;
CREATE DATABASE mysqltest1 DEFAULT CHARACTER SET cp1251;
USE mysqltest1;
CREATE DATABASE mysqltest2;
#
# This should be cp1251
#
SHOW CREATE DATABASE db1;
SHOW CREATE DATABASE mysqltest1;
#
# This should take the default latin5 value from server level.
# Database "mysqltest2" should take the default latin5 value from
# the server level.
# Afterwards, table "d2.t1" should inherit the default latin5 value from
# the database "mysqltest2", using database option hash.
#
SHOW CREATE DATABASE db2;
DROP DATABASE db2;
SHOW CREATE DATABASE mysqltest2;
CREATE TABLE mysqltest2.t1 (a char(10));
SHOW CREATE TABLE mysqltest2.t1;
DROP TABLE mysqltest2.t1;
#
# Now we check if the database charset is updated in
# the database options hash when we ALTER DATABASE.
#
ALTER DATABASE mysqltest2 DEFAULT CHARACTER SET latin7;
CREATE TABLE mysqltest2.t1 (a char(10));
SHOW CREATE TABLE mysqltest2.t1;
DROP DATABASE mysqltest2;
#
# Now we check if the database charset is removed from
# the database option hash when we DROP DATABASE.
#
CREATE DATABASE mysqltest2 CHARACTER SET latin2;
CREATE TABLE mysqltest2.t1 (a char(10));
SHOW CREATE TABLE mysqltest2.t1;
DROP DATABASE mysqltest2;
#
# Check that table value uses database level by default
#
USE db1;
USE mysqltest1;
CREATE TABLE t1 (a char(10));
SHOW CREATE TABLE t1;
DROP TABLE t1;
@ -50,4 +73,4 @@ DROP TABLE t1;
#
#
#
DROP DATABASE db1;
DROP DATABASE mysqltest1;

View File

@ -78,3 +78,32 @@ SET NAMES koi8r;
SELECT hex('ÔÅÓÔ');
SET character_set_connection=cp1251;
SELECT hex('ÔÅÓÔ');
USE test;
# Bug#4417
# Check that identifiers and strings are not converted
# when the client character set is binary.
SET NAMES binary;
CREATE TABLE `ÑеÑ<C2B5>Ñ` (`ÑеÑ<C2B5>Ñ` int);
SHOW CREATE TABLE `ÑеÑ<C2B5>Ñ`;
SET NAMES utf8;
SHOW CREATE TABLE `ÑеÑ<C2B5>Ñ`;
DROP TABLE `ÑеÑ<C2B5>Ñ`;
SET NAMES binary;
SET character_set_connection=utf8;
SELECT 'ÑеÑ<C2B5>Ñ' as s;
SET NAMES utf8;
SET character_set_connection=binary;
SELECT 'ÑеÑ<C2B5>Ñ' as s;
#
# Test that we allow only well-formed UTF8 identitiers
#
SET NAMES binary;
--error 1300
CREATE TABLE `goodÐÌÏÈÏ` (a int);
SET NAMES utf8;
--error 1300
CREATE TABLE `goodÐÌÏÈÏ` (a int);

View File

@ -178,4 +178,5 @@ select group_concat(c1 order by c1) from t1 group by c1 collate utf8_danish_ci;
select group_concat(c1 order by c1) from t1 group by c1 collate utf8_lithuanian_ci;
--select group_concat(c1 order by c1) from t1 group by c1 collate utf8_slovak_ci;
select group_concat(c1 order by c1) from t1 group by c1 collate utf8_spanish2_ci;
select group_concat(c1 order by c1) from t1 group by c1 collate utf8_roman_ci;

View File

@ -78,7 +78,7 @@ select quote(concat('abc\'', '\\cba'));
select quote(1/0), quote('\0\Z');
select length(quote(concat(char(0),"test")));
select hex(quote(concat(char(224),char(227),char(230),char(231),char(232),char(234),char(235))));
select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678");
select unhex(hex("foobar")), hex(unhex("1234567890ABCDEF")), unhex("345678"), unhex(NULL);
select hex(unhex("1")), hex(unhex("12")), hex(unhex("123")), hex(unhex("1234")), hex(unhex("12345")), hex(unhex("123456"));
select length(unhex(md5("abrakadabra")));

View File

@ -106,7 +106,7 @@ select * from t1 where b<=5 order by a;
select * from t1 where b<=5 and c=0;
insert into t1 values (19,4, 0);
select * from t1 where b<=5 and c=0;
select * from t1 where b=4 and c<=5;
select * from t1 where b=4 and c<=5 order by a;
select * from t1 where b<=4 and c<=5 order by a;
select * from t1 where b<=5 and c=0 or b<=5 and c=2;
drop table t1;

View File

@ -4,15 +4,9 @@
# #
##############################################################
# Please do not
# - modify (INSERT/UPDATE/DELETE) the content of the tables
# t1 and t_many_col_types. Such tests should be done in
# include/ps_modify.inc
# - insert test cases where the results depend on the
# table type. Such tests should be done in the files
# include/ps_query.inc, include/ps_modify ...
#
#
# NOTE: PLEASE SEE THE DETAILED DESCRIPTION AT THE BOTTOM OF THIS FILE
# BEFORE ADDING NEW TEST CASES HERE !!!
use test;
--disable_query_log
@ -737,3 +731,101 @@ execute stmt1 using
@arg60, @arg61 ;
drop table t1 ;
##### RULES OF THUMB TO PRESERVE THE SYSTEMATICS OF THE PS TEST CASES #####
#
# 0. You don't have the time to
# - read and pay attention to these rules of thumb
# - accept that QA may move your test case to a different place
# (I will not change your code!!) .
# Please append your test case to
# t/ps.test
#
# 1. You have more time and want to get as much value from you test case as
# possible. Please try to make the following decisions:
#
# Will the execution or result of the sub test case depend on the
# properties of a storage engine ?
#
# NO --> alter t/ps_1general.test (Example: Command with syntax error)
# If you need a table, please try to use
# t1 - very simple table
# t_many_col_types - table with nearly all available column types
# whenever possible.
#
# The structure and the content of these tables can be found in
# include/ps_create.inc CREATE TABLE ...
# include/ps_renew.inc DELETE all rows and INSERT some rows
#
# Both tables are managed by the same storage engine.
# The type of the storage engine is stored in the variable
# '$type' . In ps_1general.test $type is set to 'MYISAM'.
#
# Please feel free to source ps_create.inc or ps_renew.inc
# whenever you think it helps. But please restore the original
# state of these tables after your tests, because the following
# statements may depend on it.
#
# YES
# |
# |
# Is it possible to apply the sub test case to all table types ?
# YES --> alter include/ps_query.inc (for SELECTs)
# include/ps_modify.inc (for INSERT/UPDATE/DELETE)
# include/ps_modify1.inc (also for INSERT/UPDATE/DELETE,
# but t/ps_5merge.test will not source that file)
# Please try to find an appropriate place within the file.
# It would be nice if we have some systematics in the
# order of the sub test cases (if possible).
#
# Please be aware, that
# include: ps_query.inc, ps_modify.inc, ps_modify1.inc
# will be sourced by several test case files stored within the
# subdirectory 't'. So every change here will affect several test
# cases.
#
# NO
# |
# |
# Append the sub test case to the appropriate
# ps_<number><table type>.test .
#
# 2. The current structure of the PS tests
#
# t/ps_1general.test Check of basic PS features, SHOW commands and DDL
# The tests should not depend on the table type.
#
# t/ps_2myisam Check of PS on tables of type MYISAM .
# t/ps_3innodb Check of PS on tables of type InnoDB .
# ...
# t/ps_6bdb Check of PS on tables of type BDB .
# All storage engine related tests use the variable $type to hold the
# name of the storage engine.
#
# include/ps_query.inc test cases with SELECT/...
# These test cases should not modify the content or
# the structure (DROP/ALTER..) of the tables
# 't1' and 't_many_col_types'.
# include/ps_modify.inc test cases with INSERT/UPDATE/...
# These test cases should not modify the structure
# (DROP/ALTER..) of the tables
# 't1' and 't_many_col_types'.
# These two test sequences will be applied to all table types .
#
# include/ps_modify1.inc test cases with INSERT/UPDATE/...
# This test sequences will be applied to all table types
# except MERGE tables.
#
# include/ps_create.inc DROP and CREATE of the tables
# 't1' and 't_many_col_types' .
# include/ps_renew.inc DELETE all rows and INSERT some rows, that means
# recreate the original content of these tables.
# Please do not alter the commands concerning these two tables.
#
# Please feel free and encouraged to exploit the current code sharing
# mechanism of the 'ps_<number><table type>' test cases. It is an convenient
# way to check all storage engines.
#
# Thank you for reading these rules of thumb.
#
# Matthias

View File

@ -4,6 +4,10 @@
# #
###############################################
#
# NOTE: PLEASE SEE ps_1general.test (bottom)
# BEFORE ADDING NEW TEST CASES HERE !!!
use test;
let $type= 'MYISAM' ;

View File

@ -4,8 +4,14 @@
# #
###############################################
#
# NOTE: PLEASE SEE ps_1general.test (bottom)
# BEFORE ADDING NEW TEST CASES HERE !!!
use test;
-- source include/have_innodb.inc
let $type= 'InnoDB' ;
-- source include/ps_create.inc
-- source include/ps_renew.inc

View File

@ -4,6 +4,10 @@
# #
###############################################
#
# NOTE: PLEASE SEE ps_1general.test (bottom)
# BEFORE ADDING NEW TEST CASES HERE !!!
use test;
let $type= 'HEAP' ;
@ -19,7 +23,8 @@ eval create table t1
--disable_warnings
drop table if exists t_many_col_types;
--enable_warnings
# The used table type doesn't support BLOB/TEXT columns (error 1163)
# The used table type doesn't support BLOB/TEXT columns.
# (The server would send error 1163 .)
# So we use char(100) instead.
eval create table t_many_col_types
(

View File

@ -4,6 +4,10 @@
# #
###############################################
#
# NOTE: PLEASE SEE ps_1general.test (bottom)
# BEFORE ADDING NEW TEST CASES HERE !!!
use test;
--disable_warnings

View File

@ -4,6 +4,10 @@
# #
###############################################
#
# NOTE: PLEASE SEE ps_1general.test (bottom)
# BEFORE ADDING NEW TEST CASES HERE !!!
use test;
-- source include/have_bdb.inc

View File

@ -26,7 +26,7 @@ show create database test2;
show create database test3;
connection master;
set @@collation_server=armscii_bin;
set @@collation_server=armscii8_bin;
drop database test3;
create database test3;
--disable_query_log

View File

@ -38,6 +38,7 @@ extern CHARSET_INFO my_charset_ucs2_danish_uca_ci;
extern CHARSET_INFO my_charset_ucs2_lithuanian_uca_ci;
extern CHARSET_INFO my_charset_ucs2_slovak_uca_ci;
extern CHARSET_INFO my_charset_ucs2_spanish2_uca_ci;
extern CHARSET_INFO my_charset_ucs2_roman_uca_ci;
#endif
#ifdef HAVE_CHARSET_utf8
@ -56,6 +57,7 @@ extern CHARSET_INFO my_charset_utf8_danish_uca_ci;
extern CHARSET_INFO my_charset_utf8_lithuanian_uca_ci;
extern CHARSET_INFO my_charset_utf8_slovak_uca_ci;
extern CHARSET_INFO my_charset_utf8_spanish2_uca_ci;
extern CHARSET_INFO my_charset_utf8_roman_uca_ci;
#endif
my_bool init_compiled_charsets(myf flags __attribute__((unused)))
@ -124,6 +126,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused)))
add_compiled_collation(&my_charset_ucs2_lithuanian_uca_ci);
add_compiled_collation(&my_charset_ucs2_slovak_uca_ci);
add_compiled_collation(&my_charset_ucs2_spanish2_uca_ci);
add_compiled_collation(&my_charset_ucs2_roman_uca_ci);
#endif
#ifdef HAVE_CHARSET_ujis
@ -149,6 +152,7 @@ my_bool init_compiled_charsets(myf flags __attribute__((unused)))
add_compiled_collation(&my_charset_utf8_lithuanian_uca_ci);
add_compiled_collation(&my_charset_utf8_slovak_uca_ci);
add_compiled_collation(&my_charset_utf8_spanish2_uca_ci);
add_compiled_collation(&my_charset_utf8_roman_uca_ci);
#endif
/* Copy compiled charsets */

View File

@ -24,8 +24,8 @@ public:
ValueType m_type;
union {
Uint32 m_int;
const char * m_string;
Uint64 m_int64;
const char * m_string;
};
};
@ -72,14 +72,14 @@ private:
friend class ConstIterator;
bool getByPos(Uint32 pos, Entry *) const;
Uint64 & get64(Uint32 index) const;
char * & getString(Uint32 index) const;
Uint64 * get64(Uint32 index) const;
char ** getString(Uint32 index) const;
Uint32 m_size;
Uint32 m_dataSize;
Uint32 m_stringCount;
Uint32 m_int64Count;
Uint32 m_values[1];
void * m_data[1];
};

View File

@ -60,7 +60,7 @@ ConfigValues::ConfigValues(Uint32 sz, Uint32 dsz){
ConfigValues::~ConfigValues(){
for(Uint32 i = 0; i<m_stringCount; i++){
free(getString(i));
free(* getString(i));
}
}
@ -87,10 +87,10 @@ ConfigValues::getByPos(Uint32 pos, Entry * result) const {
result->m_int = val;
break;
case StringType:
result->m_string = getString(val);
result->m_string = * getString(val);
break;
case Int64Type:
result->m_int64 = get64(val);
result->m_int64 = * get64(val);
break;
case InvalidType:
default:
@ -102,18 +102,23 @@ ConfigValues::getByPos(Uint32 pos, Entry * result) const {
return true;
}
Uint64 &
Uint64 *
ConfigValues::get64(Uint32 index) const {
assert(index < m_int64Count);
Uint64 * ptr = (Uint64*)(&m_values[m_size << 1]);
return ptr[index];
const Uint32 * data = m_values + (m_size << 1);
Uint64 * ptr = (Uint64*)data;
ptr += index;
return ptr;
}
char * &
char **
ConfigValues::getString(Uint32 index) const {
assert(index < m_stringCount);
char ** ptr = (char**)(((char *)&(m_values[m_size << 1])) + m_dataSize);
return ptr[-index];
assert(index < m_stringCount);
const Uint32 * data = m_values + (m_size << 1);
char * ptr = (char*)data;
ptr += m_dataSize;
ptr -= (index * sizeof(char *));
return (char**)ptr;
}
bool
@ -176,7 +181,7 @@ ConfigValues::Iterator::set(Uint32 key, Uint64 value){
return false;
}
m_cfg.get64(m_cfg.m_values[pos+1]) = value;
* m_cfg.get64(m_cfg.m_values[pos+1]) = value;
return true;
}
@ -191,9 +196,9 @@ ConfigValues::Iterator::set(Uint32 key, const char * value){
return false;
}
char * & str = m_cfg.getString(m_cfg.m_values[pos+1]);
free(str);
str = strdup(value ? value : "");
char ** str = m_cfg.getString(m_cfg.m_values[pos+1]);
free(* str);
* str = strdup(value ? value : "");
return true;
}
@ -457,7 +462,8 @@ ConfigValuesFactory::put(const ConfigValues::Entry & entry){
case ConfigValues::StringType:{
Uint32 index = m_cfg->m_stringCount++;
m_cfg->m_values[pos+1] = index;
m_cfg->getString(index) = strdup(entry.m_string ? entry.m_string : "");
char ** ref = m_cfg->getString(index);
* ref = strdup(entry.m_string ? entry.m_string : "");
m_freeKeys--;
m_freeData -= sizeof(char *);
DEBUG printf("Putting at: %d(%d) (loop = %d) key: %d value(%d): %s\n",
@ -470,7 +476,7 @@ ConfigValuesFactory::put(const ConfigValues::Entry & entry){
case ConfigValues::Int64Type:{
Uint32 index = m_cfg->m_int64Count++;
m_cfg->m_values[pos+1] = index;
m_cfg->get64(index) = entry.m_int64;
* m_cfg->get64(index) = entry.m_int64;
m_freeKeys--;
m_freeData -= 8;
DEBUG printf("Putting at: %d(%d) (loop = %d) key: %d value64(%d): %lld\n",
@ -558,7 +564,7 @@ ConfigValues::getPackedSize() const {
break;
case StringType:
size += 8; // key + len
size += mod4(strlen(getString(m_values[i+1])) + 1);
size += mod4(strlen(* getString(m_values[i+1])) + 1);
break;
case InvalidType:
default:
@ -587,7 +593,7 @@ ConfigValues::pack(void * _dst, Uint32 _len) const {
* (Uint32*)dst = htonl(val); dst += 4;
break;
case Int64Type:{
Uint64 i64 = get64(val);
Uint64 i64 = * get64(val);
Uint32 hi = (i64 >> 32);
Uint32 lo = (i64 & 0xFFFFFFFF);
* (Uint32*)dst = htonl(key); dst += 4;
@ -596,7 +602,7 @@ ConfigValues::pack(void * _dst, Uint32 _len) const {
}
break;
case StringType:{
const char * str = getString(val);
const char * str = * getString(val);
Uint32 len = strlen(str) + 1;
* (Uint32*)dst = htonl(key); dst += 4;
* (Uint32*)dst = htonl(len); dst += 4;

View File

@ -63,7 +63,7 @@ Ndbfs::Ndbfs(const Configuration & conf) :
const ndb_mgm_configuration_iterator * p = conf.getOwnConfigIterator();
ndbrequire(p != 0);
m_maxOpenedFiles = 40;
m_maxFiles = 40;
//ndb_mgm_get_int_parameter(p, CFG_DB_MAX_OPEN_FILES, &m_maxFiles);
// Create idle AsyncFiles

View File

@ -795,8 +795,8 @@ inline
void
UnsafeArrayPool<T>::getPtrForce(Ptr<T> & ptr){
Uint32 i = ptr.i;
if(i < size){
ptr.p = &theArray[i];
if(i < this->size){
ptr.p = &this->theArray[i];
} else {
ErrorReporter::handleAssert("UnsafeArrayPool<T>::getPtr",
__FILE__, __LINE__);
@ -808,8 +808,8 @@ inline
void
UnsafeArrayPool<T>::getPtrForce(ConstPtr<T> & ptr) const{
Uint32 i = ptr.i;
if(i < size){
ptr.p = &theArray[i];
if(i < this->size){
ptr.p = &this->theArray[i];
} else {
ErrorReporter::handleAssert("UnsafeArrayPool<T>::getPtr",
__FILE__, __LINE__);
@ -820,8 +820,8 @@ template <class T>
inline
T *
UnsafeArrayPool<T>::getPtrForce(Uint32 i){
if(i < size){
return &theArray[i];
if(i < this->size){
return &this->theArray[i];
} else {
ErrorReporter::handleAssert("UnsafeArrayPool<T>::getPtr",
__FILE__, __LINE__);
@ -833,8 +833,8 @@ template <class T>
inline
const T *
UnsafeArrayPool<T>::getConstPtrForce(Uint32 i) const {
if(i < size){
return &theArray[i];
if(i < this->size){
return &this->theArray[i];
} else {
ErrorReporter::handleAssert("UnsafeArrayPool<T>::getPtr",
__FILE__, __LINE__);
@ -847,8 +847,8 @@ inline
void
UnsafeArrayPool<T>::getPtrForce(Ptr<T> & ptr, Uint32 i){
ptr.i = i;
if(i < size){
ptr.p = &theArray[i];
if(i < this->size){
ptr.p = &this->theArray[i];
return ;
} else {
ErrorReporter::handleAssert("UnsafeArrayPool<T>::getPtr",
@ -861,8 +861,8 @@ inline
void
UnsafeArrayPool<T>::getPtrForce(ConstPtr<T> & ptr, Uint32 i) const{
ptr.i = i;
if(i < size){
ptr.p = &theArray[i];
if(i < this->size){
ptr.p = &this->theArray[i];
return ;
} else {
ErrorReporter::handleAssert("UnsafeArrayPool<T>::getPtr",

View File

@ -153,11 +153,11 @@ public:
LocalDLFifoList(ArrayPool<T> & thePool, typename DLFifoList<T>::Head & _src)
: DLFifoList<T>(thePool), src(_src)
{
head = src;
this->head = src;
}
~LocalDLFifoList(){
src = head;
src = this->head;
}
private:
typename DLFifoList<T>::Head & src;

View File

@ -169,11 +169,11 @@ public:
LocalDLList(ArrayPool<T> & thePool, typename DLList<T>::Head & _src)
: DLList<T>(thePool), src(_src)
{
head = src;
this->head = src;
}
~LocalDLList(){
src = head;
src = this->head;
}
private:
typename DLList<T>::Head & src;

View File

@ -174,11 +174,11 @@ public:
typename DataBuffer<sz>::Head & _src)
: DataBuffer<sz>(thePool), src(_src)
{
head = src;
this->head = src;
}
~LocalDataBuffer(){
src = head;
src = this->head;
}
private:
typename DataBuffer<sz>::Head & src;

View File

@ -137,11 +137,11 @@ public:
LocalSLList(ArrayPool<T> & thePool, typename SLList<T>::Head & _src)
: SLList<T>(thePool), src(_src)
{
head = src;
this->head = src;
}
~LocalSLList(){
src = head;
src = this->head;
}
private:
typename SLList<T>::Head & src;

View File

@ -1417,7 +1417,7 @@ NdbDictInterface::createOrAlterTable(Ndb & ndb,
s = SimpleProperties::pack(w,
&tmpAttr,
DictTabInfo::AttributeMapping,
DictTabInfo::TableMappingSize, true);
DictTabInfo::AttributeMappingSize, true);
w.add(DictTabInfo::AttributeEnd, 1);
}

View File

@ -17,8 +17,24 @@ bindir=""
file=mysql_fix_privilege_tables.sql
# The following test is to make this script compatible with the 4.0 where
# the single argument could be a password
if test "$#" = 1
then
case "$1" in
--*) ;;
*) old_style_password="$1" ; shift ;;
esac
fi
# The following code is almost identical to the code in mysql_install_db.sh
case "$1" in
--no-defaults|--defaults-file=*|--defaults-extra-file=*)
defaults="$1"; shift
;;
esac
parse_arguments() {
# We only need to pass arguments through to the server if we don't
# handle them here. So, we collect unrecognized options (passed on
@ -36,7 +52,7 @@ parse_arguments() {
--user=*) user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--password=*) password=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--host=*) host=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
--sql|--sql-only) sql_only=1;;
--sql|--sql-only) sql_only=1 ;;
--verbose) verbose=1 ;;
--port=*) port=`echo "$arg" | sed -e "s;--port=;;"` ;;
--socket=*) socket=`echo "$arg" | sed -e "s;--socket=;;"` ;;
@ -47,7 +63,7 @@ parse_arguments() {
then
# This sed command makes sure that any special chars are quoted,
# so the arg gets passed exactly to the server.
args="$args "`echo "$arg" | sed -e 's,\([^a-zA-Z0-9_.-]\),\\\\\1,g'`
args="$args "`echo "$arg" | sed -e 's,\([^=a-zA-Z0-9_.-]\),\\\\\1,g'`
fi
;;
esac
@ -94,11 +110,9 @@ else
fi
fi
# The following test is to make this script compatible with the 4.0 where
# the first argument was the password
if test -z "$password"
then
password=`echo $args | sed -e 's/ *//g'`
password=$old_style_password
fi
cmd="$bindir/mysql -f --user=$user --host=$host"

View File

@ -188,9 +188,9 @@ static int free_share(ARCHIVE_SHARE *share)
hash_delete(&archive_open_tables, (byte*) share);
thr_lock_delete(&share->lock);
pthread_mutex_destroy(&share->mutex);
my_free((gptr) share, MYF(0));
if (gzclose(share->archive_write) == Z_ERRNO)
rc= -1;
my_free((gptr) share, MYF(0));
}
pthread_mutex_unlock(&archive_mutex);

View File

@ -97,8 +97,7 @@ class ha_berkeley: public handler
ulong index_flags(uint idx, uint part) const
{
ulong flags=HA_READ_NEXT | HA_READ_PREV;
if (part == (uint)~0 ||
table->key_info[idx].key_part[part].field->key_type() != HA_KEYTYPE_TEXT)
if (table->key_info[idx].key_part[part].field->key_type() != HA_KEYTYPE_TEXT)
flags|= HA_READ_ORDER | HA_KEYREAD_ONLY | HA_READ_RANGE;
return flags;
}

View File

@ -449,7 +449,7 @@ public:
virtual const char *table_type() const =0;
virtual const char **bas_ext() const =0;
virtual ulong table_flags(void) const =0;
virtual ulong index_flags(uint idx, uint part=~0) const =0;
virtual ulong index_flags(uint idx, uint part=0) const =0;
virtual ulong index_ddl_flags(KEY *wanted_index) const
{ return (HA_DDL_SUPPORT); }
virtual int add_index(TABLE *table_arg, KEY *key_info, uint num_of_keys)

View File

@ -2298,15 +2298,18 @@ String *Item_func_unhex::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
/* Convert given hex string to a binary string */
String *res= args[0]->val_str(str);
const char *from=res->ptr(), *end;
char *to;
int r;
if (!res || tmp_value.alloc((1+res->length())/2))
{
null_value=1;
return 0;
}
const char *from=res->ptr(), *end;
char *to;
int r;
null_value=0;
tmp_value.length((1+res->length())/2);
to= (char*) tmp_value.ptr();

View File

@ -801,6 +801,7 @@ bool is_keyword(const char *name, uint len);
#define MY_DB_OPT_FILE "db.opt"
bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create);
void my_dbopt_free(void);
/*
External variables
@ -894,7 +895,8 @@ extern pthread_mutex_t LOCK_mysql_create_db,LOCK_Acl,LOCK_open,
LOCK_delayed_status, LOCK_delayed_create, LOCK_crypt, LOCK_timezone,
LOCK_slave_list, LOCK_active_mi, LOCK_manager,
LOCK_global_system_variables, LOCK_user_conn;
extern rw_lock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave;
extern rw_lock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave,
LOCK_dboptions;
extern pthread_cond_t COND_refresh, COND_thread_count, COND_manager;
extern pthread_attr_t connection_attrib;
extern I_List<THD> threads;

View File

@ -382,7 +382,8 @@ pthread_mutex_t LOCK_mysql_create_db, LOCK_Acl, LOCK_open, LOCK_thread_count,
LOCK_crypt, LOCK_bytes_sent, LOCK_bytes_received,
LOCK_global_system_variables,
LOCK_user_conn, LOCK_slave_list, LOCK_active_mi;
rw_lock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave;
rw_lock_t LOCK_grant, LOCK_sys_init_connect, LOCK_sys_init_slave,
LOCK_dboptions;
pthread_cond_t COND_refresh,COND_thread_count, COND_slave_stopped,
COND_slave_start;
pthread_cond_t COND_thread_cache,COND_flush_thread_cache;
@ -901,6 +902,7 @@ void clean_up(bool print_message)
bitmap_free(&slave_error_mask);
#endif
my_tz_free();
my_dbopt_free();
#ifndef NO_EMBEDDED_ACCESS_CHECKS
acl_free(1);
grant_free();
@ -986,6 +988,7 @@ static void clean_up_mutexes()
(void) pthread_mutex_destroy(&LOCK_mysql_create_db);
(void) pthread_mutex_destroy(&LOCK_Acl);
(void) rwlock_destroy(&LOCK_grant);
(void) rwlock_destroy(&LOCK_dboptions);
(void) pthread_mutex_destroy(&LOCK_open);
(void) pthread_mutex_destroy(&LOCK_thread_count);
(void) pthread_mutex_destroy(&LOCK_mapped_file);
@ -2408,6 +2411,7 @@ static int init_thread_environment()
(void) my_rwlock_init(&LOCK_sys_init_connect, NULL);
(void) my_rwlock_init(&LOCK_sys_init_slave, NULL);
(void) my_rwlock_init(&LOCK_grant, NULL);
(void) my_rwlock_init(&LOCK_dboptions, NULL);
(void) pthread_cond_init(&COND_thread_count,NULL);
(void) pthread_cond_init(&COND_refresh,NULL);
(void) pthread_cond_init(&COND_thread_cache,NULL);

View File

@ -629,7 +629,7 @@ static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref,
if (!(field->flags & PART_KEY_FLAG))
return 0; // Not key field
*prefix_len= 0;
TABLE *table= field->table;
uint idx= 0;
@ -637,16 +637,17 @@ static bool find_key_for_maxmin(bool max_fl, TABLE_REF *ref,
for (keyinfo= table->key_info, keyinfo_end= keyinfo+table->keys ;
keyinfo != keyinfo_end;
keyinfo++,idx++)
{
if (!(table->file->index_flags(idx) & HA_READ_ORDER))
break;
{
KEY_PART_INFO *part,*part_end;
key_part_map key_part_to_use= 0;
uint jdx= 0;
for (part= keyinfo->key_part, part_end= part+keyinfo->key_parts ;
part != part_end ;
part++, key_part_to_use= (key_part_to_use << 1) | 1)
part++, jdx++, key_part_to_use= (key_part_to_use << 1) | 1)
{
if (!(table->file->index_flags(idx, jdx) & HA_READ_ORDER))
return 0;
if (field->eq(part->field))
{
ref->key= idx;

View File

@ -312,3 +312,4 @@ character-set=latin2
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -306,3 +306,4 @@ character-set=latin1
"Modtog temporary fejl %d '%-.100s' fra %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -314,3 +314,4 @@ character-set=latin1
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -303,3 +303,4 @@ character-set=latin1
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -308,3 +308,4 @@ character-set=latin7
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -303,3 +303,4 @@ character-set=latin1
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -315,3 +315,4 @@ character-set=latin1
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -303,3 +303,4 @@ character-set=greek
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -305,3 +305,4 @@ character-set=latin2
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -303,3 +303,4 @@ character-set=latin1
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -305,3 +305,4 @@ character-set=ujis
"Got temporary NDB error %d '%-.100s'",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -303,3 +303,4 @@ character-set=euckr
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -305,3 +305,4 @@ character-set=latin1
"Mottok temporary feil %d '%-.100s' fra %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -305,3 +305,4 @@ character-set=latin1
"Mottok temporary feil %d '%-.100s' fra %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -307,3 +307,4 @@ character-set=latin2
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -304,3 +304,4 @@ character-set=latin1
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -307,3 +307,4 @@ character-set=latin2
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -305,3 +305,4 @@ character-set=koi8r
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -309,3 +309,4 @@ character-set=cp1250
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -311,3 +311,4 @@ character-set=latin2
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -305,3 +305,4 @@ character-set=latin1
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -303,3 +303,4 @@ character-set=latin1
"Fick tilfällig felkod %d '%-.100s' från %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -308,3 +308,4 @@ character-set=koi8u
"Got temporary error %d '%-.100s' from %s",
"Unknown or incorrect time zone: '%-.64s'",
"Invalid TIMESTAMP value in column '%s' at row %ld",
"Invalid %s character string: '%.64s'",

View File

@ -1790,11 +1790,13 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
col_privs->field[3]->pack_length());
key_copy(key,col_privs,0,key_len);
col_privs->field[4]->store("",0, &my_charset_latin1);
if (col_privs->file->index_read_idx(col_privs->record[0],0,
col_privs->file->ha_index_init(0);
if (col_privs->file->index_read(col_privs->record[0],
(byte*) col_privs->field[0]->ptr,
key_len, HA_READ_KEY_EXACT))
{
cols = 0; /* purecov: deadcode */
col_privs->file->ha_index_end();
return;
}
do
@ -1814,6 +1816,7 @@ GRANT_TABLE::GRANT_TABLE(TABLE *form, TABLE *col_privs)
my_hash_insert(&hash_columns, (byte *) mem_check);
} while (!col_privs->file->index_next(col_privs->record[0]) &&
!key_cmp_if_same(col_privs,key,0,key_len));
col_privs->file->ha_index_end();
}
}

View File

@ -533,21 +533,23 @@ bool THD::convert_string(String *s, CHARSET_INFO *from_cs, CHARSET_INFO *to_cs)
return FALSE;
}
/*
Update some cache variables when character set changes
*/
void THD::update_charset()
{
charset_is_system_charset= my_charset_same(charset(),system_charset_info);
charset_is_collation_connection= my_charset_same(charset(),
variables.
collation_connection);
uint32 not_used;
charset_is_system_charset= !String::needs_conversion(0,charset(),
system_charset_info,
&not_used);
charset_is_collation_connection=
!String::needs_conversion(0,charset(),variables.collation_connection,
&not_used);
}
/* routings to adding tables to list of changed in transaction tables */
inline static void list_include(CHANGED_TABLE_LIST** prev,

View File

@ -39,6 +39,184 @@ static long mysql_rm_known_files(THD *thd, MY_DIR *dirp,
const char *db, const char *path,
uint level);
/* Database options hash */
static HASH dboptions;
static my_bool dboptions_init= 0;
/* Structure for database options */
typedef struct my_dbopt_st
{
char *name; /* Database name */
uint name_length; /* Database length name */
CHARSET_INFO *charset; /* Database default character set */
} my_dbopt_t;
/*
Function we use in the creation of our hash to get key.
*/
static byte* dboptions_get_key(my_dbopt_t *opt, uint *length,
my_bool not_used __attribute__((unused)))
{
*length= opt->name_length;
return (byte*) opt->name;
}
/*
Function to free dboptions hash element
*/
static void free_dbopt(void *dbopt)
{
my_free((gptr) dbopt, MYF(0));
}
/*
Initialize database option hash.
*/
static my_bool my_dbopt_init(void)
{
my_bool rc;
rw_wrlock(&LOCK_dboptions);
if (!dboptions_init)
{
dboptions_init= 1;
rc= hash_init(&dboptions, lower_case_table_names ?
&my_charset_bin : system_charset_info,
32, 0, 0, (hash_get_key) dboptions_get_key,
free_dbopt,0);
}
else
rc= 0;
rw_unlock(&LOCK_dboptions);
return rc;
}
/*
Free database option hash.
*/
void my_dbopt_free(void)
{
rw_wrlock(&LOCK_dboptions);
if (dboptions_init)
{
hash_free(&dboptions);
dboptions_init= 0;
}
rw_unlock(&LOCK_dboptions);
}
/*
Find database options in the hash.
DESCRIPTION
Search a database options in the hash, usings its path.
Fills "create" on success.
RETURN VALUES
0 on success.
1 on error.
*/
static my_bool get_dbopt(const char *dbname, HA_CREATE_INFO *create)
{
my_dbopt_t *opt;
uint length;
my_bool rc;
if (my_dbopt_init())
return 1;
length= (uint) strlen(dbname);
rw_rdlock(&LOCK_dboptions);
if ((opt= (my_dbopt_t*) hash_search(&dboptions, (byte*) dbname, length)))
{
create->default_table_charset= opt->charset;
rc= 0;
}
else
rc= 1;
rw_unlock(&LOCK_dboptions);
return rc;
}
/*
Writes database options into the hash.
DESCRIPTION
Inserts database options into the hash, or updates
options if they are already in the hash.
RETURN VALUES
0 on success.
1 on error.
*/
static my_bool put_dbopt(const char *dbname, HA_CREATE_INFO *create)
{
my_dbopt_t *opt;
uint length;
my_bool rc;
if (my_dbopt_init())
return 1;
length= (uint) strlen(dbname);
rw_wrlock(&LOCK_dboptions);
if ((opt= (my_dbopt_t*) hash_search(&dboptions, (byte*) dbname, length)))
{
/* Options are already in hash, update them */
opt->charset= create->default_table_charset;
rc= 0;
}
else
{
/* Options are not in the hash, insert them */
char *tmp_name;
if (!my_multi_malloc(MYF(MY_WME | MY_ZEROFILL),
&opt, sizeof(*opt), &tmp_name, length+1, NullS))
{
rc= 1;
goto ret;
}
opt->name= tmp_name;
opt->name_length= length;
opt->charset= create->default_table_charset;
strmov(opt->name, dbname);
if ((rc= my_hash_insert(&dboptions, (byte*) opt)))
my_free((gptr) opt, MYF(0));
}
ret:
rw_unlock(&LOCK_dboptions);
return rc;
}
/*
Deletes database options from the hash.
*/
void del_dbopt(const char *path)
{
my_dbopt_t *opt;
rw_wrlock(&LOCK_dboptions);
if ((opt= (my_dbopt_t *)hash_search(&dboptions, path, strlen(path))))
hash_delete(&dboptions, (byte*) opt);
rw_unlock(&LOCK_dboptions);
}
/*
Create database options file:
@ -56,15 +234,19 @@ static bool write_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
char buf[256]; // Should be enough for one option
bool error=1;
if (!create->default_table_charset)
create->default_table_charset= thd->variables.collation_server;
if (put_dbopt(path, create))
return 1;
if ((file=my_create(path, CREATE_MODE,O_RDWR | O_TRUNC,MYF(MY_WME))) >= 0)
{
ulong length;
CHARSET_INFO *cs= ((create && create->default_table_charset) ?
create->default_table_charset :
thd->variables.collation_server);
length= my_sprintf(buf,(buf,
"default-character-set=%s\ndefault-collation=%s\n",
cs->csname,cs->name));
create->default_table_charset->csname,
create->default_table_charset->name));
/* Error is written by my_write */
if (!my_write(file,(byte*) buf, length, MYF(MY_NABP+MY_WME)))
@ -101,6 +283,12 @@ bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
bzero((char*) create,sizeof(*create));
create->default_table_charset= thd->variables.collation_server;
/* Check if options for this database are already in the hash */
if (!get_dbopt(path, create))
DBUG_RETURN(0);
/* Otherwise, load options from the .opt file */
if ((file=my_open(path, O_RDONLY | O_SHARE, MYF(0))) >= 0)
{
IO_CACHE cache;
@ -137,9 +325,16 @@ bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
}
}
}
error=0;
end_io_cache(&cache);
my_close(file,MYF(0));
/*
Put the loaded value into the hash.
Note that another thread could've added the same
entry to the hash after we called get_dbopt(),
but it's not an error, as put_dbopt() takes this
possibility into account.
*/
error= put_dbopt(path, create);
}
DBUG_RETURN(error);
}
@ -338,6 +533,8 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
int error = 0;
char path[FN_REFLEN+16], tmp_db[NAME_LEN+1];
MY_DIR *dirp;
uint length;
my_dbopt_t *dbopt;
DBUG_ENTER("mysql_rm_db");
VOID(pthread_mutex_lock(&LOCK_mysql_create_db));
@ -350,7 +547,11 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
}
(void) sprintf(path,"%s/%s",mysql_data_home,db);
unpack_dirname(path,path); // Convert if not unix
length= unpack_dirname(path,path); // Convert if not unix
strmov(path+length, MY_DB_OPT_FILE); // Append db option file name
del_dbopt(path); // Remove dboption hash entry
path[length]= '\0'; // Remove file name
/* See if the directory exists */
if (!(dirp = my_dir(path,MYF(MY_DONT_SORT))))
{

View File

@ -4805,6 +4805,7 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
if (lock_global_read_lock(thd))
return 1;
}
my_dbopt_free();
result=close_cached_tables(thd,(options & REFRESH_FAST) ? 0 : 1, tables);
}
if (options & REFRESH_HOSTS)

View File

@ -2825,7 +2825,7 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
Set tmp to (previous record count) * (records / combination)
*/
if ((found_part & 1) &&
(!(table->file->index_flags(key) & HA_ONLY_WHOLE_INDEX) ||
(!(table->file->index_flags(key,0) & HA_ONLY_WHOLE_INDEX) ||
found_part == PREV_BITS(uint,keyinfo->key_parts)))
{
max_key_part=max_part_bit(found_part);
@ -7171,7 +7171,9 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
*/
if (!select->quick->reverse_sorted())
{
if (!(table->file->index_flags(ref_key) & HA_READ_PREV))
// here used_key_parts >0
if (!(table->file->index_flags(ref_key,used_key_parts-1)
& HA_READ_PREV))
DBUG_RETURN(0); // Use filesort
// ORDER BY range_key DESC
QUICK_SELECT_DESC *tmp=new QUICK_SELECT_DESC(select->quick,
@ -7193,8 +7195,9 @@ test_if_skip_sort_order(JOIN_TAB *tab,ORDER *order,ha_rows select_limit,
Use a traversal function that starts by reading the last row
with key part (A) and then traverse the index backwards.
*/
if (!(table->file->index_flags(ref_key) & HA_READ_PREV))
DBUG_RETURN(0); // Use filesort
if (!(table->file->index_flags(ref_key,used_key_parts-1)
& HA_READ_PREV))
DBUG_RETURN(0); // Use filesort
tab->read_first_record= join_read_last_key;
tab->read_record.read_record= join_read_prev_same;
/* fall through */

View File

@ -995,7 +995,7 @@ mysqld_show_keys(THD *thd, TABLE_LIST *table_list)
str=(key_part->field ? key_part->field->field_name :
"?unknown field?");
protocol->store(str, system_charset_info);
if (table->file->index_flags(i) & HA_READ_ORDER)
if (table->file->index_flags(i,j) & HA_READ_ORDER)
protocol->store(((key_part->key_part_flag & HA_REVERSE_SORT) ?
"D" : "A"), 1, system_charset_info);
else

View File

@ -1158,6 +1158,23 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
}
#endif
/*
If the table character set was not given explicitely,
let's fetch the database default character set and
apply it to the table.
*/
if (!create_info->default_table_charset)
{
HA_CREATE_INFO db_info;
uint length;
char path[FN_REFLEN];
(void) sprintf(path,"%s/%s", mysql_data_home, db);
length= unpack_dirname(path,path); // Convert if not unix
strmov(path+length, MY_DB_OPT_FILE);
load_db_opt(thd, path, &db_info);
create_info->default_table_charset= db_info.default_table_charset;
}
if (mysql_prepare_table(thd, create_info, fields,
keys, tmp_table, db_options, file,
key_info_buffer, &key_count,

View File

@ -1023,7 +1023,7 @@ create:
bzero((char*) &lex->create_info,sizeof(lex->create_info));
lex->create_info.options=$2 | $4;
lex->create_info.db_type= (enum db_type) lex->thd->variables.table_type;
lex->create_info.default_table_charset= thd->variables.collation_database;
lex->create_info.default_table_charset= NULL;
lex->name=0;
}
create2
@ -1815,7 +1815,7 @@ alter:
lex->select_lex.db=lex->name=0;
bzero((char*) &lex->create_info,sizeof(lex->create_info));
lex->create_info.db_type= DB_TYPE_DEFAULT;
lex->create_info.default_table_charset= thd->variables.collation_database;
lex->create_info.default_table_charset= NULL;
lex->create_info.row_type= ROW_TYPE_NOT_USED;
lex->alter_info.reset();
lex->alter_info.is_simple= 1;
@ -4884,7 +4884,19 @@ IDENT_sys:
{
THD *thd= YYTHD;
if (thd->charset_is_system_charset)
{
CHARSET_INFO *cs= system_charset_info;
uint wlen= cs->cset->well_formed_len(cs, $1.str,
$1.str+$1.length,
$1.length);
if (wlen < $1.length)
{
net_printf(YYTHD, ER_INVALID_CHARACTER_STRING, cs->csname,
$1.str + wlen);
YYABORT;
}
$$= $1;
}
else
thd->convert_string(&$$, system_charset_info,
$1.str, $1.length, thd->charset());

View File

@ -167,9 +167,9 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
outparam->keys= keys= disk_buff[0];
outparam->key_parts= key_parts= disk_buff[1];
}
outparam->keys_for_keyread.init(keys);
outparam->keys_for_keyread.init(0);
outparam->keys_in_use.init(keys);
outparam->read_only_keys.init(0);
outparam->read_only_keys.init(keys);
outparam->quick_keys.init();
outparam->used_keys.init();
outparam->keys_in_use_for_query.init();
@ -500,13 +500,6 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
if (outparam->key_info[key].flags & HA_FULLTEXT)
outparam->key_info[key].algorithm= HA_KEY_ALG_FULLTEXT;
/* This has to be done after the above fulltext correction */
if (!(outparam->file->index_flags(key) & HA_KEYREAD_ONLY))
{
outparam->read_only_keys.set_bit(key);
outparam->keys_for_keyread.clear_bit(key);
}
if (primary_key >= MAX_KEY && (keyinfo->flags & HA_NOSAME))
{
/*
@ -577,7 +570,11 @@ int openfrm(const char *name, const char *alias, uint db_stat, uint prgflag,
!(field->flags & BLOB_FLAG))
{
if (outparam->file->index_flags(key, i) & HA_KEYREAD_ONLY)
{
outparam->read_only_keys.clear_bit(key);
outparam->keys_for_keyread.set_bit(key);
field->part_of_key.set_bit(key);
}
if (outparam->file->index_flags(key, i) & HA_READ_ORDER)
field->part_of_sortkey.set_bit(key);
}

View File

@ -6653,6 +6653,9 @@ static const char spanish2[]= /* Also good for Asturian and Galician */
"&N < \\u00F1 <<< \\u00D1"
"&R << rr <<< Rr <<< RR";
static const char roman[]= /* i.e. Classical Latin */
"& I << j <<< J "
"& U << v <<< V ";
/*
Unicode Collation Algorithm:
@ -8328,6 +8331,34 @@ CHARSET_INFO my_charset_ucs2_spanish2_uca_ci=
&my_collation_ucs2_uca_handler
};
CHARSET_INFO my_charset_ucs2_roman_uca_ci=
{
143,0,0, /* number */
MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
"ucs2", /* cs name */
"ucs2_roman_ci", /* name */
"", /* comment */
roman, /* tailoring */
NULL, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
NULL, /* contractions */
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
2, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
0xFFFF, /* max_sort_char */
&my_charset_ucs2_handler,
&my_collation_ucs2_uca_handler
};
#endif
@ -8779,4 +8810,31 @@ CHARSET_INFO my_charset_utf8_spanish2_uca_ci=
&my_charset_utf8_handler,
&my_collation_any_uca_handler
};
CHARSET_INFO my_charset_utf8_roman_uca_ci=
{
207,0,0, /* number */
MY_CS_COMPILED|MY_CS_STRNXFRM|MY_CS_UNICODE,
"utf8", /* cs name */
"utf8_roman_ci", /* name */
"", /* comment */
roman, /* tailoring */
ctype_utf8, /* ctype */
NULL, /* to_lower */
NULL, /* to_upper */
NULL, /* sort_order */
NULL, /* contractions */
NULL, /* sort_order_big*/
NULL, /* tab_to_uni */
NULL, /* tab_from_uni */
NULL, /* state_map */
NULL, /* ident_map */
8, /* strxfrm_multiply */
1, /* mbminlen */
2, /* mbmaxlen */
9, /* min_sort_char */
0xFFFF, /* max_sort_char */
&my_charset_utf8_handler,
&my_collation_any_uca_handler
};
#endif