~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

Viewing changes to mysql-test/include/ctype_common.inc

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#
 
2
# Common tests for all character sets and collations.
 
3
# Include this file from a test with @test_characrer_set
 
4
# and @test_collation set to desired values.
 
5
#
 
6
# Please don't use SHOW CREATE TABLE in this file,
 
7
# we want it to be HANDLER independent. You can
 
8
# use SHOW FULL COLUMNS instead.
 
9
#
 
10
# Please surround all CREATE TABLE with --disable_warnings
 
11
# and --enable_warnings to be able to set storage_engine
 
12
# without having to check if the hanlder exists.
 
13
 
 
14
SET @safe_character_set_server= @@character_set_server;
 
15
SET @safe_collation_server= @@collation_server;
 
16
SET @safe_character_set_client= @@character_set_client;
 
17
SET @safe_character_set_results= @@character_set_results;
 
18
SET character_set_server= @test_character_set;
 
19
SET collation_server= @test_collation;
 
20
CREATE DATABASE d1;
 
21
USE d1;
 
22
 
 
23
#
 
24
# Bug 1883: LIKE did not work in some cases with a key.
 
25
#
 
26
--disable_warnings
 
27
CREATE TABLE t1 (c CHAR(10), KEY(c));
 
28
--enable_warnings
 
29
# check the column was created with the expected charset/collation
 
30
--replace_result select,insert,update,references ""
 
31
SHOW FULL COLUMNS FROM t1;
 
32
INSERT INTO t1 VALUES ('aaa'),('aaaa'),('aaaaa');
 
33
SELECT c as want3results FROM t1 WHERE c LIKE 'aaa%';
 
34
DROP TABLE t1;
 
35
 
 
36
#
 
37
# Bug 6643 incorrect response with partial utf8 index
 
38
#
 
39
--disable_warnings
 
40
CREATE TABLE t1 (c1 varchar(15), KEY c1 (c1(2)));
 
41
--enable_warnings
 
42
# check the column was created with the expected charset/collation
 
43
--replace_result select,insert,update,references ""
 
44
SHOW FULL COLUMNS FROM t1;
 
45
INSERT INTO t1 VALUES ('location'),('loberge'),('lotre'),('boabab');
 
46
SELECT c1 as want3results from t1 where c1 like 'l%';
 
47
SELECT c1 as want3results from t1 where c1 like 'lo%';
 
48
SELECT c1 as want1result  from t1 where c1 like 'loc%';
 
49
SELECT c1 as want1result  from t1 where c1 like 'loca%';
 
50
SELECT c1 as want1result  from t1 where c1 like 'locat%';
 
51
SELECT c1 as want1result  from t1 where c1 like 'locati%';
 
52
SELECT c1 as want1result  from t1 where c1 like 'locatio%';
 
53
SELECT c1 as want1result  from t1 where c1 like 'location%';
 
54
DROP TABLE t1;
 
55
 
 
56
#
 
57
# Bug #31070: crash during conversion of charsets
 
58
# Bug #32726: crash with cast in order by clause and cp932 charset
 
59
#
 
60
create table t1 (a set('a') not null);
 
61
insert into t1 values (),();
 
62
select cast(a as char(1)) from t1;
 
63
select a sounds like a from t1;
 
64
select 1 from t1 order by cast(a as char(1));
 
65
drop table t1;
 
66
 
 
67
#
 
68
# Bug#27580 SPACE() function collation bug?
 
69
#
 
70
set names utf8;
 
71
create table t1 (
 
72
  name varchar(10),
 
73
  level smallint unsigned);
 
74
show create table t1;
 
75
insert into t1 values ('string',1);
 
76
select concat(name,space(level)), concat(name, repeat(' ',level)) from t1;
 
77
drop table t1;
 
78
 
 
79
DROP DATABASE d1;
 
80
# Restore settings
 
81
USE test;
 
82
SET character_set_server= @safe_character_set_server;
 
83
SET collation_server= @safe_collation_server;
 
84
SET character_set_client= @safe_character_set_client;
 
85
SET character_set_results= @safe_character_set_results;