~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/strict.test

This patch completes the first step in the splitting of
the XA resource manager API from the storage engine API,
as outlined in the specification here:

http://drizzle.org/wiki/XaStorageEngine

* Splits plugin::StorageEngine into a base StorageEngine
  class and two derived classes, TransactionalStorageEngine
  and XaStorageEngine.  XaStorageEngine derives from
  TransactionalStorageEngine and creates the XA Resource
  Manager API for storage engines.

  - The methods moved from StorageEngine to TransactionalStorageEngine
    include releaseTemporaryLatches(), startConsistentSnapshot(), 
    commit(), rollback(), setSavepoint(), releaseSavepoint(),
    rollbackToSavepoint() and hasTwoPhaseCommit()
  - The methods moved from StorageEngine to XaStorageEngine
    include recover(), commitXid(), rollbackXid(), and prepare()

* Places all static "EngineVector"s into their proper
  namespaces (typedefs belong in header files, not implementation files)
  and places all static methods corresponding
  to either only transactional engines or only XA engines
  into their respective files in /drizzled/plugin/

* Modifies the InnoDB "handler" files to extend plugin::XaStorageEngine
  and not plugin::StorageEngine

The next step, as outlined in the wiki spec page above, is to isolate
the XA Resource Manager API into its own plugin class and modify
plugin::XaStorageEngine to implement plugin::XaResourceManager via
composition.  This is necessary to enable building plugins which can
participate in an XA transaction *without having to have that plugin
implement the entire storage engine API*

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
INSERT INTO t1 (col1) VALUES ('');
39
39
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
40
40
INSERT INTO t1 (col1) VALUES ('a59b');
41
 
--error ER_WARN_DATA_TRUNCATED
 
41
--error 1265
42
42
INSERT INTO t1 (col1) VALUES ('1a');
43
43
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
44
 
--error ER_DIVISION_BY_ZERO
45
44
INSERT IGNORE INTO t1 values (1/0);
46
45
INSERT IGNORE INTO t1 values (-2147483649);
47
46
INSERT IGNORE INTO t1 values (2147643648);
67
66
 
68
67
--error ER_WARN_DATA_OUT_OF_RANGE
69
68
INSERT INTO t1 (col1) VALUES(-9223372036854775809);
70
 
# https://bugs.launchpad.net/drizzle/+bug/316221
71
 
 --error ER_WARN_DATA_OUT_OF_RANGE
72
 
INSERT INTO t1 (col1) VALUES(9223372036854775808);
 
69
# DISABLED due to https://bugs.launchpad.net/drizzle/+bug/316221
 
70
# --error ER_WARN_DATA_OUT_OF_RANGE
 
71
# INSERT INTO t1 (col1) VALUES(9223372036854775808);
73
72
 
74
73
--error ER_WARN_DATA_OUT_OF_RANGE
75
74
INSERT INTO t1 (col1) VALUES('-9223372036854775809');
95
94
INSERT INTO t1 (col1) VALUES ('');
96
95
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
97
96
INSERT INTO t1 (col1) VALUES ('a59b');
98
 
--error ER_WARN_DATA_TRUNCATED
 
97
--error 1265
99
98
INSERT INTO t1 (col1) VALUES ('1a');
100
99
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
101
 
--error ER_DIVISION_BY_ZERO
102
100
INSERT IGNORE INTO t1 values (1/0);
103
101
INSERT IGNORE INTO t1 VALUES (-9223372036854775809);
104
102
INSERT IGNORE INTO t1 VALUES (9223372036854775808);
123
121
# this statement errors due to decimal truncation. The number
124
122
# used in insertion is chosen to test that this this error does
125
123
# in fact occur
126
 
--error ER_WARN_DATA_TRUNCATED 
 
124
--error 1265 
127
125
INSERT INTO t1 VALUES (10.5555);
128
126
INSERT INTO t1 VALUES (0);
129
127
INSERT INTO t1 VALUES (-10.55);
130
128
# this statement errors due to decimal truncation. The number
131
129
# used in insertion is chosen to test that this this error does
132
130
# in fact occur
133
 
--error ER_WARN_DATA_TRUNCATED
 
131
--error 1265
134
132
INSERT INTO t1 VALUES (-10.5555);
135
133
INSERT INTO t1 VALUES (11);
136
134
INSERT INTO t1 VALUES (1e+01);
145
143
# this statement errors due to decimal truncation. The number
146
144
# used in insertion is chosen to test that this this error does
147
145
# in fact occur
148
 
--error ER_WARN_DATA_TRUNCATED 
 
146
--error 1265 
149
147
INSERT INTO t1 VALUES ('10.5555');
150
148
INSERT INTO t1 VALUES ('-10.55');
151
149
# this statement errors due to decimal truncation. The number 
152
150
# used in insertion is chosen to test that this error does 
153
151
# in fact occur
154
 
--error ER_WARN_DATA_TRUNCATED 
 
152
--error 1265 
155
153
INSERT INTO t1 VALUES ('-10.5555');
156
154
INSERT INTO t1 VALUES ('11');
157
155
INSERT INTO t1 VALUES ('1e+01');
188
186
UPDATE t1 SET col1 =col1 / 0 WHERE col1 > 0;
189
187
--error ER_DIVISION_BY_ZERO
190
188
UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0;
191
 
#--error ER_WARN_DATA_TRUNCATED
 
189
#--error 1265
192
190
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
193
191
INSERT INTO t1 (col1) VALUES ('');
194
 
#--error ER_WARN_DATA_TRUNCATED
 
192
#--error 1265
195
193
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
196
194
INSERT INTO t1 (col1) VALUES ('a59b');
197
195
--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
198
196
INSERT INTO t1 (col1) VALUES ('1a');
199
197
INSERT IGNORE INTO t1 (col1) VALUES ('2a');
200
 
--error ER_DIVISION_BY_ZERO
201
198
INSERT IGNORE INTO t1 values (1/0);
202
199
INSERT IGNORE INTO t1 VALUES (1000);
203
200
INSERT IGNORE INTO t1 VALUES (-1000);
215
212
CREATE TABLE t1 (col1 CHAR(5), col2 VARCHAR(6));
216
213
INSERT INTO t1 VALUES ('hello', 'hello');
217
214
INSERT INTO t1 VALUES ('he', 'he');
218
 
--error ER_DATA_TOO_LONG
219
215
INSERT INTO t1 VALUES ('hello   ', 'hello ');
220
 
--error ER_DATA_TOO_LONG
 
216
--error 1406
221
217
INSERT INTO t1 (col1) VALUES ('hellobob');
222
 
--error ER_DATA_TOO_LONG
 
218
--error 1406
223
219
INSERT INTO t1 (col2) VALUES ('hellobob');
224
 
--error ER_DATA_TOO_LONG
225
220
INSERT INTO t1 (col2) VALUES ('hello  ');
226
 
--error ER_DATA_TOO_LONG
 
221
--error 1406
227
222
UPDATE t1 SET col1 ='hellobob' WHERE col1 ='he';
228
 
--error ER_DATA_TOO_LONG
 
223
--error 1406
229
224
UPDATE t1 SET col2 ='hellobob' WHERE col2 ='he';
230
225
INSERT IGNORE INTO t1 VALUES ('hellobob', 'hellobob');
231
226
UPDATE IGNORE t1 SET col2 ='hellotrudy' WHERE col2 ='he';
239
234
INSERT INTO t1 VALUES ('red');
240
235
INSERT INTO t1 VALUES ('blue');
241
236
INSERT INTO t1 VALUES ('green');
242
 
--error ER_INVALID_ENUM_VALUE # Bad enum
 
237
--error 1691 # Bad enum
243
238
INSERT INTO t1 (col1) VALUES ('yellow');
244
 
--error ER_INVALID_ENUM_VALUE # Bad enum
 
239
--error 1691 # Bad enum
245
240
INSERT INTO t1 (col1) VALUES ('redd');
246
 
--error ER_INVALID_ENUM_VALUE # Bad enum
 
241
--error 1691 # Bad enum
247
242
INSERT INTO t1 VALUES ('');
248
 
--error ER_INVALID_ENUM_VALUE # Bad enum
 
243
--error 1691 # Bad enum
249
244
UPDATE t1 SET col1 ='yellow' WHERE col1 ='green';
250
 
--error ER_INVALID_ENUM_VALUE # Bad enum
 
245
--error 1691 # Bad enum
251
246
INSERT IGNORE INTO t1 VALUES ('yellow');
252
 
--error ER_INVALID_ENUM_VALUE # Bad enum
 
247
--error 1691 # Bad enum
253
248
UPDATE IGNORE t1 SET col1 ='yellow' WHERE col1 ='blue';
254
249
SELECT * FROM t1;
255
250
DROP TABLE t1;
259
254
CREATE TABLE t1 (col1 INT NOT NULL, col2 CHAR(5) NOT NULL, col3 DATE NOT NULL);
260
255
INSERT INTO t1 VALUES (100, 'hello', '2004-08-20');
261
256
INSERT INTO t1 (col1,col2,col3) VALUES (101, 'hell2', '2004-08-21');
262
 
--error ER_BAD_NULL_ERROR
 
257
--error 1048
263
258
INSERT INTO t1 (col1,col2,col3) VALUES (NULL, '', '2004-01-01');
264
 
--error ER_BAD_NULL_ERROR
 
259
--error 1048
265
260
INSERT INTO t1 (col1,col2,col3) VALUES (102, NULL, '2004-01-01');
266
 
--error ER_BAD_NULL_ERROR
 
261
--error 1048
267
262
INSERT INTO t1 VALUES (103,'',NULL);
268
 
--error ER_BAD_NULL_ERROR
 
263
--error 1048
269
264
UPDATE t1 SET col1=NULL WHERE col1 =100;
270
 
--error ER_BAD_NULL_ERROR
 
265
--error 1048
271
266
UPDATE t1 SET col2 =NULL WHERE col2 ='hello';
272
 
--error ER_BAD_NULL_ERROR
 
267
--error 1048
273
268
UPDATE t1 SET col2 =NULL where col3 IS NOT NULL;
274
269
INSERT IGNORE INTO t1 values (NULL,NULL,NULL);
275
270
SELECT * FROM t1;
282
277
SHOW CREATE TABLE t1;
283
278
INSERT INTO t1 VALUES (1, 'hello');
284
279
INSERT INTO t1 (col2) VALUES ('hello2');
285
 
--error ER_BAD_NULL_ERROR
 
280
--error 1048
286
281
INSERT INTO t1 (col2) VALUES (NULL);
287
 
--error ER_NO_DEFAULT_FOR_FIELD
 
282
--error 1364
288
283
INSERT INTO t1 (col1) VALUES (2);
289
 
--error ER_NO_DEFAULT_FOR_FIELD
 
284
--error 1364
290
285
INSERT INTO t1 VALUES(default(col1),default(col2));
291
 
--error ER_NO_DEFAULT_FOR_FIELD
 
286
--error 1364
292
287
INSERT INTO t1 (col1) SELECT 1;
293
 
--error ER_BAD_NULL_ERROR
 
288
--error 1048
294
289
INSERT INTO t1 SELECT 1,NULL;
295
290
INSERT IGNORE INTO t1 values (NULL,NULL);
296
291
--error ER_NO_DEFAULT_FOR_FIELD
306
301
 
307
302
create table t1 (charcol char(255), varcharcol varchar(255),
308
303
       varbinarycol varbinary(255));
309
 
--error ER_DATA_TOO_LONG
 
304
--error 1406
310
305
insert into t1 (charcol) values (repeat('x',256));
311
 
--error ER_DATA_TOO_LONG
 
306
--error 1406
312
307
insert into t1 (varcharcol) values (repeat('x',256));
313
 
--error ER_DATA_TOO_LONG
 
308
--error 1406
314
309
insert into t1 (varbinarycol) values (repeat('x',256));
315
310
select * from t1;
316
311
drop table t1;
320
315
#
321
316
 
322
317
create table t1 (col1 char(3), col2 integer);
323
 
--error ER_TRUNCATED_WRONG_VALUE
 
318
--error 1292
324
319
insert into t1 (col1) values (cast(1000 as char(3)));
325
 
--error ER_TRUNCATED_WRONG_VALUE
 
320
--error 1292
326
321
insert into t1 (col1) values (cast(1000E+0 as char(3)));
327
 
--error ER_TRUNCATED_WRONG_VALUE
 
322
--error 1292
328
323
insert into t1 (col1) values (cast(1000.0 as char(3)));
329
 
--error ER_TRUNCATED_WRONG_VALUE
 
324
--error 1292
330
325
insert into t1 (col2) values (cast('abc' as DECIMAL));
331
 
--error ER_TRUNCATED_WRONG_VALUE
 
326
--error 1292
332
327
insert into t1 (col2) values (10E+0 + 'a');
333
 
--error ER_WARN_DATA_TRUNCATED
 
328
--error 1265
334
329
insert into t1 (col2) values ('10a');
335
330
insert into t1 (col2) values (cast('10a' as DECIMAL));
336
331
insert into t1 (col2) values (cast('10' as DECIMAL));
341
336
 
342
337
# Test fields with no default value that are NOT NULL (Bug #5986)
343
338
CREATE TABLE t1 (i int not null);
344
 
--error ER_NO_DEFAULT_FOR_FIELD
 
339
--error 1364
345
340
INSERT INTO t1 VALUES ();
346
 
--error ER_NO_DEFAULT_FOR_FIELD
 
341
--error 1364
347
342
INSERT INTO t1 VALUES (DEFAULT);
348
 
--error ER_NO_DEFAULT_FOR_FIELD
 
343
--error 1364
349
344
INSERT INTO t1 VALUES (DEFAULT(i));
350
345
ALTER TABLE t1 ADD j int;
351
 
--error ER_NO_DEFAULT_FOR_FIELD
 
346
--error 1364
352
347
INSERT INTO t1 SET j = 1;
353
 
--error ER_NO_DEFAULT_FOR_FIELD
 
348
--error 1364
354
349
INSERT INTO t1 SET j = 1, i = DEFAULT;
355
 
--error ER_NO_DEFAULT_FOR_FIELD
 
350
--error 1364
356
351
INSERT INTO t1 SET j = 1, i = DEFAULT(i);
357
 
--error ER_NO_DEFAULT_FOR_FIELD
 
352
--error 1364
358
353
INSERT INTO t1 VALUES (DEFAULT,1);
359
354
DROP TABLE t1;
360
355
CREATE TABLE t1 (i int not null);
361
 
--error ER_NO_DEFAULT_FOR_FIELD
 
356
--error 1364
362
357
INSERT INTO t1 VALUES ();
363
 
--error ER_NO_DEFAULT_FOR_FIELD
 
358
--error 1364
364
359
INSERT INTO t1 VALUES (DEFAULT);
365
360
# DEFAULT(i) is an error even with the default sql_mode
366
 
--error ER_NO_DEFAULT_FOR_FIELD
 
361
--error 1364
367
362
INSERT INTO t1 VALUES (DEFAULT(i));
368
363
ALTER TABLE t1 ADD j int;
369
 
--error ER_NO_DEFAULT_FOR_FIELD
 
364
--error 1364
370
365
INSERT INTO t1 SET j = 1;
371
 
--error ER_NO_DEFAULT_FOR_FIELD
 
366
--error 1364
372
367
INSERT INTO t1 SET j = 1, i = DEFAULT;
373
 
--error ER_NO_DEFAULT_FOR_FIELD
 
368
--error 1364
374
369
INSERT INTO t1 SET j = 1, i = DEFAULT(i);
375
 
--error ER_NO_DEFAULT_FOR_FIELD
 
370
--error 1364
376
371
INSERT INTO t1 VALUES (DEFAULT,1);
377
372
DROP TABLE t1;
378
373
 
380
375
# Bugs #8295 and #8296: varchar and varbinary conversion
381
376
#
382
377
 
383
 
--error ER_TOO_BIG_FIELDLENGTH
 
378
--error 1074
384
379
create table t1(a varchar(65537));
385
 
--error ER_TOO_BIG_FIELDLENGTH
 
380
--error 1074
386
381
create table t1(a varbinary(65537));
387
382
 
388
383
#
421
416
drop table t2,t1;
422
417
 
423
418
create table t1 (i int)
424
 
comment='123456789*123456789*123456789*123456789*123456789*123456789*';
 
419
comment '123456789*123456789*123456789*123456789*123456789*123456789*';
425
420
--replace_regex /ENGINE=[a-zA-Z]+/ENGINE=DEFAULT/
426
421
show create table t1;
427
422
drop table t1;
456
451
#
457
452
# Bug#27069 set with identical elements are created
458
453
#
459
 
--error ER_DUPLICATED_VALUE_IN_TYPE
 
454
--error 1291
460
455
create table t1 (f1 enum('a','a'));
461
456
 
462
457
--echo End of 5.0 tests