Commit 6155562c authored by V Narayanan's avatar V Narayanan

merging with mysql-5.1-bugteam.

parents 05e498ea 0c66f4a6
drop table if exists t1, ffd, fd;
CREATE TABLE t1 (armscii8_bin integer, c char(10), v varchar(20), index(c), index(v)) collate armscii8_bin engine=ibmdb2i;
CREATE TABLE t1 (armscii8_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate armscii8_general_ci engine=ibmdb2i;
CREATE TABLE t1 (ascii_bin integer, c char(10), v varchar(20), index(c), index(v)) collate ascii_bin engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (ascii_bin char(10) primary key) collate ascii_bin engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (ascii_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ascii_general_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (ascii_general_ci char(10) primary key) collate ascii_general_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (big5_bin integer, c char(10), v varchar(20), index(c), index(v)) collate big5_bin engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (big5_bin char(10) primary key) collate big5_bin engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (big5_chinese_ci integer, c char(10), v varchar(20), index(c), index(v)) collate big5_chinese_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (big5_chinese_ci char(10) primary key) collate big5_chinese_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (cp1250_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp1250_bin engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (cp1250_bin char(10) primary key) collate cp1250_bin engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (cp1250_croatian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1250_croatian_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (cp1250_croatian_ci char(10) primary key) collate cp1250_croatian_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (cp1250_czech_cs integer, c char(10), v varchar(20), index(c), index(v)) collate cp1250_czech_cs engine=ibmdb2i;
CREATE TABLE t1 (cp1250_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1250_general_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (cp1250_general_ci char(10) primary key) collate cp1250_general_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (cp1250_polish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1250_polish_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (cp1250_polish_ci char(10) primary key) collate cp1250_polish_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (cp1251_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp1251_bin engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (cp1251_bin char(10) primary key) collate cp1251_bin engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (cp1251_bulgarian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1251_bulgarian_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (cp1251_bulgarian_ci char(10) primary key) collate cp1251_bulgarian_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (cp1251_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1251_general_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (cp1251_general_ci char(10) primary key) collate cp1251_general_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (cp1251_general_cs integer, c char(10), v varchar(20), index(c), index(v)) collate cp1251_general_cs engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (cp1251_general_cs char(10) primary key) collate cp1251_general_cs engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (cp1251_ukrainian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1251_ukrainian_ci engine=ibmdb2i;
CREATE TABLE t1 (cp1256_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp1256_bin engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (cp1256_bin char(10) primary key) collate cp1256_bin engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (cp1256_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1256_general_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (cp1256_general_ci char(10) primary key) collate cp1256_general_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (cp1257_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp1257_bin engine=ibmdb2i;
CREATE TABLE t1 (cp1257_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1257_general_ci engine=ibmdb2i;
CREATE TABLE t1 (cp1257_lithuanian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp1257_lithuanian_ci engine=ibmdb2i;
CREATE TABLE t1 (cp850_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp850_bin engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (cp850_bin char(10) primary key) collate cp850_bin engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (cp850_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp850_general_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (cp850_general_ci char(10) primary key) collate cp850_general_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (cp852_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp852_bin engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (cp852_bin char(10) primary key) collate cp852_bin engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (cp852_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp852_general_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (cp852_general_ci char(10) primary key) collate cp852_general_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (cp866_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp866_bin engine=ibmdb2i;
CREATE TABLE t1 (cp866_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp866_general_ci engine=ibmdb2i;
CREATE TABLE t1 (cp932_bin integer, c char(10), v varchar(20), index(c), index(v)) collate cp932_bin engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (cp932_bin char(10) primary key) collate cp932_bin engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (cp932_japanese_ci integer, c char(10), v varchar(20), index(c), index(v)) collate cp932_japanese_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (cp932_japanese_ci char(10) primary key) collate cp932_japanese_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (dec8_bin integer, c char(10), v varchar(20), index(c), index(v)) collate dec8_bin engine=ibmdb2i;
CREATE TABLE t1 (dec8_swedish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate dec8_swedish_ci engine=ibmdb2i;
CREATE TABLE t1 (eucjpms_bin integer, c char(10), v varchar(20), index(c), index(v)) collate eucjpms_bin engine=ibmdb2i;
CREATE TABLE t1 (eucjpms_japanese_ci integer, c char(10), v varchar(20), index(c), index(v)) collate eucjpms_japanese_ci engine=ibmdb2i;
CREATE TABLE t1 (euckr_bin integer, c char(10), v varchar(20), index(c), index(v)) collate euckr_bin engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (euckr_bin char(10) primary key) collate euckr_bin engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (euckr_korean_ci integer, c char(10), v varchar(20), index(c), index(v)) collate euckr_korean_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (euckr_korean_ci char(10) primary key) collate euckr_korean_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (gb2312_bin integer, c char(10), v varchar(20), index(c), index(v)) collate gb2312_bin engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (gb2312_bin char(10) primary key) collate gb2312_bin engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (gb2312_chinese_ci integer, c char(10), v varchar(20), index(c), index(v)) collate gb2312_chinese_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (gb2312_chinese_ci char(10) primary key) collate gb2312_chinese_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (gbk_bin integer, c char(10), v varchar(20), index(c), index(v)) collate gbk_bin engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (gbk_bin char(10) primary key) collate gbk_bin engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (gbk_chinese_ci integer, c char(10), v varchar(20), index(c), index(v)) collate gbk_chinese_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (gbk_chinese_ci char(10) primary key) collate gbk_chinese_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (geostd8_bin integer, c char(10), v varchar(20), index(c), index(v)) collate geostd8_bin engine=ibmdb2i;
CREATE TABLE t1 (geostd8_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate geostd8_general_ci engine=ibmdb2i;
CREATE TABLE t1 (greek_bin integer, c char(10), v varchar(20), index(c), index(v)) collate greek_bin engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (greek_bin char(10) primary key) collate greek_bin engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (greek_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate greek_general_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (greek_general_ci char(10) primary key) collate greek_general_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (hebrew_bin integer, c char(10), v varchar(20), index(c), index(v)) collate hebrew_bin engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (hebrew_bin char(10) primary key) collate hebrew_bin engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (hebrew_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate hebrew_general_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (hebrew_general_ci char(10) primary key) collate hebrew_general_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (hp8_bin integer, c char(10), v varchar(20), index(c), index(v)) collate hp8_bin engine=ibmdb2i;
CREATE TABLE t1 (hp8_english_ci integer, c char(10), v varchar(20), index(c), index(v)) collate hp8_english_ci engine=ibmdb2i;
CREATE TABLE t1 (keybcs2_bin integer, c char(10), v varchar(20), index(c), index(v)) collate keybcs2_bin engine=ibmdb2i;
CREATE TABLE t1 (keybcs2_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate keybcs2_general_ci engine=ibmdb2i;
CREATE TABLE t1 (koi8r_bin integer, c char(10), v varchar(20), index(c), index(v)) collate koi8r_bin engine=ibmdb2i;
CREATE TABLE t1 (koi8r_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate koi8r_general_ci engine=ibmdb2i;
CREATE TABLE t1 (koi8u_bin integer, c char(10), v varchar(20), index(c), index(v)) collate koi8u_bin engine=ibmdb2i;
CREATE TABLE t1 (koi8u_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate koi8u_general_ci engine=ibmdb2i;
CREATE TABLE t1 (latin1_bin integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_bin engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (latin1_bin char(10) primary key) collate latin1_bin engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (latin1_danish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_danish_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (latin1_danish_ci char(10) primary key) collate latin1_danish_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (latin1_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_general_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (latin1_general_ci char(10) primary key) collate latin1_general_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (latin1_general_cs integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_general_cs engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (latin1_general_cs char(10) primary key) collate latin1_general_cs engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (latin1_german1_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_german1_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (latin1_german1_ci char(10) primary key) collate latin1_german1_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (latin1_german2_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_german2_ci engine=ibmdb2i;
CREATE TABLE t1 (latin1_spanish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_spanish_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (latin1_spanish_ci char(10) primary key) collate latin1_spanish_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (latin1_swedish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin1_swedish_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (latin1_swedish_ci char(10) primary key) collate latin1_swedish_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (latin2_bin integer, c char(10), v varchar(20), index(c), index(v)) collate latin2_bin engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (latin2_bin char(10) primary key) collate latin2_bin engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (latin2_croatian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin2_croatian_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (latin2_croatian_ci char(10) primary key) collate latin2_croatian_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (latin2_czech_cs integer, c char(10), v varchar(20), index(c), index(v)) collate latin2_czech_cs engine=ibmdb2i;
CREATE TABLE t1 (latin2_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin2_general_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (latin2_general_ci char(10) primary key) collate latin2_general_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (latin2_hungarian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin2_hungarian_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (latin2_hungarian_ci char(10) primary key) collate latin2_hungarian_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (latin5_bin integer, c char(10), v varchar(20), index(c), index(v)) collate latin5_bin engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (latin5_bin char(10) primary key) collate latin5_bin engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (latin5_turkish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin5_turkish_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (latin5_turkish_ci char(10) primary key) collate latin5_turkish_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (latin7_bin integer, c char(10), v varchar(20), index(c), index(v)) collate latin7_bin engine=ibmdb2i;
CREATE TABLE t1 (latin7_estonian_cs integer, c char(10), v varchar(20), index(c), index(v)) collate latin7_estonian_cs engine=ibmdb2i;
CREATE TABLE t1 (latin7_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate latin7_general_ci engine=ibmdb2i;
CREATE TABLE t1 (latin7_general_cs integer, c char(10), v varchar(20), index(c), index(v)) collate latin7_general_cs engine=ibmdb2i;
CREATE TABLE t1 (macce_bin integer, c char(10), v varchar(20), index(c), index(v)) collate macce_bin engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (macce_bin char(10) primary key) collate macce_bin engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (macce_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate macce_general_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (macce_general_ci char(10) primary key) collate macce_general_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (macroman_bin integer, c char(10), v varchar(20), index(c), index(v)) collate macroman_bin engine=ibmdb2i;
CREATE TABLE t1 (macroman_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate macroman_general_ci engine=ibmdb2i;
CREATE TABLE t1 (sjis_bin integer, c char(10), v varchar(20), index(c), index(v)) collate sjis_bin engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (sjis_bin char(10) primary key) collate sjis_bin engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (sjis_japanese_ci integer, c char(10), v varchar(20), index(c), index(v)) collate sjis_japanese_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (sjis_japanese_ci char(10) primary key) collate sjis_japanese_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (swe7_bin integer, c char(10), v varchar(20), index(c), index(v)) collate swe7_bin engine=ibmdb2i;
CREATE TABLE t1 (swe7_swedish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate swe7_swedish_ci engine=ibmdb2i;
CREATE TABLE t1 (tis620_bin integer, c char(10), v varchar(20), index(c), index(v)) collate tis620_bin engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (tis620_bin char(10) primary key) collate tis620_bin engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (tis620_thai_ci integer, c char(10), v varchar(20), index(c), index(v)) collate tis620_thai_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 11 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 23 NULL 6 Using where
drop table t1;
create table t1 (tis620_thai_ci char(10) primary key) collate tis620_thai_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (ucs2_bin integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_bin engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (ucs2_bin char(10) primary key) collate ucs2_bin engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (ucs2_czech_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_czech_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (ucs2_czech_ci char(10) primary key) collate ucs2_czech_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (ucs2_danish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_danish_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (ucs2_danish_ci char(10) primary key) collate ucs2_danish_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (ucs2_esperanto_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_esperanto_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (ucs2_esperanto_ci char(10) primary key) collate ucs2_esperanto_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (ucs2_estonian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_estonian_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (ucs2_estonian_ci char(10) primary key) collate ucs2_estonian_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (ucs2_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_general_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (ucs2_general_ci char(10) primary key) collate ucs2_general_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (ucs2_hungarian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_hungarian_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (ucs2_hungarian_ci char(10) primary key) collate ucs2_hungarian_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (ucs2_icelandic_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_icelandic_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (ucs2_icelandic_ci char(10) primary key) collate ucs2_icelandic_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (ucs2_latvian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_latvian_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (ucs2_latvian_ci char(10) primary key) collate ucs2_latvian_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (ucs2_lithuanian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_lithuanian_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (ucs2_lithuanian_ci char(10) primary key) collate ucs2_lithuanian_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (ucs2_persian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_persian_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (ucs2_persian_ci char(10) primary key) collate ucs2_persian_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (ucs2_polish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_polish_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (ucs2_polish_ci char(10) primary key) collate ucs2_polish_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (ucs2_romanian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_romanian_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (ucs2_romanian_ci char(10) primary key) collate ucs2_romanian_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (ucs2_roman_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_roman_ci engine=ibmdb2i;
CREATE TABLE t1 (ucs2_slovak_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_slovak_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (ucs2_slovak_ci char(10) primary key) collate ucs2_slovak_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (ucs2_slovenian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_slovenian_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (ucs2_slovenian_ci char(10) primary key) collate ucs2_slovenian_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (ucs2_spanish2_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_spanish2_ci engine=ibmdb2i;
CREATE TABLE t1 (ucs2_spanish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_spanish_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (ucs2_spanish_ci char(10) primary key) collate ucs2_spanish_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (ucs2_swedish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_swedish_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (ucs2_swedish_ci char(10) primary key) collate ucs2_swedish_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (ucs2_turkish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_turkish_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (ucs2_turkish_ci char(10) primary key) collate ucs2_turkish_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (ucs2_unicode_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ucs2_unicode_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 21 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 43 NULL 6 Using where
drop table t1;
create table t1 (ucs2_unicode_ci char(10) primary key) collate ucs2_unicode_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (ujis_bin integer, c char(10), v varchar(20), index(c), index(v)) collate ujis_bin engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 31 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 63 NULL 6 Using where
drop table t1;
create table t1 (ujis_bin char(10) primary key) collate ujis_bin engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (ujis_japanese_ci integer, c char(10), v varchar(20), index(c), index(v)) collate ujis_japanese_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 31 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 63 NULL 6 Using where
drop table t1;
create table t1 (ujis_japanese_ci char(10) primary key) collate ujis_japanese_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (utf8_bin integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_bin engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 31 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 63 NULL 6 Using where
drop table t1;
create table t1 (utf8_bin char(10) primary key) collate utf8_bin engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (utf8_czech_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_czech_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 31 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 63 NULL 6 Using where
drop table t1;
create table t1 (utf8_czech_ci char(10) primary key) collate utf8_czech_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (utf8_danish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_danish_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 31 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 63 NULL 6 Using where
drop table t1;
create table t1 (utf8_danish_ci char(10) primary key) collate utf8_danish_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (utf8_esperanto_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_esperanto_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 31 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 63 NULL 6 Using where
drop table t1;
create table t1 (utf8_esperanto_ci char(10) primary key) collate utf8_esperanto_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (utf8_estonian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_estonian_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 31 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 63 NULL 6 Using where
drop table t1;
create table t1 (utf8_estonian_ci char(10) primary key) collate utf8_estonian_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (utf8_general_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_general_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 31 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 63 NULL 6 Using where
drop table t1;
create table t1 (utf8_general_ci char(10) primary key) collate utf8_general_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (utf8_hungarian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_hungarian_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 31 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 63 NULL 6 Using where
drop table t1;
create table t1 (utf8_hungarian_ci char(10) primary key) collate utf8_hungarian_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (utf8_icelandic_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_icelandic_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 31 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 63 NULL 6 Using where
drop table t1;
create table t1 (utf8_icelandic_ci char(10) primary key) collate utf8_icelandic_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (utf8_latvian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_latvian_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 31 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 63 NULL 6 Using where
drop table t1;
create table t1 (utf8_latvian_ci char(10) primary key) collate utf8_latvian_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (utf8_lithuanian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_lithuanian_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 31 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 63 NULL 6 Using where
drop table t1;
create table t1 (utf8_lithuanian_ci char(10) primary key) collate utf8_lithuanian_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (utf8_persian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_persian_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 31 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 63 NULL 6 Using where
drop table t1;
create table t1 (utf8_persian_ci char(10) primary key) collate utf8_persian_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (utf8_polish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_polish_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 31 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 63 NULL 6 Using where
drop table t1;
create table t1 (utf8_polish_ci char(10) primary key) collate utf8_polish_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (utf8_romanian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_romanian_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 31 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 63 NULL 6 Using where
drop table t1;
create table t1 (utf8_romanian_ci char(10) primary key) collate utf8_romanian_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (utf8_roman_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_roman_ci engine=ibmdb2i;
CREATE TABLE t1 (utf8_slovak_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_slovak_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 31 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 63 NULL 6 Using where
drop table t1;
create table t1 (utf8_slovak_ci char(10) primary key) collate utf8_slovak_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (utf8_slovenian_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_slovenian_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 31 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 63 NULL 6 Using where
drop table t1;
create table t1 (utf8_slovenian_ci char(10) primary key) collate utf8_slovenian_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (utf8_spanish2_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_spanish2_ci engine=ibmdb2i;
CREATE TABLE t1 (utf8_spanish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_spanish_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 31 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 63 NULL 6 Using where
drop table t1;
create table t1 (utf8_spanish_ci char(10) primary key) collate utf8_spanish_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (utf8_swedish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_swedish_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 31 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 63 NULL 6 Using where
drop table t1;
create table t1 (utf8_swedish_ci char(10) primary key) collate utf8_swedish_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (utf8_turkish_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_turkish_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 31 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 63 NULL 6 Using where
drop table t1;
create table t1 (utf8_turkish_ci char(10) primary key) collate utf8_turkish_ci engine=ibmdb2i;
drop table t1;
CREATE TABLE t1 (utf8_unicode_ci integer, c char(10), v varchar(20), index(c), index(v)) collate utf8_unicode_ci engine=ibmdb2i;
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range c c 31 NULL 6 Using where
explain select c,v from t1 force index(v) where v like "de%";
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE t1 range v v 63 NULL 6 Using where
drop table t1;
create table t1 (utf8_unicode_ci char(10) primary key) collate utf8_unicode_ci engine=ibmdb2i;
drop table t1;
create table ffd (WHCHD1 CHAR(20), WHCSID decimal(5,0)) engine=ibmdb2i;
create table fd (SQSSEQ CHAR(10)) engine=ibmdb2i;
create temporary table intermed (row integer key auto_increment, cs char(30), ccsid integer);
insert into intermed (cs, ccsid) select * from ffd;
create temporary table intermed2 (row integer key auto_increment, srtseq char(10));
insert into intermed2 (srtseq) select * from fd;
select ccsid, cs, srtseq from intermed inner join intermed2 on intermed.row = intermed2.row;
ccsid cs srtseq
500 "ascii_bin" QBLA101F4U
500 "ascii_general_ci" QALA101F4S
1200 "big5_bin" QBCHT04B0U
1200 "big5_chinese_ci" QACHT04B0S
1153 "cp1250_bin" QELA20481U
1153 "cp1250_croatian_ci" QALA20481S
1153 "cp1250_general_ci" QCLA20481S
1153 "cp1250_polish_ci" QDLA20481S
1025 "cp1251_bin" QCCYR0401U
1025 "cp1251_bulgarian_ci QACYR0401S
1025 "cp1251_general_ci" QBCYR0401S
1025 "cp1251_general_cs" QBCYR0401U
420 "cp1256_bin" QBARA01A4U
420 "cp1256_general_ci" QAARA01A4S
500 "cp850_bin" QDLA101F4U
500 "cp850_general_ci" QCLA101F4S
870 "cp852_bin" QBLA20366U
870 "cp852_general_ci" QALA20366S
1200 "cp932_bin" QBJPN04B0U
1200 "cp932_japanese_ci" QAJPN04B0S
1200 "euckr_bin" QBKOR04B0U
1200 "euckr_korean_ci" QAKOR04B0S
1200 "gb2312_bin" QBCHS04B0U
1200 "gb2312_chinese_ci" QACHS04B0S
1200 "gbk_bin" QDCHS04B0U
1200 "gbk_chinese_ci" QCCHS04B0S
875 "greek_bin" QBELL036BU
875 "greek_general_ci" QAELL036BS
424 "hebrew_bin" QBHEB01A8U
424 "hebrew_general_ci" QAHEB01A8S
1148 "latin1_bin" QFLA1047CU
1148 "latin1_danish_ci" QALA1047CS
1148 "latin1_general_ci" QBLA1047CS
1148 "latin1_general_cs" QBLA1047CU
1148 "latin1_german1_ci" QCLA1047CS
1148 "latin1_spanish_ci" QDLA1047CS
1148 "latin1_swedish_ci" QELA1047CS
870 "latin2_bin" QGLA20366U
870 "latin2_croatian_ci" QCLA20366S
870 "latin2_general_ci" QELA20366S
870 "latin2_hungarian_ci QFLA20366S
1026 "latin5_bin" QBTRK0402U
1026 "latin5_turkish_ci" QATRK0402S
870 "macce_bin" QILA20366U
870 "macce_general_ci" QHLA20366S
1200 "sjis_bin" QDJPN04B0U
1200 "sjis_japanese_ci" QCJPN04B0S
838 "tis620_bin" QBTHA0346U
838 "tis620_thai_ci" QATHA0346S
13488 "ucs2_bin" *HEX
13488 "ucs2_czech_ci" I34ACS_CZ
13488 "ucs2_danish_ci" I34ADA_DK
13488 "ucs2_esperanto_ci" I34AEO
13488 "ucs2_estonian_ci" I34AET
13488 "ucs2_general_ci" QAUCS04B0S
13488 "ucs2_hungarian_ci" I34AHU
13488 "ucs2_icelandic_ci" I34AIS
13488 "ucs2_latvian_ci" I34ALV
13488 "ucs2_lithuanian_ci" I34ALT
13488 "ucs2_persian_ci" I34AFA
13488 "ucs2_polish_ci" I34APL
13488 "ucs2_romanian_ci" I34ARO
13488 "ucs2_slovak_ci" I34ASK
13488 "ucs2_slovenian_ci" I34ASL
13488 "ucs2_spanish_ci" I34AES
13488 "ucs2_swedish_ci" I34ASW
13488 "ucs2_turkish_ci" I34ATR
13488 "ucs2_unicode_ci" I34AEN
1200 "ujis_bin" QFJPN04B0U
1200 "ujis_japanese_ci" QEJPN04B0S
1208 "utf8_bin" *HEX
1208 "utf8_czech_ci" I34ACS_CZ
1208 "utf8_danish_ci" I34ADA_DK
1208 "utf8_esperanto_ci" I34AEO
1208 "utf8_estonian_ci" I34AET
1200 "utf8_general_ci" QAUCS04B0S
1208 "utf8_hungarian_ci" I34AHU
1208 "utf8_icelandic_ci" I34AIS
1208 "utf8_latvian_ci" I34ALV
1208 "utf8_lithuanian_ci" I34ALT
1208 "utf8_persian_ci" I34AFA
1208 "utf8_polish_ci" I34APL
1208 "utf8_romanian_ci" I34ARO
1208 "utf8_slovak_ci" I34ASK
1208 "utf8_slovenian_ci" I34ASL
1208 "utf8_spanish_ci" I34AES
1208 "utf8_swedish_ci" I34ASW
1208 "utf8_turkish_ci" I34ATR
1208 "utf8_unicode_ci" I34AEN
drop table ffd, fd;
source suite/ibmdb2i/include/have_ibmdb2i.inc;
source suite/ibmdb2i/include/have_i61.inc;
--disable_warnings
drop table if exists t1, ffd, fd;
--enable_warnings
--disable_abort_on_error
--error 0,255
exec system "DLTF QGPL/FFDOUT" > /dev/null;
--error 0,255
exec system "DLTF QGPL/FDOUT" > /dev/null;
--enable_abort_on_error
let $count= query_get_value(select count(*) from information_schema.COLLATIONS where COLLATION_NAME <> "binary", count(*),1);
while ($count)
{
let $collation = query_get_value(select COLLATION_NAME from information_schema.COLLATIONS where COLLATION_NAME <> "binary" order by COLLATION_NAME desc, COLLATION_NAME, $count);
error 0,1005,2504,2028;
eval CREATE TABLE t1 ($collation integer, c char(10), v varchar(20), index(c), index(v)) collate $collation engine=ibmdb2i;
if (!$mysql_errno)
{
insert into t1 (c,v) values ("abc","def"),("abcd", "def"),("abcde","defg"),("aaaa","bbbb");
insert into t1 select * from t1;
explain select c,v from t1 force index(c) where c like "ab%";
explain select c,v from t1 force index(v) where v like "de%";
drop table t1;
eval create table t1 ($collation char(10) primary key) collate $collation engine=ibmdb2i;
system system "DSPFFD FILE(\"test\"/\"t1\") OUTPUT(*OUTFILE) OUTFILE(QGPL/FFDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
system system "DSPFD FILE(\"test\"/\"t1\") TYPE(*SEQ) OUTPUT(*OUTFILE) OUTFILE(QGPL/FDOUT) OUTMBR(*FIRST *ADD)" > /dev/null;
drop table t1;
}
dec $count;
}
create table ffd (WHCHD1 CHAR(20), WHCSID decimal(5,0)) engine=ibmdb2i;
system system "CPYF FROMFILE(QGPL/FFDOUT) TOFILE(\"test\"/\"ffd\") mbropt(*replace) fmtopt(*drop *map)" > /dev/null;
create table fd (SQSSEQ CHAR(10)) engine=ibmdb2i;
system system "CPYF FROMFILE(QGPL/FDOUT) TOFILE(\"test\"/\"fd\") mbropt(*replace) fmtopt(*drop *map)" > /dev/null;
create temporary table intermed (row integer key auto_increment, cs char(30), ccsid integer);
insert into intermed (cs, ccsid) select * from ffd;
create temporary table intermed2 (row integer key auto_increment, srtseq char(10));
insert into intermed2 (srtseq) select * from fd;
select ccsid, cs, srtseq from intermed inner join intermed2 on intermed.row = intermed2.row;
drop table ffd, fd;
......@@ -137,7 +137,9 @@ int ha_ibmdb2i::convertFieldChars(enum_conversionDirection direction,
char* output,
size_t ilen,
size_t olen,
size_t* outDataLen)
size_t* outDataLen,
bool tacitErrors,
size_t* substChars)
{
DBUG_PRINT("ha_ibmdb2i::convertFieldChars",("Direction: %d; length = %d", direction, ilen));
......@@ -157,26 +159,26 @@ int ha_ibmdb2i::convertFieldChars(enum_conversionDirection direction,
size_t initOLen= olen;
size_t substitutedChars = 0;
int rc = iconv(conversion, (char**)&input, &ilen, &output, &olen, &substitutedChars );
if (outDataLen) *outDataLen = initOLen - olen;
if (substChars) *substChars = substitutedChars;
if (unlikely(rc < 0))
{
int er = errno;
if (er == EILSEQ)
{
getErrTxt(DB2I_ERR_ILL_CHAR, table->field[fieldID]->field_name);
if (!tacitErrors) getErrTxt(DB2I_ERR_ILL_CHAR, table->field[fieldID]->field_name);
return (DB2I_ERR_ILL_CHAR);
}
else
{
getErrTxt(DB2I_ERR_ICONV,er);
if (!tacitErrors) getErrTxt(DB2I_ERR_ICONV,er);
return (DB2I_ERR_ICONV);
}
}
if (unlikely(substitutedChars))
if (unlikely(substitutedChars) && (!tacitErrors))
{
warning(ha_thd(), DB2I_ERR_SUB_CHARS, table->field[fieldID]->field_name);
}
if (outDataLen) *outDataLen = initOLen - olen;
return (0);
}
......@@ -555,12 +557,12 @@ int ha_ibmdb2i::getFieldTypeMapping(Field* field,
return 1;
if (fieldCharSet->mbmaxlen > 1)
{
if (strncmp(fieldCharSet->name, "ucs2_", sizeof("ucs2_")) == 0 ) // UCS2
if (memcmp(fieldCharSet->name, "ucs2_", sizeof("ucs2_")-1) == 0 ) // UCS2
{
sprintf(stringBuildBuffer, "GRAPHIC(%d)", max(fieldLength / fieldCharSet->mbmaxlen, 1)); // Number of characters
db2Ccsid = 13488;
}
else if (strncmp(fieldCharSet->name, "utf8_", sizeof("utf8_")) == 0 &&
else if (memcmp(fieldCharSet->name, "utf8_", sizeof("utf8_")-1) == 0 &&
strcmp(fieldCharSet->name, "utf8_general_ci") != 0)
{
sprintf(stringBuildBuffer, "CHAR(%d)", max(fieldLength, 1)); // Number of bytes
......@@ -584,12 +586,12 @@ int ha_ibmdb2i::getFieldTypeMapping(Field* field,
{
if (fieldCharSet->mbmaxlen > 1)
{
if (strncmp(fieldCharSet->name, "ucs2_", sizeof("ucs2_")) == 0 ) // UCS2
if (memcmp(fieldCharSet->name, "ucs2_", sizeof("ucs2_")-1) == 0 ) // UCS2
{
sprintf(stringBuildBuffer, "VARGRAPHIC(%d)", max(fieldLength / fieldCharSet->mbmaxlen, 1)); // Number of characters
db2Ccsid = 13488;
}
else if (strncmp(fieldCharSet->name, "utf8_", sizeof("utf8_")) == 0 &&
else if (memcmp(fieldCharSet->name, "utf8_", sizeof("utf8_")-1) == 0 &&
strcmp(fieldCharSet->name, "utf8_general_ci") != 0)
{
sprintf(stringBuildBuffer, "VARCHAR(%d)", max(fieldLength, 1)); // Number of bytes
......@@ -611,12 +613,12 @@ int ha_ibmdb2i::getFieldTypeMapping(Field* field,
{
if (fieldCharSet->mbmaxlen > 1)
{
if (strncmp(fieldCharSet->name, "ucs2_", sizeof("ucs2_")) == 0 ) // UCS2
if (memcmp(fieldCharSet->name, "ucs2_", sizeof("ucs2_")-1) == 0 ) // UCS2
{
sprintf(stringBuildBuffer, "LONG VARGRAPHIC ");
db2Ccsid = 13488;
}
else if (strncmp(fieldCharSet->name, "utf8_", sizeof("utf8_")) == 0 &&
else if (memcmp(fieldCharSet->name, "utf8_", sizeof("utf8_")-1) == 0 &&
strcmp(fieldCharSet->name, "utf8_general_ci") != 0)
{
sprintf(stringBuildBuffer, "LONG VARCHAR ");
......@@ -639,12 +641,12 @@ int ha_ibmdb2i::getFieldTypeMapping(Field* field,
if (fieldCharSet->mbmaxlen > 1)
{
if (strncmp(fieldCharSet->name, "ucs2_", sizeof("ucs2_")) == 0 ) // UCS2
if (memcmp(fieldCharSet->name, "ucs2_", sizeof("ucs2_")-1) == 0 ) // UCS2
{
sprintf(stringBuildBuffer, "DBCLOB(%d)", max(fieldLength / fieldCharSet->mbmaxlen, 1)); // Number of characters
db2Ccsid = 13488;
}
else if (strncmp(fieldCharSet->name, "utf8_", sizeof("utf8_")) == 0 &&
else if (memcmp(fieldCharSet->name, "utf8_", sizeof("utf8_")-1) == 0 &&
strcmp(fieldCharSet->name, "utf8_general_ci") != 0)
{
sprintf(stringBuildBuffer, "CLOB(%d)", max(fieldLength, 1)); // Number of bytes
......@@ -671,11 +673,15 @@ int ha_ibmdb2i::getFieldTypeMapping(Field* field,
return rtnCode;
}
// Check whether there is a character conversion available.
iconv_t temp;
int32 rc = getConversion(toDB2, fieldCharSet, db2Ccsid, temp);
if (unlikely(rc))
return rc;
if (db2Ccsid != 1208 &&
db2Ccsid != 13488)
{
// Check whether there is a character conversion available.
iconv_t temp;
int32 rc = getConversion(toDB2, fieldCharSet, db2Ccsid, temp);
if (unlikely(rc))
return rc;
}
sprintf(stringBuildBuffer, " CCSID %d ", db2Ccsid);
mapping.append(stringBuildBuffer);
......
......@@ -220,6 +220,7 @@ INTERN size_t myconv_dmap(myconv_t cd,
} else {
*pOut=dmapS2S[*pIn];
if (*pOut == 0x00) {
errno=EILSEQ; /* 116 */
*outBytesLeft-=(*inBytesLeft-inLen);
*inBytesLeft=inLen;
*outBuf=pOut;
......
......@@ -51,7 +51,6 @@ static inline int getKeyCntFromMap(key_part_map keypart_map)
return (cnt);
}
/**
@brief
Given a starting key and an ending key, estimate the number of rows that
......@@ -270,81 +269,163 @@ ha_rows ha_ibmdb2i::records_in_range(uint inx,
DB2Field& db2Field = db2Table->db2Field(field->field_index);
litDefPtr->DataType = db2Field.getType();
/*
Convert the literal to DB2 format.
*/
rc = convertMySQLtoDB2(field,
db2Field,
literalPtr,
(uchar*)minPtr+((curKey.key_part[partsInUse].null_bit)? 1 : 0));
if (rc != 0) break;
litDefPtr->Offset = (uint32_t)(literalPtr - literalsPtr);
litDefPtr->Length = db2Field.getByteLengthInRecord();
tempLen = litDefPtr->Length;
/*
Do additional conversion of a character or graphic value.
*/
CHARSET_INFO* fieldCharSet = field->charset();
Convert the literal to DB2 format
*/
if ((field->type() != MYSQL_TYPE_BIT) && // Don't do conversion on BIT data
(field->charset() != &my_charset_bin) && // Don't do conversion on BINARY data
(litDefPtr->DataType == QMY_CHAR || litDefPtr->DataType == QMY_VARCHAR ||
litDefPtr->DataType == QMY_GRAPHIC || litDefPtr->DataType == QMY_VARGRAPHIC))
(litDefPtr->DataType == QMY_CHAR ||
litDefPtr->DataType == QMY_VARCHAR ||
litDefPtr->DataType == QMY_GRAPHIC ||
litDefPtr->DataType == QMY_VARGRAPHIC))
{
if (litDefPtr->DataType == QMY_VARCHAR ||
litDefPtr->DataType == QMY_VARGRAPHIC)
tempPtr = literalPtr + sizeof(uint16);
else
tempPtr = literalPtr;
/* The following code checks to determine if MySQL is passing a
partial key. DB2 will accept a partial field value, but only
in the last field position of the key composite (and only if
there is no ICU sort sequence on the index). */
tempMinPtr = (char*)minPtr+((curKey.key_part[partsInUse].null_bit)? 1 : 0);
if (field->type() == MYSQL_TYPE_VARCHAR)
{
/* MySQL always stores key lengths as 2 bytes, little-endian. */
tempLen = *(uint8*)tempMinPtr + ((*(uint8*)(tempMinPtr+1)) << 8);
tempMinPtr = (char*)((char*)tempMinPtr + 2);
}
else
tempLen = field->field_length;
/* Determine if we are dealing with a partial key and if so, find the end of the partial key. */
if (litDefPtr->DataType == QMY_CHAR || litDefPtr->DataType == QMY_VARCHAR )
{ /* Char or varchar. If UTF8, no conversion is done to DB2 graphic.) */
endOfMinPtr = (char*)memchr(tempMinPtr,field->charset()->min_sort_char,tempLen);
if (endOfMinPtr)
endOfLiteralPtr = tempPtr + ((uint32_t)(endOfMinPtr - tempMinPtr));
}
else
{
if (strncmp(fieldCharSet->csname, "utf8", sizeof("utf8")) == 0)
{ /* The MySQL charset is UTF8 but we are converting to graphic on DB2. Divide number of UTF8 bytes
by 3 to get the number of characters, then multiple by 2 for double-byte graphic.*/
endOfMinPtr = (char*)memchr(tempMinPtr,field->charset()->min_sort_char,tempLen);
if (endOfMinPtr)
endOfLiteralPtr = tempPtr + (((uint32_t)((endOfMinPtr - tempMinPtr)) / 3) * 2);
}
else
{ /* The DB2 data type is graphic or vargraphic, and we are not converting from UTF8 to graphic. */
endOfMinPtr = (char*)wmemchr((wchar_t*)tempMinPtr,field->charset()->min_sort_char,tempLen/2);
if (endOfMinPtr)
endOfLiteralPtr = tempPtr + (endOfMinPtr - tempMinPtr);
// Most of the code is required by the considerable wrangling needed
// to prepare partial keys for use by DB2
// 1. UTF8 (CCSID 1208) data can be copied across unmodified if it is
// utf8_bin. Otherwise, we need to convert the min and max
// characters into the min and max characters employed
// by the DB2 sort sequence. This is complicated by the fact that
// the character widths are not always equal.
// 2. Likewise, UCS2 (CCSID 13488) data can be copied across unmodified
// if it is ucs2_bin or ucs2_general_ci. Otherwise, we need to
// convert the min and max characters into the min and max characters
// employed by the DB2 sort sequence.
// 3. All other data will use standard iconv conversions. If an
// unconvertible character is encountered, we assume it is the min
// char and fill the remainder of the DB2 key with 0s. This may not
// always be accurate, but it is probably sufficient for range
// estimations.
const char* keyData = minPtr+((curKey.key_part[partsInUse].null_bit)? 1 : 0);
char* db2Data = literalPtr;
uint16 outLen = db2Field.getByteLengthInRecord();
uint16 inLen;
if (litDefPtr->DataType == QMY_VARCHAR ||
litDefPtr->DataType == QMY_VARGRAPHIC)
{
inLen = *(uint8*)keyData + ((*(uint8*)(keyData+1)) << 8);
keyData += 2;
outLen -= sizeof(uint16);
db2Data += sizeof(uint16);
}
else
{
inLen = field->max_display_length();
}
size_t convertedBytes = 0;
if (db2Field.getCCSID() == 1208)
{
DBUG_ASSERT(inLen <= outLen);
if (strcmp(field->charset()->name, "utf8_bin"))
{
const char* end = keyData+inLen;
const char* curKey = keyData;
char* curDB2 = db2Data;
uint32 min = field->charset()->min_sort_char;
while ((curKey < end) && (curDB2 < db2Data+outLen-3))
{
my_wc_t temp;
int len = field->charset()->cset->mb_wc(field->charset(),
&temp,
(const uchar*)curKey,
(const uchar*)end);
if (temp != min)
{
DBUG_ASSERT(len <= 3);
switch (len)
{
case 3: *(curDB2+2) = *(curKey+2);
case 2: *(curDB2+1) = *(curKey+1);
case 1: *(curDB2) = *(curKey);
}
curDB2 += len;
}
else
{
*(curDB2++) = 0xEF;
*(curDB2++) = 0xBF;
*(curDB2++) = 0xBF;
}
curKey += len;
}
convertedBytes = curDB2 - db2Data;
}
else
{
memcpy(db2Data, keyData, inLen);
convertedBytes = inLen;
}
rc = 0;
}
else if (db2Field.getCCSID() == 13488)
{
DBUG_ASSERT(inLen <= outLen);
if (strcmp(field->charset()->name, "ucs2_bin") &&
strcmp(field->charset()->name, "ucs2_general_ci"))
{
const char* end = keyData+inLen;
const uint16* curKey = (uint16*)keyData;
uint16* curDB2 = (uint16*)db2Data;
uint16 min = field->charset()->min_sort_char;
while (curKey < (uint16*)end)
{
if (*curKey != min)
*curDB2 = *curKey;
else
*curDB2 = 0xFFFF;
++curKey;
++curDB2;
}
}
/* Enforce here that a partial is only allowed on the last field position
of the key composite */
if (endOfLiteralPtr)
{
if ((partsInUse + 1) < minKeyCnt)
{
rc = HA_POS_ERROR;
break;
}
endByte = endOfLiteralPtr - tempPtr;
/* We're making an assumption that if MySQL gives us a partial key,
the length of the partial is the same for both the min_key and max_key. */
}
}
else
{
memcpy(db2Data, keyData, inLen);
}
convertedBytes = inLen;
rc = 0;
}
else
{
rc = convertFieldChars(toDB2,
field->field_index,
keyData,
db2Data,
inLen,
outLen,
&convertedBytes,
true);
if (rc == DB2I_ERR_ILL_CHAR)
{
// If an illegal character is encountered, we fill the remainder
// of the key with 0x00. This was implemented as a corollary to
// Bug#45012, though it should probably remain even after that
// bug is fixed.
memset(db2Data+convertedBytes, 0x00, outLen-convertedBytes);
convertedBytes = outLen;
rc = 0;
}
}
if (!rc &&
(litDefPtr->DataType == QMY_VARGRAPHIC ||
litDefPtr->DataType == QMY_VARCHAR))
{
*(uint16*)(db2Data-sizeof(uint16)) =
convertedBytes / (litDefPtr->DataType == QMY_VARGRAPHIC ? 2 : 1);
}
}
else // Non-character fields
{
rc = convertMySQLtoDB2(field,
db2Field,
literalPtr,
(uchar*)minPtr+((curKey.key_part[partsInUse].null_bit)? 1 : 0));
}
if (rc != 0) break;
litDefPtr->Offset = (uint32_t)(literalPtr - literalsPtr);
litDefPtr->Length = db2Field.getByteLengthInRecord();
literalPtr = literalPtr + litDefPtr->Length; // Bump pointer for next literal
}
/* If there is a max_key value for this field, and if the max_key value is
......@@ -389,28 +470,168 @@ ha_rows ha_ibmdb2i::records_in_range(uint inx,
/*
Convert the literal to DB2 format
*/
rc = convertMySQLtoDB2(field,
db2Field,
literalPtr,
(uchar*)maxPtr+((curKey.key_part[partsInUse].null_bit)? 1 : 0));
if ((field->type() != MYSQL_TYPE_BIT) && // Don't do conversion on BIT data
(field->charset() != &my_charset_bin) && // Don't do conversion on BINARY data
(litDefPtr->DataType == QMY_CHAR ||
litDefPtr->DataType == QMY_VARCHAR ||
litDefPtr->DataType == QMY_GRAPHIC ||
litDefPtr->DataType == QMY_VARGRAPHIC))
{
// We need to handle char fields in a special way in order to account
// for partial keys. Refer to the note above for a description of the
// basic design.
char* keyData = maxPtr+((curKey.key_part[partsInUse].null_bit)? 1 : 0);
char* db2Data = literalPtr;
uint16 outLen = db2Field.getByteLengthInRecord();
uint16 inLen;
if (litDefPtr->DataType == QMY_VARCHAR ||
litDefPtr->DataType == QMY_VARGRAPHIC)
{
inLen = *(uint8*)keyData + ((*(uint8*)(keyData+1)) << 8);
keyData += 2;
outLen -= sizeof(uint16);
db2Data += sizeof(uint16);
}
else
{
inLen = field->max_display_length();
}
size_t convertedBytes;
if (db2Field.getCCSID() == 1208)
{
if (strcmp(field->charset()->name, "utf8_bin"))
{
const char* end = keyData+inLen;
const char* curKey = keyData;
char* curDB2 = db2Data;
uint32 max = field->charset()->max_sort_char;
while (curKey < end && (curDB2 < db2Data+outLen-3))
{
my_wc_t temp;
int len = field->charset()->cset->mb_wc(field->charset(), &temp, (const uchar*)curKey, (const uchar*)end);
if (temp != max)
{
DBUG_ASSERT(len <= 3);
switch (len)
{
case 3: *(curDB2+2) = *(curKey+2);
case 2: *(curDB2+1) = *(curKey+1);
case 1: *(curDB2) = *(curKey);
}
curDB2 += len;
}
else
{
*(curDB2++) = 0xE4;
*(curDB2++) = 0xB6;
*(curDB2++) = 0xBF;
}
curKey += len;
}
convertedBytes = curDB2 - db2Data;
}
else
{
DBUG_ASSERT(inLen <= outLen);
memcpy(db2Data, keyData, inLen);
convertedBytes = inLen;
}
rc = 0;
}
else if (db2Field.getCCSID() == 13488)
{
if (strcmp(field->charset()->name, "ucs2_bin") &&
strcmp(field->charset()->name, "ucs2_general_ci"))
{
char* end = keyData+inLen;
uint16* curKey = (uint16*)keyData;
uint16* curDB2 = (uint16*)db2Data;
uint16 max = field->charset()->max_sort_char;
while (curKey < (uint16*)end)
{
if (*curKey != max)
*curDB2 = *curKey;
else
*curDB2 = 0x4DBF;
++curKey;
++curDB2;
}
}
else
{
memcpy(db2Data, keyData, outLen);
}
rc = 0;
}
else
{
size_t substituteChars = 0;
rc = convertFieldChars(toDB2,
field->field_index,
keyData,
db2Data,
inLen,
outLen,
&convertedBytes,
true,
&substituteChars);
if (rc == DB2I_ERR_ILL_CHAR)
{
// If an illegal character is encountered, we fill the remainder
// of the key with 0xFF. This was implemented to work around
// Bug#45012, though it should probably remain even after that
// bug is fixed.
memset(db2Data+convertedBytes, 0xFF, outLen-convertedBytes);
rc = 0;
}
else if ((substituteChars &&
(litDefPtr->DataType == QMY_VARCHAR ||
litDefPtr->DataType == QMY_CHAR)) ||
strcmp(field->charset()->name, "cp1251_bulgarian_ci") == 0)
{
// When iconv translates the max_sort_char with a substitute
// character, we have no way to know whether this affects
// the sort order of the key. Therefore, to be safe, when
// we know that substitute characters have been used in a
// single-byte string, we traverse the translated key
// in reverse, replacing substitue characters with 0xFF, which
// always sorts with the greatest weight in DB2 sort sequences.
// cp1251_bulgarian_ci is also handled this way because the
// max_sort_char is a control character which does not sort
// equivalently in DB2.
DBUG_ASSERT(inLen == outLen);
char* tmpKey = keyData + inLen - 1;
char* tmpDB2 = db2Data + outLen - 1;
while (*tmpKey == field->charset()->max_sort_char &&
*tmpDB2 != 0xFF)
{
*tmpDB2 = 0xFF;
--tmpKey;
--tmpDB2;
}
}
}
if (!rc &&
(litDefPtr->DataType == QMY_VARGRAPHIC ||
litDefPtr->DataType == QMY_VARCHAR))
{
*(uint16*)(db2Data-sizeof(uint16)) =
outLen / (litDefPtr->DataType == QMY_VARGRAPHIC ? 2 : 1);
}
}
else
{
rc = convertMySQLtoDB2(field,
db2Field,
literalPtr,
(uchar*)maxPtr+((curKey.key_part[partsInUse].null_bit)? 1 : 0));
}
if (rc != 0) break;
litDefPtr->Offset = (uint32_t)(literalPtr - literalsPtr);
litDefPtr->Length = db2Field.getByteLengthInRecord();
tempLen = litDefPtr->Length;
/*
Now convert a character or graphic value.
*/
if ((field->type() != MYSQL_TYPE_BIT) &&
(litDefPtr->DataType == QMY_CHAR || litDefPtr->DataType == QMY_VARCHAR ||
litDefPtr->DataType == QMY_GRAPHIC || litDefPtr->DataType == QMY_VARGRAPHIC))
{
if (litDefPtr->DataType == QMY_VARCHAR || litDefPtr->DataType == QMY_VARGRAPHIC)
{
tempPtr = literalPtr + sizeof(uint16);
}
else
tempPtr = literalPtr;
}
literalPtr = literalPtr + litDefPtr->Length; // Bump pointer for next literal
}
boundsPtr->HiBound.Position = literalCnt;
......
......@@ -383,7 +383,15 @@ private:
int32 prepareWriteBufferForLobs();
uint32 adjustLobBuffersForRead();
bool lobFieldsRequested();
int convertFieldChars(enum_conversionDirection direction, uint16 fieldID, const char* input, char* output, size_t ilen, size_t olen, size_t* outDataLen);
int convertFieldChars(enum_conversionDirection direction,
uint16 fieldID,
const char* input,
char* output,
size_t ilen,
size_t olen,
size_t* outDataLen,
bool tacitErrors=FALSE,
size_t* substChars=NULL);
/**
Fast integer log2 function
......
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