~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/csv.test

  • Committer: Brian Aker
  • Date: 2009-05-11 17:50:22 UTC
  • Revision ID: brian@gaz-20090511175022-y35q9ky6uh9ldcjt
Replacing Sun employee copyright headers (aka... anything done by a Sun
employee is copyright by Sun).

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
--enable_warnings
14
14
 
15
15
CREATE TABLE t1 (
16
 
  Period int(4) zerofill DEFAULT '0000' NOT NULL,
17
 
  Varor_period int(4) DEFAULT '0' NOT NULL
 
16
  Period int DEFAULT 0 NOT NULL,
 
17
  Varor_period int DEFAULT 0 NOT NULL
18
18
) ENGINE = CSV;
19
19
 
20
20
INSERT INTO t1 VALUES (9410,9412);
29
29
 
30
30
CREATE TABLE t2 (
31
31
  auto int not null,
32
 
  fld1 int(6) zerofill DEFAULT '000000' NOT NULL,
33
 
  companynr int(2) zerofill DEFAULT '00' NOT NULL,
 
32
  fld1 int DEFAULT 0 NOT NULL,
 
33
  companynr int DEFAULT 0 NOT NULL,
34
34
  fld3 char(30) DEFAULT '' NOT NULL,
35
35
  fld4 char(35) DEFAULT '' NOT NULL,
36
36
  fld5 char(35) DEFAULT '' NOT NULL,
42
42
#
43
43
 
44
44
--disable_query_log
 
45
begin;
45
46
INSERT INTO t2 VALUES (1,000001,00,'Omaha','teethe','neat','');
46
47
INSERT INTO t2 VALUES (2,011401,37,'breaking','dreaded','Steinberg','W');
47
48
INSERT INTO t2 VALUES (3,011402,37,'Romans','scholastics','jarring','');
1241
1242
INSERT INTO t2 VALUES (1191,068504,00,'bonfire','corresponds','positively','');
1242
1243
INSERT INTO t2 VALUES (1192,068305,00,'Colombo','hardware','colicky','');
1243
1244
INSERT INTO t2 VALUES (1193,000000,00,'nondecreasing','implant','thrillingly','');
 
1245
commit;
1244
1246
--enable_query_log
1245
1247
 
1246
1248
#
1304
1306
 
1305
1307
DROP TABLE t1;
1306
1308
CREATE TABLE t1 (
1307
 
  Period int(4) zerofill DEFAULT '0000' NOT NULL,
1308
 
  Varor_period int(4) DEFAULT '0' NOT NULL
 
1309
  Period int DEFAULT 0 NOT NULL,
 
1310
  Varor_period int DEFAULT 0 NOT NULL
1309
1311
) ENGINE = CSV;
1310
1312
 
1311
1313
INSERT INTO t1 VALUES (9410,9412);
1439
1441
 
1440
1442
CREATE TABLE test_repair_table4 (
1441
1443
  num int not null,
1442
 
  magic_no int(4) zerofill DEFAULT '0000' NOT NULL,
 
1444
  magic_no int DEFAULT 0 NOT NULL,
1443
1445
  company_name char(30) DEFAULT '' NOT NULL,
1444
1446
  founded char(4) DEFAULT '' NOT NULL
1445
1447
) ENGINE = CSV;
1471
1473
 
1472
1474
CREATE TABLE test_repair_table5 (
1473
1475
  num int not null,
1474
 
  magic_no int(4) zerofill DEFAULT '0000' NOT NULL,
 
1476
  magic_no int DEFAULT 0 NOT NULL,
1475
1477
  company_name char(30) DEFAULT '' NOT NULL,
1476
1478
  founded char(4) DEFAULT '' NOT NULL
1477
1479
) ENGINE = CSV;
1583
1585
# resulted in scanning through deleted memory and we were geting a crash.
1584
1586
# that's why we need two tables in the bugtest
1585
1587
 
1586
 
create table bug15205 (val int(11) not null) engine=csv;
1587
 
create table bug15205_2 (val int(11) not null) engine=csv;
1588
 
--remove_file $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV
1589
 
# system error (can't open the datafile)
1590
 
--replace_result $MYSQLTEST_VARDIR . master-data/ ''
1591
 
--error 13
1592
 
select * from bug15205;
1593
 
select * from bug15205_2;
1594
 
# Create empty file
1595
 
--write_file $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV
1596
 
EOF
1597
 
select * from bug15205;
1598
 
drop table bug15205;
1599
 
drop table bug15205_2;
1600
 
 
1601
 
 
1602
 
#
1603
 
# Bug#28862 "Extended Latin1 characters get lost in CVS engine"
1604
 
#
1605
 
set names latin1;
1606
 
create table t1 (
1607
 
  c varchar(1) not null,
1608
 
  name varchar(64) not null
1609
 
) character set latin1 engine=csv;
1610
 
insert into t1 values (0xC0,'LATIN CAPITAL LETTER A WITH GRAVE');
1611
 
insert into t1 values (0xE0,'LATIN SMALL LETTER A WITH GRAVE');
1612
 
insert into t1 values (0xEE,'LATIN SMALL LETTER I WITH CIRCUMFLEX');
1613
 
insert into t1 values (0xFE,'LATIN SMALL LETTER THORN');
1614
 
insert into t1 values (0xF7,'DIVISION SIGN');
1615
 
insert into t1 values (0xFF,'LATIN SMALL LETTER Y WITH DIAERESIS');
1616
 
select hex(c), c, name from t1 order by 1;
1617
 
drop table t1;
1618
 
 
1619
 
--echo End of 5.0 tests
 
1588
# TODO: Bug lp:311104
 
1589
#create table bug15205 (val int not null) engine=csv;
 
1590
#create table bug15205_2 (val int not null) engine=csv;
 
1591
#--remove_file $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV
 
1592
## system error (can't open the datafile)
 
1593
#--replace_result $MYSQLTEST_VARDIR . master-data/ ''
 
1594
#--error 13
 
1595
#select * from bug15205;
 
1596
#select * from bug15205_2;
 
1597
## Create empty file
 
1598
#--write_file $MYSQLTEST_VARDIR/master-data/test/bug15205.CSV
 
1599
#EOF
 
1600
#select * from bug15205;
 
1601
#drop table bug15205;
 
1602
#drop table bug15205_2;
1620
1603
 
1621
1604
 
1622
1605
#
1670
1653
#
1671
1654
 
1672
1655
CREATE TABLE `bug21328` (
1673
 
  `col1` int(11) NOT NULL,
1674
 
  `col2` int(11) NOT NULL,
1675
 
  `col3` int(11) NOT NULL
 
1656
  `col1` int NOT NULL,
 
1657
  `col2` int NOT NULL,
 
1658
  `col3` int NOT NULL
1676
1659
) ENGINE=CSV;
1677
1660
 
1678
1661
insert into bug21328 values (1,0,0);
1731
1714
# Bug #31473: does not work with NULL value in datetime field
1732
1715
#
1733
1716
create table t1(a datetime not null) engine=csv;
1734
 
insert into t1 values();
1735
 
select * from t1;
1736
 
drop table t1;
1737
 
create table t1(a set('foo','bar') not null) engine=csv;
 
1717
--error 1364
1738
1718
insert into t1 values();
1739
1719
select * from t1;
1740
1720
drop table t1;
1741
1721
create table t1(a varchar(32) not null) engine=csv;
 
1722
--error 1364
1742
1723
insert into t1 values();
1743
1724
select * from t1;
1744
1725
drop table t1;
1745
1726
create table t1(a int not null) engine=csv;
 
1727
--error 1364
1746
1728
insert into t1 values();
1747
1729
select * from t1;
1748
1730
drop table t1;
1749
1731
create table t1(a blob not null) engine=csv;
 
1732
--error 1364
1750
1733
insert into t1 values();
1751
1734
select * from t1;
1752
1735
drop table t1;
1753
 
create table t1(a bit(1) not null) engine=csv;
1754
 
insert into t1 values();
1755
 
select BIN(a) from t1;
1756
 
drop table t1;
1757
1736
# We prevent creation of table with nullable ENUM
1758
1737
--error ER_CHECK_NOT_IMPLEMENTED
1759
1738
create table t1(a enum('foo','bar') default null) engine=csv;
1776
1755
#
1777
1756
# BUG#33067 - .
1778
1757
#
1779
 
create table t1 (c1 tinyblob not null) engine=csv;
 
1758
create table t1 (c1 blob not null) engine=csv;
1780
1759
insert into t1 values("This");
1781
1760
--enable_info            
1782
1761
update t1 set c1="That" where c1="This";
1784
1763
select * from t1;
1785
1764
drop table t1;
1786
1765
 
 
1766
#
 
1767
# Bug#311104
 
1768
# CSV engine reports "out of memory" when you select
 
1769
# from a missing file
 
1770
#
 
1771
--disable_warnings
 
1772
drop table if exists t1;
 
1773
--enable_warnings
 
1774
 
 
1775
create table t1 (val int not null) engine=csv;
 
1776
--remove_file $MYSQLTEST_VARDIR/master-data/test/t1.CSV
 
1777
 
 
1778
--error 1017
 
1779
select * from t1;
 
1780
 
1787
1781
--echo End of 5.1 tests