mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
Merge abotchkov@bk-internal.mysql.com:/home/bk/mysql-4.1
into deer.(none):/home/hf/work/mysql-4.1.clean
This commit is contained in:
commit
5c79810a6d
10 changed files with 56 additions and 18993 deletions
|
@ -591,6 +591,32 @@ err:
|
|||
|
||||
C_MODE_END
|
||||
|
||||
static char *dup_str_aux(MEM_ROOT *root, const char *from, uint length,
|
||||
CHARSET_INFO *fromcs, CHARSET_INFO *tocs)
|
||||
{
|
||||
uint32 dummy32;
|
||||
uint dummy_err;
|
||||
char *result;
|
||||
|
||||
/* 'tocs' is set 0 when client issues SET character_set_results=NULL */
|
||||
if (tocs && String::needs_conversion(0, fromcs, tocs, &dummy32))
|
||||
{
|
||||
uint new_len= (tocs->mbmaxlen * length) / fromcs->mbminlen + 1;
|
||||
result= (char *)alloc_root(root, new_len);
|
||||
length= copy_and_convert(result, new_len,
|
||||
tocs, from, length, fromcs, &dummy_err);
|
||||
}
|
||||
else
|
||||
{
|
||||
result= (char *)alloc_root(root, length + 1);
|
||||
memcpy(result, from, length);
|
||||
}
|
||||
|
||||
result[length]= 0;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
bool Protocol::send_fields(List<Item> *list, uint flag)
|
||||
{
|
||||
List_iterator_fast<Item> it(*list);
|
||||
|
@ -598,6 +624,8 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
|
|||
MYSQL_FIELD *client_field;
|
||||
MYSQL *mysql= thd->mysql;
|
||||
MEM_ROOT *field_alloc;
|
||||
CHARSET_INFO *thd_cs= thd->variables.character_set_results;
|
||||
CHARSET_INFO *cs= system_charset_info;
|
||||
|
||||
DBUG_ENTER("send_fields");
|
||||
|
||||
|
@ -616,12 +644,29 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
|
|||
Send_field server_field;
|
||||
item->make_field(&server_field);
|
||||
|
||||
client_field->db= strdup_root(field_alloc, server_field.db_name);
|
||||
client_field->table= strdup_root(field_alloc, server_field.table_name);
|
||||
client_field->name= strdup_root(field_alloc, server_field.col_name);
|
||||
client_field->org_table= strdup_root(field_alloc, server_field.org_table_name);
|
||||
client_field->org_name= strdup_root(field_alloc, server_field.org_col_name);
|
||||
client_field->length= server_field.length;
|
||||
client_field->db= dup_str_aux(field_alloc, server_field.db_name,
|
||||
strlen(server_field.db_name), cs, thd_cs);
|
||||
client_field->table= dup_str_aux(field_alloc, server_field.table_name,
|
||||
strlen(server_field.table_name), cs, thd_cs);
|
||||
client_field->name= dup_str_aux(field_alloc, server_field.col_name,
|
||||
strlen(server_field.col_name), cs, thd_cs);
|
||||
client_field->org_table= dup_str_aux(field_alloc, server_field.org_table_name,
|
||||
strlen(server_field.org_table_name), cs, thd_cs);
|
||||
client_field->org_name= dup_str_aux(field_alloc, server_field.org_col_name,
|
||||
strlen(server_field.org_col_name), cs, thd_cs);
|
||||
if (item->collation.collation == &my_charset_bin || thd_cs == NULL)
|
||||
{
|
||||
/* No conversion */
|
||||
client_field->charsetnr= server_field.charsetnr;
|
||||
client_field->length= server_field.length;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* With conversion */
|
||||
client_field->charsetnr= thd_cs->number;
|
||||
uint char_len= server_field.length / item->collation.collation->mbmaxlen;
|
||||
client_field->length= char_len * thd_cs->mbmaxlen;
|
||||
}
|
||||
client_field->type= server_field.type;
|
||||
client_field->flags= server_field.flags;
|
||||
client_field->decimals= server_field.decimals;
|
||||
|
@ -630,9 +675,8 @@ bool Protocol::send_fields(List<Item> *list, uint flag)
|
|||
client_field->name_length= strlen(client_field->name);
|
||||
client_field->org_name_length= strlen(client_field->org_name);
|
||||
client_field->org_table_length= strlen(client_field->org_table);
|
||||
client_field->charsetnr= server_field.charsetnr;
|
||||
|
||||
client_field->catalog= strdup_root(field_alloc, "def");
|
||||
client_field->catalog= dup_str_aux(field_alloc, "def", 3, cs, thd_cs);
|
||||
client_field->catalog_length= 3;
|
||||
|
||||
if (INTERNAL_NUM_FIELD(client_field))
|
||||
|
@ -805,21 +849,3 @@ bool Protocol::net_store_data(const char *from, uint length)
|
|||
return false;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* The same as Protocol::net_store_data but does the converstion
|
||||
*/
|
||||
bool Protocol::convert_str(const char *from, uint length)
|
||||
{
|
||||
if (!(*next_field=alloc_root(alloc, length + 1)))
|
||||
return true;
|
||||
convert->store_dest(*next_field, from, length);
|
||||
(*next_field)[length]= 0;
|
||||
if (next_mysql_field->max_length < length)
|
||||
next_mysql_field->max_length=length;
|
||||
++next_field;
|
||||
++next_mysql_field;
|
||||
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,242 +0,0 @@
|
|||
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 'комментарий полÑ<EFBFBD>'
|
||||
) 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_теÑ<EFBFBD>Ñ‚
|
||||
SHOW TABLES IN ÔÅÓÔ;
|
||||
Tables_in_теÑ<EFBFBD>Ñ‚
|
||||
SET CHARACTER SET cp1251;
|
||||
SHOW TABLES;
|
||||
Tables_in_теÑ<EFBFBD>Ñ‚
|
||||
SHOW TABLES IN òåñò;
|
||||
Tables_in_теÑ<EFBFBD>Ñ‚
|
||||
SET CHARACTER SET koi8r;
|
||||
DROP DATABASE ÔÅÓÔ;
|
||||
SET NAMES koi8r;
|
||||
SELECT hex('ÔÅÓÔ');
|
||||
hex('теÑ<C2B5>Ñ‚')
|
||||
D4C5D3D4
|
||||
SET character_set_connection=cp1251;
|
||||
SELECT hex('ÔÅÓÔ');
|
||||
hex('теÑ<C2B5>Ñ‚')
|
||||
F2E5F1F2
|
||||
USE test;
|
||||
SET NAMES binary;
|
||||
CREATE TABLE `теÑ<EFBFBD>Ñ‚` (`теÑ<EFBFBD>Ñ‚` int);
|
||||
SHOW CREATE TABLE `теÑ<EFBFBD>Ñ‚`;
|
||||
Table Create Table
|
||||
теÑ<EFBFBD>Ñ‚ CREATE TABLE `теÑ<EFBFBD>Ñ‚` (
|
||||
`теÑ<EFBFBD>Ñ‚` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
SET NAMES utf8;
|
||||
SHOW CREATE TABLE `теÑ<EFBFBD>Ñ‚`;
|
||||
Table Create Table
|
||||
теÑ<EFBFBD>Ñ‚ CREATE TABLE `теÑ<EFBFBD>Ñ‚` (
|
||||
`теÑ<EFBFBD>Ñ‚` int(11) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||
DROP TABLE `теÑ<EFBFBD>Ñ‚`;
|
||||
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 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)
|
||||
ßöö ößß
|
|
@ -1,185 +0,0 @@
|
|||
drop table if exists t1,t2;
|
||||
select 0=0,1>0,1>=1,1<0,1<=0,1!=0,strcmp("abc","abcd"),strcmp("b","a"),strcmp("a","a") ;
|
||||
0=0 1>0 1>=1 1<0 1<=0 1!=0 strcmp("abc","abcd") strcmp("b","a") strcmp("a","a")
|
||||
1 1 1 0 0 1 -1 1 0
|
||||
select "a"<"b","a"<="b","b">="a","b">"a","a"="A","a"<>"b";
|
||||
"a"<"b" "a"<="b" "b">="a" "b">"a" "a"="A" "a"<>"b"
|
||||
1 1 1 1 1 1
|
||||
select "a "="A", "A "="a", "a " <= "A b";
|
||||
"a "="A" "A "="a" "a " <= "A b"
|
||||
1 1 1
|
||||
select "abc" like "a%", "abc" not like "%d%", "a%" like "a\%","abc%" like "a%\%","abcd" like "a%b_%d", "a" like "%%a","abcde" like "a%_e","abc" like "abc%";
|
||||
"abc" like "a%" "abc" not like "%d%" "a%" like "a\%" "abc%" like "a%\%" "abcd" like "a%b_%d" "a" like "%%a" "abcde" like "a%_e" "abc" like "abc%"
|
||||
1 1 1 1 1 1 1 1
|
||||
select "a" like "%%b","a" like "%%ab","ab" like "a\%", "ab" like "_", "ab" like "ab_", "abc" like "%_d", "abc" like "abc%d";
|
||||
"a" like "%%b" "a" like "%%ab" "ab" like "a\%" "ab" like "_" "ab" like "ab_" "abc" like "%_d" "abc" like "abc%d"
|
||||
0 0 0 0 0 0 0
|
||||
select '?' like '|%', '?' like '|%' ESCAPE '|', '%' like '|%', '%' like '|%' ESCAPE '|', '%' like '%';
|
||||
'?' like '|%' '?' like '|%' ESCAPE '|' '%' like '|%' '%' like '|%' ESCAPE '|' '%' like '%'
|
||||
0 0 0 1 1
|
||||
select 'abc' like '%c','abcabc' like '%c', "ab" like "", "ab" like "a", "ab" like "ab";
|
||||
'abc' like '%c' 'abcabc' like '%c' "ab" like "" "ab" like "a" "ab" like "ab"
|
||||
1 1 0 0 1
|
||||
select "Det här är svenska" regexp "h[[:alpha:]]+r", "aba" regexp "^(a|b)*$";
|
||||
"Det här är svenska" regexp "h[[:alpha:]]+r" "aba" regexp "^(a|b)*$"
|
||||
1 1
|
||||
select "aba" regexp concat("^","a");
|
||||
"aba" regexp concat("^","a")
|
||||
1
|
||||
select !0,NOT 0=1,!(0=0),1 AND 1,1 && 0,0 OR 1,1 || NULL, 1=1 or 1=1 and 1=0;
|
||||
!0 NOT 0=1 !(0=0) 1 AND 1 1 && 0 0 OR 1 1 || NULL 1=1 or 1=1 and 1=0
|
||||
1 1 0 1 0 1 1 1
|
||||
select 2 between 1 and 3, "monty" between "max" and "my",2=2 and "monty" between "max" and "my" and 3=3;
|
||||
2 between 1 and 3 "monty" between "max" and "my" 2=2 and "monty" between "max" and "my" and 3=3
|
||||
1 1 1
|
||||
select 'b' between 'a' and 'c', 'B' between 'a' and 'c';
|
||||
'b' between 'a' and 'c' 'B' between 'a' and 'c'
|
||||
1 1
|
||||
select 2 in (3,2,5,9,5,1),"monty" in ("david","monty","allan"), 1.2 in (1.4,1.2,1.0);
|
||||
2 in (3,2,5,9,5,1) "monty" in ("david","monty","allan") 1.2 in (1.4,1.2,1.0)
|
||||
1 1 1
|
||||
select -1.49 or -1.49,0.6 or 0.6;
|
||||
-1.49 or -1.49 0.6 or 0.6
|
||||
1 1
|
||||
select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
|
||||
3 ^ 11 1 ^ 1 1 ^ 0 1 ^ NULL NULL ^ 1
|
||||
8 0 1 NULL NULL
|
||||
explain extended select 3 ^ 11, 1 ^ 1, 1 ^ 0, 1 ^ NULL, NULL ^ 1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select (3 ^ 11) AS `3 ^ 11`,(1 ^ 1) AS `1 ^ 1`,(1 ^ 0) AS `1 ^ 0`,(1 ^ NULL) AS `1 ^ NULL`,(NULL ^ 1) AS `NULL ^ 1`
|
||||
select 1 XOR 1, 1 XOR 0, 0 XOR 1, 0 XOR 0, NULL XOR 1, 1 XOR NULL, 0 XOR NULL;
|
||||
1 XOR 1 1 XOR 0 0 XOR 1 0 XOR 0 NULL XOR 1 1 XOR NULL 0 XOR NULL
|
||||
0 1 1 0 NULL NULL NULL
|
||||
select 1 like 2 xor 2 like 1;
|
||||
1 like 2 xor 2 like 1
|
||||
0
|
||||
select 10 % 7, 10 mod 7, 10 div 3;
|
||||
10 % 7 10 mod 7 10 div 3
|
||||
3 3 3
|
||||
explain extended select 10 % 7, 10 mod 7, 10 div 3;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select (10 % 7) AS `10 % 7`,(10 % 7) AS `10 mod 7`,(10 DIV 3) AS `10 div 3`
|
||||
select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
|
||||
(1 << 64)-1 ((1 << 64)-1) DIV 1 ((1 << 64)-1) DIV 2
|
||||
18446744073709551615 18446744073709551615 9223372036854775807
|
||||
explain extended select (1 << 64)-1, ((1 << 64)-1) DIV 1, ((1 << 64)-1) DIV 2;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select ((1 << 64) - 1) AS `(1 << 64)-1`,(((1 << 64) - 1) DIV 1) AS `((1 << 64)-1) DIV 1`,(((1 << 64) - 1) DIV 2) AS `((1 << 64)-1) DIV 2`
|
||||
create table t1 (a int);
|
||||
insert t1 values (1);
|
||||
select * from t1 where 1 xor 1;
|
||||
a
|
||||
explain extended select * from t1 where 1 xor 1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables
|
||||
Warnings:
|
||||
Note 1003 select test.t1.a AS `a` from test.t1 where (1 xor 1)
|
||||
select - a from t1;
|
||||
- a
|
||||
-1
|
||||
explain extended select - a from t1;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 system NULL NULL NULL NULL 1
|
||||
Warnings:
|
||||
Note 1003 select -(test.t1.a) AS `- a` from test.t1
|
||||
drop table t1;
|
||||
select 5 between 0 and 10 between 0 and 1,(5 between 0 and 10) between 0 and 1;
|
||||
5 between 0 and 10 between 0 and 1 (5 between 0 and 10) between 0 and 1
|
||||
0 1
|
||||
select 1 and 2 between 2 and 10, 2 between 2 and 10 and 1;
|
||||
1 and 2 between 2 and 10 2 between 2 and 10 and 1
|
||||
1 1
|
||||
select 1 and 0 or 2, 2 or 1 and 0;
|
||||
1 and 0 or 2 2 or 1 and 0
|
||||
1 1
|
||||
select _koi8r'a' = _koi8r'A';
|
||||
_koi8r'a' = _koi8r'A'
|
||||
1
|
||||
select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci;
|
||||
_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci
|
||||
1
|
||||
explain extended select _koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No tables used
|
||||
Warnings:
|
||||
Note 1003 select (_koi8r'a' = (_koi8r'A' collate _latin1'koi8r_general_ci')) AS `_koi8r'a' = _koi8r'A' COLLATE koi8r_general_ci`
|
||||
select _koi8r'a' = _koi8r'A' COLLATE koi8r_bin;
|
||||
_koi8r'a' = _koi8r'A' COLLATE koi8r_bin
|
||||
0
|
||||
select _koi8r'a' COLLATE koi8r_general_ci = _koi8r'A';
|
||||
_koi8r'a' COLLATE koi8r_general_ci = _koi8r'A'
|
||||
1
|
||||
select _koi8r'a' COLLATE koi8r_bin = _koi8r'A';
|
||||
_koi8r'a' COLLATE koi8r_bin = _koi8r'A'
|
||||
0
|
||||
select _koi8r'a' COLLATE koi8r_bin = _koi8r'A' COLLATE koi8r_general_ci;
|
||||
ERROR HY000: Illegal mix of collations (koi8r_bin,EXPLICIT) and (koi8r_general_ci,EXPLICIT) for operation '='
|
||||
select _koi8r'a' = _latin1'A';
|
||||
ERROR HY000: Illegal mix of collations (koi8r_general_ci,COERCIBLE) and (latin1_swedish_ci,COERCIBLE) for operation '='
|
||||
select strcmp(_koi8r'a', _koi8r'A');
|
||||
strcmp(_koi8r'a', _koi8r'A')
|
||||
0
|
||||
select strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_general_ci);
|
||||
strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_general_ci)
|
||||
0
|
||||
select strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_bin);
|
||||
strcmp(_koi8r'a', _koi8r'A' COLLATE koi8r_bin)
|
||||
1
|
||||
select strcmp(_koi8r'a' COLLATE koi8r_general_ci, _koi8r'A');
|
||||
strcmp(_koi8r'a' COLLATE koi8r_general_ci, _koi8r'A')
|
||||
0
|
||||
select strcmp(_koi8r'a' COLLATE koi8r_bin, _koi8r'A');
|
||||
strcmp(_koi8r'a' COLLATE koi8r_bin, _koi8r'A')
|
||||
1
|
||||
select strcmp(_koi8r'a' COLLATE koi8r_general_ci, _koi8r'A' COLLATE koi8r_bin);
|
||||
ERROR HY000: Illegal mix of collations (koi8r_general_ci,EXPLICIT) and (koi8r_bin,EXPLICIT) for operation 'strcmp'
|
||||
select strcmp(_koi8r'a', _latin1'A');
|
||||
ERROR HY000: Illegal mix of collations (koi8r_general_ci,COERCIBLE) and (latin1_swedish_ci,COERCIBLE) for operation 'strcmp'
|
||||
select _koi8r'a' LIKE _koi8r'A';
|
||||
_koi8r'a' LIKE _koi8r'A'
|
||||
1
|
||||
select _koi8r'a' LIKE _koi8r'A' COLLATE koi8r_general_ci;
|
||||
_koi8r'a' LIKE _koi8r'A' COLLATE koi8r_general_ci
|
||||
1
|
||||
select _koi8r'a' LIKE _koi8r'A' COLLATE koi8r_bin;
|
||||
_koi8r'a' LIKE _koi8r'A' COLLATE koi8r_bin
|
||||
0
|
||||
select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A';
|
||||
_koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A'
|
||||
1
|
||||
select _koi8r'a' COLLATE koi8r_bin LIKE _koi8r'A';
|
||||
_koi8r'a' COLLATE koi8r_bin LIKE _koi8r'A'
|
||||
0
|
||||
select _koi8r'a' COLLATE koi8r_general_ci LIKE _koi8r'A' COLLATE koi8r_bin;
|
||||
ERROR HY000: Illegal mix of collations (koi8r_general_ci,EXPLICIT) and (koi8r_bin,EXPLICIT) for operation 'like'
|
||||
select _koi8r'a' LIKE _latin1'A';
|
||||
ERROR HY000: Illegal mix of collations (koi8r_general_ci,COERCIBLE) and (latin1_swedish_ci,COERCIBLE) for operation 'like'
|
||||
CREATE TABLE t1 ( faq_group_id int(11) NOT NULL default '0', faq_id int(11) NOT NULL default '0', title varchar(240) default NULL, keywords text, description longblob, solution longblob, status tinyint(4) NOT NULL default '0', access_id smallint(6) default NULL, lang_id smallint(6) NOT NULL default '0', created datetime NOT NULL default '0000-00-00 00:00:00', updated datetime default NULL, last_access datetime default NULL, last_notify datetime default NULL, solved_count int(11) NOT NULL default '0', static_solved int(11) default NULL, solved_1 int(11) default NULL, solved_2 int(11) default NULL, solved_3 int(11) default NULL, solved_4 int(11) default NULL, solved_5 int(11) default NULL, expires datetime default NULL, notes text, assigned_to smallint(6) default NULL, assigned_group smallint(6) default NULL, last_edited_by smallint(6) default NULL, orig_ref_no varchar(15) binary default NULL, c$fundstate smallint(6) default NULL, c$contributor smallint(6) default NULL, UNIQUE KEY t1$faq_id (faq_id), KEY t1$group_id$faq_id (faq_group_id,faq_id), KEY t1$c$fundstate (c$fundstate) ) ENGINE=MyISAM;
|
||||
INSERT INTO t1 VALUES (82,82,'How to use the DynaVox Usage Counts Feature','usages count, number, corner, white, box, button','<as-html>\r\n<table width=\"100%\" border=\"0\">\r\n <tr>\r\n <td width=\"3%\"> </td>\r\n <td width=\"97%\">\r\n <h3><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#000000\">How \r\n To</font><!-- #BeginEditable \"CS_troubleshoot_question\" --><font face=\"Verdana, Arial, Helvetica, sans-serif\" color=\"#000099\"><font color=\"#000000\">: \r\n Display or Hide the Usage Counts to find out how many times each button is being selected. </font></font><!-- #EndEditable --></h3>\r\n </td>\r\n </tr>\r\n</table>','<as-html>\r\n <table width=\"100%\" border=\"0\">\r\n <tr>\r\n <td width=\"3%\"> </td>\r\n \r\n<td width=\"97%\"><!-- #BeginEditable \"CS_troubleshoot_answer\" --> \r\n \r\n<p><font color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\">1. Select \r\n the <i>On/Setup</i> button to access the DynaVox Setup Menu.<br>\r\n 2. Select <b>Button Features.</b><br>\r\n 3. Below the <b>OK</b> button is the <b>Usage Counts</b> button.<br>\r\n a. If it says \"Hidden\" then the Usage Counts will not be displayed.<br>\r\n b. If it says \"Displayed\" then the Usage Counts will be shown.<br>\r\n c. Select the <b>Usage Counts</b> Option Ring once and it will toggle \r\n to the alternative option.<br>\r\n 4. Once the correct setting has been chosen, select <b>OK</b> to leave the <i>Button \r\n Features</i> menu.<br>\r\n 5. Select <b>OK</b> out of the <i>Setup</i> menu and return to the communication \r\n page.</font></p>\r\n <p><font color=\"#000000\" face=\"Verdana, Arial, Helvetica, sans-serif\">For \r\n further information on <i>Usage Counts,</i> see the <i>Button Features \r\n Menu Entry</i> in the DynaVox/DynaMyte Reference Manual.</font></p>\r\n<!-- #EndEditable --></td>\r\n </tr>\r\n</table>',4,1,1,'2001-11-16 16:43:34','2002-11-25 12:09:43','2003-07-24 01:04:48',NULL,11,NULL,0,0,0,0,0,NULL,NULL,NULL,NULL,11,NULL,NULL,NULL);
|
||||
CREATE TABLE t2 ( access_id smallint(6) NOT NULL default '0', name varchar(20) binary default NULL, rank smallint(6) NOT NULL default '0', KEY t2$access_id (access_id) ) ENGINE=MyISAM;
|
||||
INSERT INTO t2 VALUES (1,'Everyone',2),(2,'Help',3),(3,'Customer Support',1);
|
||||
SELECT f_acc.rank, a1.rank, a2.rank FROM t1 LEFT JOIN t1 f1 ON (f1.access_id=1 AND f1.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a1 ON (a1.access_id = f1.access_id) LEFT JOIN t1 f2 ON (f2.access_id=3 AND f2.faq_group_id = t1.faq_group_id) LEFT JOIN t2 a2 ON (a2.access_id = f2.access_id), t2 f_acc WHERE LEAST(a1.rank,a2.rank) = f_acc.rank;
|
||||
rank rank rank
|
||||
2 2 NULL
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (d varchar(6), k int);
|
||||
INSERT INTO t1 VALUES (NULL, 2);
|
||||
SELECT GREATEST(d,d) FROM t1 WHERE k=2;
|
||||
GREATEST(d,d)
|
||||
NULL
|
||||
DROP TABLE t1;
|
||||
select 1197.90 mod 50;
|
||||
1197.90 mod 50
|
||||
47.90
|
||||
select 5.1 mod 3, 5.1 mod -3, -5.1 mod 3, -5.1 mod -3;
|
||||
5.1 mod 3 5.1 mod -3 -5.1 mod 3 -5.1 mod -3
|
||||
2.1 2.1 -2.1 -2.1
|
||||
select 5 mod 3, 5 mod -3, -5 mod 3, -5 mod -3;
|
||||
5 mod 3 5 mod -3 -5 mod 3 -5 mod -3
|
||||
2 2 -2 -2
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -808,7 +808,7 @@ SET NAMES koi8r;
|
|||
CREATE TABLE t1 (a char(1) character set koi8r);
|
||||
INSERT INTO t1 VALUES (_koi8r'á'),(_koi8r'Á');
|
||||
SELECT a,'Â','â'='Â' FROM t1;
|
||||
a б 'Б'='б'
|
||||
a В 'в'='В'
|
||||
á Â 1
|
||||
Á Â 1
|
||||
show status like "Qcache_hits";
|
||||
|
@ -819,7 +819,7 @@ Variable_name Value
|
|||
Qcache_queries_in_cache 1
|
||||
set collation_connection=koi8r_bin;
|
||||
SELECT a,'Â','â'='Â' FROM t1;
|
||||
a б 'Б'='б'
|
||||
a В 'в'='В'
|
||||
á Â 0
|
||||
Á Â 0
|
||||
show status like "Qcache_hits";
|
||||
|
@ -830,7 +830,7 @@ Variable_name Value
|
|||
Qcache_queries_in_cache 2
|
||||
set character_set_client=cp1251;
|
||||
SELECT a,'Â','â'='Â' FROM t1;
|
||||
a В 'в'='В'
|
||||
a ч 'Ч'='ч'
|
||||
á ÷ 0
|
||||
Á ÷ 0
|
||||
show status like "Qcache_hits";
|
||||
|
@ -841,7 +841,7 @@ Variable_name Value
|
|||
Qcache_queries_in_cache 3
|
||||
set character_set_results=cp1251;
|
||||
SELECT a,'Â','â'='Â' FROM t1;
|
||||
a В 'в'='В'
|
||||
a В 'в'='В'
|
||||
À Â 0
|
||||
à Â 0
|
||||
show status like "Qcache_hits";
|
||||
|
|
|
@ -683,9 +683,7 @@ static void verify_prepare_field(MYSQL_RES *result,
|
|||
as utf8. Field length is calculated as number of characters * maximum
|
||||
number of bytes a character can occupy.
|
||||
*/
|
||||
#ifndef EMBEDDED_LIBRARY
|
||||
DIE_UNLESS(field->length == length * cs->mbmaxlen);
|
||||
#endif
|
||||
if (def)
|
||||
DIE_UNLESS(strcmp(field->def, def) == 0);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue