Debian Codegraph @

mysql-test/suite/x/t/fieldtypes_all.test

raw
1 ## generated
2 ## Test resultset types
3
4 ## Preamble
5 --source include/xplugin_preamble.inc
6 --source include/xplugin_create_user.inc
7 ## Test starts here
8 --write_file $MYSQL_TMP_DIR/select_field_integer.xpl
9
10 -->sql
11 create schema xtest;
12 use xtest;
13
14 #
15 # INTEGER TYPES
16 #
17
18 CREATE TABLE t_tinyint (c1 TINYINT, c2 TINYINT UNSIGNED);
19 INSERT INTO t_tinyint VALUES (-128, 0);
20 INSERT INTO t_tinyint VALUES (-1, 1);
21 INSERT INTO t_tinyint VALUES (0, 127);
22 INSERT INTO t_tinyint VALUES (1, 200);
23 INSERT INTO t_tinyint VALUES (127, 255);
24
25 CREATE TABLE t_smallint (c1 SMALLINT, c2 SMALLINT UNSIGNED);
26 INSERT INTO t_smallint VALUES (-32768, 0);
27 INSERT INTO t_smallint VALUES (-1, 1);
28 INSERT INTO t_smallint VALUES (0, 32767);
29 INSERT INTO t_smallint VALUES (1, 65534);
30 INSERT INTO t_smallint VALUES (32767, 65535);
31
32 CREATE TABLE t_mediumint (c1 MEDIUMINT, c2 MEDIUMINT UNSIGNED);
33 INSERT INTO t_mediumint VALUES (-8388608, 0);
34 INSERT INTO t_mediumint VALUES (-1, 1);
35 INSERT INTO t_mediumint VALUES (0, 8388607);
36 INSERT INTO t_mediumint VALUES (1, 16777214);
37 INSERT INTO t_mediumint VALUES (8388607, 16777215);
38
39 CREATE TABLE t_int (c1 INT, c2 INT UNSIGNED);
40 INSERT INTO t_int VALUES (-2147483648, 0);
41 INSERT INTO t_int VALUES (-1, 1);
42 INSERT INTO t_int VALUES (0, 2147483647);
43 INSERT INTO t_int VALUES (1, 4294967294);
44 INSERT INTO t_int VALUES (2147483647, 4294967295);
45
46 CREATE TABLE t_integer (c1 INTEGER, c2 INTEGER UNSIGNED);
47 INSERT INTO t_integer VALUES (-2147483648, 0);
48 INSERT INTO t_integer VALUES (-1, 1);
49 INSERT INTO t_integer VALUES (0, 2147483647);
50 INSERT INTO t_integer VALUES (1, 4294967294);
51 INSERT INTO t_integer VALUES (2147483647, 4294967295);
52
53 CREATE TABLE t_bigint (c1 BIGINT, c2 BIGINT UNSIGNED);
54 INSERT INTO t_bigint VALUES (-9223372036854775808, 0);
55 INSERT INTO t_bigint VALUES (-1, 1);
56 INSERT INTO t_bigint VALUES (0, 9223372036854775807);
57 INSERT INTO t_bigint VALUES (1, 18446744073709551614);
58 INSERT INTO t_bigint VALUES (9223372036854775807, 18446744073709551615);
59
60 SELECT * FROM t_tinyint;
61 SELECT * FROM t_smallint;
62 SELECT * FROM t_mediumint;
63 SELECT * FROM t_int;
64 SELECT * FROM t_bigint;
65
66
67 #
68 # FIXED POINT TYPES
69 #
70
71 CREATE TABLE t_decimal1 (c1 DECIMAL(2,1), c2 DECIMAL(2,1) UNSIGNED);
72 INSERT INTO t_decimal1 VALUES (-1.1, 0.0);
73 INSERT INTO t_decimal1 VALUES (-9.9, 9.8);
74 INSERT INTO t_decimal1 VALUES (9.9, 9.9);
75
76 CREATE TABLE t_decimal2 (c1 DECIMAL(64,30), c2 DECIMAL(64,30) UNSIGNED);
77 INSERT INTO t_decimal2 VALUES (-1234567890123456789012345678901234.567890123456789012345678901234, 1234567890123456789012345678901234.567890123456789012345678901234);
78 INSERT INTO t_decimal2 VALUES (9234567890123456789012345678901234.567890123456789012345678901234, 9234567890123456789012345678901234.567890123456789012345678901234);
79 INSERT INTO t_decimal2 VALUES (0, 0);
80
81 CREATE TABLE t_numeric1 (c1 NUMERIC(2,1), c2 NUMERIC(2,1) UNSIGNED);
82 INSERT INTO t_numeric1 VALUES (-1.1, 0.0);
83 INSERT INTO t_numeric1 VALUES (-9.9, 9.8);
84 INSERT INTO t_numeric1 VALUES (9.9, 9.9);
85
86 CREATE TABLE t_numeric2 (c1 NUMERIC(64,30), c2 NUMERIC(64,30) UNSIGNED);
87 INSERT INTO t_numeric2 VALUES (-1234567890123456789012345678901234.567890123456789012345678901234, 1234567890123456789012345678901234.567890123456789012345678901234);
88 INSERT INTO t_numeric2 VALUES (9234567890123456789012345678901234.567890123456789012345678901234, 9234567890123456789012345678901234.567890123456789012345678901234);
89 INSERT INTO t_numeric2 VALUES (0, 0);
90
91 SELECT * FROM t_decimal1;
92 SELECT * FROM t_decimal2;
93 SELECT * FROM t_numeric1;
94 SELECT * FROM t_numeric2;
95
96
97 #
98 # FLOATING POINT TYPES
99 #
100
101 CREATE TABLE t_real (c1 REAL, c2 REAL UNSIGNED);
102 INSERT INTO t_real VALUES (-1220.001, 0);
103 INSERT INTO t_real VALUES (-1.01, 1.201);
104 INSERT INTO t_real VALUES (1235.67, 11235.67);
105
106 CREATE TABLE t_float (c1 FLOAT, c2 FLOAT UNSIGNED);
107 INSERT INTO t_float VALUES (-1220223.00221, 0.0001);
108 INSERT INTO t_float VALUES (-1.02323, 1.2333);
109 INSERT INTO t_float VALUES (123522.67, 112352.67);
110
111 CREATE TABLE t_double (c1 DOUBLE, c2 DOUBLE UNSIGNED);
112 INSERT INTO t_double VALUES (-122022323.0230221, 2320.0012301);
113 INSERT INTO t_double VALUES (-1.232023231, 1231231231.23331231);
114 INSERT INTO t_double VALUES (1235212322.6123123, 11235212312322.671);
115
116 SELECT * FROM t_real;
117 SELECT * FROM t_float;
118 SELECT * FROM t_double;
119
120 #
121 # DATE
122 #
123
124 CREATE TABLE t_date (c1 DATE, c2 TIME, c3 TIMESTAMP, c4 DATETIME, c5 DATETIME(6), c6 YEAR);
125 INSERT INTO t_date VALUES ('2015-07-23', '16:34:12', '2015-07-23 16:34:12', '2015-07-23 16:34:12', '2015-07-23 16:34:12.0001234', '2015');
126 INSERT INTO t_date VALUES ('0-1-1', '-1:0:0.12', '2000-1-1 0:0:2', '0-1-1', '0-1-1', '1999');
127
128 SELECT * FROM t_date;
129
130 #
131 # BINARY
132 #
133 CREATE TABLE t_lob (c1 TINYBLOB,
134 c2 BLOB,
135 c3 MEDIUMBLOB,
136 c4 LONGBLOB,
137 c5 TINYTEXT,
138 c6 TEXT,
139 c7 MEDIUMTEXT,
140 c8 LONGTEXT,
141 c9 TINYTEXT BINARY,
142 c10 TEXT BINARY,
143 c11 MEDIUMTEXT BINARY,
144 c12 LONGTEXT BINARY);
145
146 INSERT INTO t_lob VALUES ('','','','','','','','','','','','');
147 INSERT INTO t_lob VALUES ('tinyblob-text readable','blob-text readable','mediumblob-text readable',
148 'longblob-text readable','tinytext','text','mediumtext','longtext',
149 'tinytext-binary\nnext line','text-binary\nnext line',
150 'mediumtext-binary\nnext line','longtext-binary \nnext line');
151
152 SELECT * FROM t_lob;
153
154 #
155 # OTHER
156 #
157 CREATE TABLE t_bit (c1 BIT(1), c2 BIT(64));
158 INSERT INTO t_bit VALUES (b'0', b'0');
159 INSERT INTO t_bit VALUES (b'1', b'1');
160 INSERT INTO t_bit VALUES (b'1', b'1111111111111111111111111111111111111111111111111111111111111111');
161
162 CREATE TABLE t_enum (c1 ENUM('v1','v2','v3'), c2 ENUM(''));
163 INSERT INTO t_enum VALUES ('v1', '');
164 INSERT INTO t_enum VALUES ('v2', '');
165
166 CREATE TABLE t_set (c1 SET('v1','v2','v3'), c2 SET(''));
167 INSERT INTO t_set VALUES ('v1,v1,v2', '');
168 INSERT INTO t_set VALUES ('', '');
169
170 SELECT * FROM t_bit;
171 SELECT * FROM t_enum;
172 SELECT * FROM t_set;
173
174 drop schema if exists xtest;
175
176 -->endsql
177 EOF
178
179 --exec $MYSQLXTEST -ux_root --password='' --file=$MYSQL_TMP_DIR/select_field_integer.xpl 2>&1
180
181 ## Cleanup
182 --source ../include/xplugin_cleanup.inc