Showing 1 changed files with 52 additions and 55 deletions
+52 -55
t/basic.t
... ...
@@ -21,9 +21,6 @@ sub test { print "# $_[0]\n" }
21 21
 
22 22
 # Constant varialbes for test
23 23
 my $CREATE_TABLE = {
24
-    0 => 'create table table1 (key1 char(255), key2 char(255));',
25
-    1 => 'create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));',
26
-    2 => 'create table table2 (key1 char(255), key3 char(255));',
27 24
     3 => 'create table table1 (key1 Date, key2 datetime);',
28 25
     4 => 'create table table3 (key3 int, key4 int);'
29 26
 };
... ...
@@ -136,7 +133,7 @@ is_deeply($rows, [{key1 => 2, key2 => 4}], "filter");
136 133
 
137 134
 test 'DBIx::Custom::SQLTemplate basic tag';
138 135
 $dbi->execute('drop table table1');
139
-$dbi->execute($CREATE_TABLE->{1});
136
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
140 137
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
141 138
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
142 139
 
... ...
@@ -160,7 +157,7 @@ is_deeply($rows, [{key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5}], "bas
160 157
 
161 158
 test 'DIB::Custom::SQLTemplate in tag';
162 159
 $dbi->execute('drop table table1');
163
-$dbi->execute($CREATE_TABLE->{1});
160
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
164 161
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
165 162
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
166 163
 
... ...
@@ -196,7 +193,7 @@ is_deeply($rows, [{key1 => 1, key2 => 1, key3 => 1, key4 => 1, key5 => 5},
196 193
 
197 194
 test 'Named placeholder';
198 195
 $dbi->execute('drop table table1');
199
-$dbi->execute($CREATE_TABLE->{1});
196
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
200 197
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
201 198
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
202 199
 
... ...
@@ -324,7 +321,7 @@ is_deeply($rows, [{key1 => 1, key2 => 2}, {key1 => 3, key2 => 4}], "basic");
324 321
 
325 322
 test 'update';
326 323
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
327
-$dbi->execute($CREATE_TABLE->{1});
324
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
328 325
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
329 326
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
330 327
 $dbi->update(table => 'table1', param => {key2 => 11}, where => {key1 => 1});
... ...
@@ -437,7 +434,7 @@ $rows   = $result->all;
437 434
 is_deeply($rows, [{select => 2, update => 6}], "reserved word");
438 435
 
439 436
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
440
-$dbi->execute($CREATE_TABLE->{1});
437
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
441 438
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
442 439
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
443 440
 $dbi->update({key2 => 11}, table => 'table1', where => {key1 => 1});
... ...
@@ -457,7 +454,7 @@ $rows   = $result->all;
457 454
 is_deeply($rows, [{key1 => 1, key2 => 4}], "basic");
458 455
 
459 456
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
460
-$dbi->execute($CREATE_TABLE->{1});
457
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
461 458
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
462 459
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
463 460
 $dbi->update(table => 'table1', param => {key2 => \"'11'"}, where => {key1 => 1});
... ...
@@ -469,7 +466,7 @@ is_deeply($rows, [{key1 => 1, key2 => 11, key3 => 3, key4 => 4, key5 => 5},
469 466
 
470 467
 test 'update_all';
471 468
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
472
-$dbi->execute($CREATE_TABLE->{1});
469
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
473 470
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
474 471
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
475 472
 $dbi->register_filter(twice => sub { $_[0] * 2 });
... ...
@@ -602,7 +599,7 @@ $rows = $dbi->select(table => 'table1', where => {key1 => 2}, filter => {key1 =>
602 599
             ->all;
603 600
 is_deeply($rows, [{key1 => 1, key2 => 2}], "filter");
604 601
 
605
-$dbi->execute($CREATE_TABLE->{2});
602
+$dbi->execute('create table table2 (key1 char(255), key3 char(255));');
606 603
 $dbi->insert(table => 'table2', param => {key1 => 1, key3 => 5});
607 604
 $rows = $dbi->select(
608 605
     table => [qw/table1 table2/],
... ...
@@ -878,7 +875,7 @@ is_deeply($rows, [{key1 => 4, key2 => 2}], "execute table tag");
878 875
 
879 876
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
880 877
 $dbi->execute('create table table1 (key1 char(255), key2 char(255));');
881
-$dbi->execute($CREATE_TABLE->{2});
878
+$dbi->execute('create table table2 (key1 char(255), key3 char(255));');
882 879
 $dbi->register_filter(twice => sub { $_[0] * 2 });
883 880
 $dbi->register_filter(three_times => sub { $_[0] * 3 });
884 881
 $dbi->apply_filter(
... ...
@@ -909,7 +906,7 @@ is_deeply($rows, [{key2 => 4, key3 => 18}], "select : join : omit");
909 906
 
910 907
 test 'each_column';
911 908
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
912
-$dbi->execute($CREATE_TABLE->{2});
909
+$dbi->execute('create table table2 (key1 char(255), key3 char(255));');
913 910
 $dbi->execute($CREATE_TABLE->{3});
914 911
 
915 912
 $infos = [];
... ...
@@ -933,7 +930,7 @@ is_deeply($infos,
933 930
 );
934 931
 test 'each_table';
935 932
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
936
-$dbi->execute($CREATE_TABLE->{2});
933
+$dbi->execute('create table table2 (key1 char(255), key3 char(255));');
937 934
 $dbi->execute($CREATE_TABLE->{3});
938 935
 
939 936
 $infos = [];
... ...
@@ -1695,7 +1692,7 @@ is_deeply($dbi->model('company')->columns, ['id', 'name']);
1695 1692
 
1696 1693
 test 'delete_at';
1697 1694
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1698
-$dbi->execute($CREATE_TABLE->{1});
1695
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
1699 1696
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
1700 1697
 $dbi->delete_at(
1701 1698
     table => 'table1',
... ...
@@ -1714,7 +1711,7 @@ is_deeply($dbi->select(table => 'table1')->all, []);
1714 1711
 
1715 1712
 test 'insert_at';
1716 1713
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1717
-$dbi->execute($CREATE_TABLE->{1});
1714
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
1718 1715
 $dbi->insert_at(
1719 1716
     primary_key => ['key1', 'key2'], 
1720 1717
     table => 'table1',
... ...
@@ -1749,7 +1746,7 @@ eval {
1749 1746
 like($@, qr/must be/);
1750 1747
 
1751 1748
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1752
-$dbi->execute($CREATE_TABLE->{1});
1749
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
1753 1750
 $dbi->insert_at(
1754 1751
     {key3 => 3},
1755 1752
     primary_key => ['key1', 'key2'], 
... ...
@@ -1762,7 +1759,7 @@ is($dbi->select(table => 'table1')->one->{key3}, 3);
1762 1759
 
1763 1760
 test 'update_at';
1764 1761
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1765
-$dbi->execute($CREATE_TABLE->{1});
1762
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
1766 1763
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
1767 1764
 $dbi->update_at(
1768 1765
     table => 'table1',
... ...
@@ -1787,7 +1784,7 @@ is($dbi->select(table => 'table1')->one->{key2}, 2);
1787 1784
 is($dbi->select(table => 'table1')->one->{key3}, 4);
1788 1785
 
1789 1786
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1790
-$dbi->execute($CREATE_TABLE->{1});
1787
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
1791 1788
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
1792 1789
 $dbi->update_at(
1793 1790
     {key3 => 4},
... ...
@@ -1801,7 +1798,7 @@ is($dbi->select(table => 'table1')->one->{key3}, 4);
1801 1798
 
1802 1799
 test 'select_at';
1803 1800
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1804
-$dbi->execute($CREATE_TABLE->{1});
1801
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
1805 1802
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
1806 1803
 $result = $dbi->select_at(
1807 1804
     table => 'table1',
... ...
@@ -1895,7 +1892,7 @@ test 'model delete_at';
1895 1892
     }
1896 1893
 }
1897 1894
 $dbi = MyDBI6->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1898
-$dbi->execute($CREATE_TABLE->{1});
1895
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
1899 1896
 $dbi->execute("create table table2 (key1, key2, key3)");
1900 1897
 $dbi->execute("create table table3 (key1, key2, key3)");
1901 1898
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
... ...
@@ -1910,7 +1907,7 @@ is_deeply($dbi->select(table => 'table1')->all, []);
1910 1907
 
1911 1908
 test 'model insert_at';
1912 1909
 $dbi = MyDBI6->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1913
-$dbi->execute($CREATE_TABLE->{1});
1910
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
1914 1911
 $dbi->model('table1')->insert_at(
1915 1912
     where => [1, 2],
1916 1913
     param => {key3 => 3}
... ...
@@ -1923,7 +1920,7 @@ is($row->{key3}, 3);
1923 1920
 
1924 1921
 test 'model update_at';
1925 1922
 $dbi = MyDBI6->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1926
-$dbi->execute($CREATE_TABLE->{1});
1923
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
1927 1924
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
1928 1925
 $dbi->model('table1')->update_at(
1929 1926
     where => [1, 2],
... ...
@@ -1937,7 +1934,7 @@ is($row->{key3}, 4);
1937 1934
 
1938 1935
 test 'model select_at';
1939 1936
 $dbi = MyDBI6->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1940
-$dbi->execute($CREATE_TABLE->{1});
1937
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
1941 1938
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
1942 1939
 $result = $dbi->model('table1')->select_at(where => [1, 2]);
1943 1940
 $row = $result->one;
... ...
@@ -1963,7 +1960,7 @@ test 'mycolumn and column';
1963 1960
 }
1964 1961
 $dbi = MyDBI7->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1965 1962
 $dbi->execute('create table table1 (key1 char(255), key2 char(255));');
1966
-$dbi->execute($CREATE_TABLE->{2});
1963
+$dbi->execute('create table table2 (key1 char(255), key3 char(255));');
1967 1964
 $dbi->separator('__');
1968 1965
 $dbi->setup_model;
1969 1966
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
... ...
@@ -1978,7 +1975,7 @@ is_deeply($result->one,
1978 1975
 
1979 1976
 test 'update_param';
1980 1977
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
1981
-$dbi->execute($CREATE_TABLE->{1});
1978
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
1982 1979
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
1983 1980
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
1984 1981
 
... ...
@@ -1997,7 +1994,7 @@ is_deeply($rows, [{key1 => 1, key2 => 11, key3 => 3, key4 => 4, key5 => 5},
1997 1994
 
1998 1995
 
1999 1996
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2000
-$dbi->execute($CREATE_TABLE->{1});
1997
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
2001 1998
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
2002 1999
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
2003 2000
 
... ...
@@ -2015,7 +2012,7 @@ is_deeply($rows, [{key1 => 1, key2 => 11, key3 => 33, key4 => 4, key5 => 5},
2015 2012
                   "basic");
2016 2013
 
2017 2014
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2018
-$dbi->execute($CREATE_TABLE->{1});
2015
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
2019 2016
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
2020 2017
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
2021 2018
 
... ...
@@ -2039,7 +2036,7 @@ like($@, qr/not safety/);
2039 2036
 
2040 2037
 test 'update_param';
2041 2038
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2042
-$dbi->execute($CREATE_TABLE->{1});
2039
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
2043 2040
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
2044 2041
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
2045 2042
 
... ...
@@ -2059,7 +2056,7 @@ is_deeply($rows, [{key1 => 1, key2 => 11, key3 => 3, key4 => 4, key5 => 5},
2059 2056
 
2060 2057
 test 'insert_param';
2061 2058
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2062
-$dbi->execute($CREATE_TABLE->{1});
2059
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
2063 2060
 $param = {key1 => 1, key2 => 2};
2064 2061
 $insert_param = $dbi->insert_param($param);
2065 2062
 $sql = <<"EOS";
... ...
@@ -2071,7 +2068,7 @@ is($dbi->select(table => 'table1')->one->{key2}, 2);
2071 2068
 
2072 2069
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2073 2070
 $dbi->quote('"');
2074
-$dbi->execute($CREATE_TABLE->{1});
2071
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
2075 2072
 $param = {key1 => 1, key2 => 2};
2076 2073
 $insert_param = $dbi->insert_param($param);
2077 2074
 $sql = <<"EOS";
... ...
@@ -2090,7 +2087,7 @@ $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2090 2087
 $dbi->execute('create table table1 (key1 char(255), key2 char(255));');
2091 2088
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
2092 2089
 $dbi->insert(table => 'table1', param => {key1 => 3, key2 => 4});
2093
-$dbi->execute($CREATE_TABLE->{2});
2090
+$dbi->execute('create table table2 (key1 char(255), key3 char(255));');
2094 2091
 $dbi->insert(table => 'table2', param => {key1 => 1, key3 => 5});
2095 2092
 $dbi->execute($CREATE_TABLE->{4});
2096 2093
 $dbi->insert(table => 'table3', param => {key3 => 5, key4 => 4});
... ...
@@ -2149,7 +2146,7 @@ $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2149 2146
 $dbi->quote('"');
2150 2147
 $dbi->execute('create table table1 (key1 char(255), key2 char(255));');
2151 2148
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
2152
-$dbi->execute($CREATE_TABLE->{2});
2149
+$dbi->execute('create table table2 (key1 char(255), key3 char(255));');
2153 2150
 $dbi->insert(table => 'table2', param => {key1 => 1, key3 => 5});
2154 2151
 $rows = $dbi->select(
2155 2152
     table => 'table1',
... ...
@@ -2196,7 +2193,7 @@ is_deeply($rows, [{latest_table1__key1 => 1}]);
2196 2193
 
2197 2194
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2198 2195
 $dbi->execute('create table table1 (key1 char(255), key2 char(255));');
2199
-$dbi->execute($CREATE_TABLE->{2});
2196
+$dbi->execute('create table table2 (key1 char(255), key3 char(255));');
2200 2197
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
2201 2198
 $dbi->insert(table => 'table2', param => {key1 => 1, key3 => 4});
2202 2199
 $dbi->insert(table => 'table2', param => {key1 => 1, key3 => 5});
... ...
@@ -2226,7 +2223,7 @@ is_deeply($result->all, [{'table2.key3' => 4}]);
2226 2223
 
2227 2224
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2228 2225
 $dbi->execute('create table table1 (key1 char(255), key2 char(255));');
2229
-$dbi->execute($CREATE_TABLE->{2});
2226
+$dbi->execute('create table table2 (key1 char(255), key3 char(255));');
2230 2227
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
2231 2228
 $dbi->insert(table => 'table2', param => {key1 => 1, key3 => 4});
2232 2229
 $dbi->insert(table => 'table2', param => {key1 => 1, key3 => 5});
... ...
@@ -2245,7 +2242,7 @@ is_deeply($result->all, [{'table2.key3' => 4}]);
2245 2242
 test 'mycolumn';
2246 2243
 $dbi = MyDBI8->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2247 2244
 $dbi->execute('create table table1 (key1 char(255), key2 char(255));');
2248
-$dbi->execute($CREATE_TABLE->{2});
2245
+$dbi->execute('create table table2 (key1 char(255), key3 char(255));');
2249 2246
 $dbi->setup_model;
2250 2247
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
2251 2248
 $dbi->insert(table => 'table2', param => {key1 => 1, key3 => 3});
... ...
@@ -2317,7 +2314,7 @@ ok(!$@);
2317 2314
 test 'column table option';
2318 2315
 $dbi = MyDBI9->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2319 2316
 $dbi->execute('create table table1 (key1 char(255), key2 char(255));');
2320
-$dbi->execute($CREATE_TABLE->{2});
2317
+$dbi->execute('create table table2 (key1 char(255), key3 char(255));');
2321 2318
 $dbi->setup_model;
2322 2319
 $dbi->execute('insert into table1 (key1, key2) values (1, 2);');
2323 2320
 $dbi->execute('insert into table2 (key1, key3) values (1, 4);');
... ...
@@ -2423,7 +2420,7 @@ is($row->{key1_length}, length $binary);
2423 2420
 test 'create_model';
2424 2421
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2425 2422
 $dbi->execute('create table table1 (key1 char(255), key2 char(255));');
2426
-$dbi->execute($CREATE_TABLE->{2});
2423
+$dbi->execute('create table table2 (key1 char(255), key3 char(255));');
2427 2424
 
2428 2425
 $dbi->create_model(
2429 2426
     table => 'table1',
... ...
@@ -2456,7 +2453,7 @@ is_deeply($model2->select->one, {key1 => 1, key3 => 3});
2456 2453
 test 'model method';
2457 2454
 test 'create_model';
2458 2455
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2459
-$dbi->execute($CREATE_TABLE->{2});
2456
+$dbi->execute('create table table2 (key1 char(255), key3 char(255));');
2460 2457
 $dbi->insert(table => 'table2', param => {key1 => 1, key3 => 3});
2461 2458
 $model = $dbi->create_model(
2462 2459
     table => 'table2'
... ...
@@ -2487,7 +2484,7 @@ $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2487 2484
 $dbi->execute('create table table1 (key1 char(255), key2 char(255));');
2488 2485
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
2489 2486
 $dbi->insert(table => 'table1', param => {key1 => 2, key2 => 3});
2490
-$dbi->execute($CREATE_TABLE->{2});
2487
+$dbi->execute('create table table2 (key1 char(255), key3 char(255));');
2491 2488
 $dbi->insert(table => 'table2', param => {key1 => 1, key3 => 4});
2492 2489
 $dbi->insert(table => 'table2', param => {key1 => 2, key3 => 5});
2493 2490
 $rows = $dbi->select(
... ...
@@ -2604,7 +2601,7 @@ is_deeply($rows, [{key1 => 5, key2 => 2}]);
2604 2601
 
2605 2602
 test 'insert id and primary_key option';
2606 2603
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2607
-$dbi->execute($CREATE_TABLE->{1});
2604
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
2608 2605
 $dbi->insert(
2609 2606
     primary_key => ['key1', 'key2'], 
2610 2607
     table => 'table1',
... ...
@@ -2628,7 +2625,7 @@ is($dbi->select(table => 'table1')->one->{key2}, 2);
2628 2625
 is($dbi->select(table => 'table1')->one->{key3}, 3);
2629 2626
 
2630 2627
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2631
-$dbi->execute($CREATE_TABLE->{1});
2628
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
2632 2629
 $dbi->insert(
2633 2630
     {key3 => 3},
2634 2631
     primary_key => ['key1', 'key2'], 
... ...
@@ -2642,7 +2639,7 @@ is($dbi->select(table => 'table1')->one->{key3}, 3);
2642 2639
 
2643 2640
 test 'model insert id and primary_key option';
2644 2641
 $dbi = MyDBI6->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2645
-$dbi->execute($CREATE_TABLE->{1});
2642
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
2646 2643
 $dbi->model('table1')->insert(
2647 2644
     id => [1, 2],
2648 2645
     param => {key3 => 3}
... ...
@@ -2654,7 +2651,7 @@ is($row->{key2}, 2);
2654 2651
 is($row->{key3}, 3);
2655 2652
 
2656 2653
 $dbi = MyDBI6->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2657
-$dbi->execute($CREATE_TABLE->{1});
2654
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
2658 2655
 $dbi->model('table1')->insert(
2659 2656
     {key3 => 3},
2660 2657
     id => [1, 2]
... ...
@@ -2667,7 +2664,7 @@ is($row->{key3}, 3);
2667 2664
 
2668 2665
 test 'update and id option';
2669 2666
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2670
-$dbi->execute($CREATE_TABLE->{1});
2667
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
2671 2668
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
2672 2669
 $dbi->update(
2673 2670
     table => 'table1',
... ...
@@ -2692,7 +2689,7 @@ is($dbi->select(table => 'table1')->one->{key2}, 2);
2692 2689
 is($dbi->select(table => 'table1')->one->{key3}, 4);
2693 2690
 
2694 2691
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2695
-$dbi->execute($CREATE_TABLE->{1});
2692
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
2696 2693
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
2697 2694
 $dbi->update(
2698 2695
     {key3 => 4},
... ...
@@ -2707,7 +2704,7 @@ is($dbi->select(table => 'table1')->one->{key3}, 4);
2707 2704
 
2708 2705
 test 'model update and id option';
2709 2706
 $dbi = MyDBI6->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2710
-$dbi->execute($CREATE_TABLE->{1});
2707
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
2711 2708
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
2712 2709
 $dbi->model('table1')->update(
2713 2710
     id => [1, 2],
... ...
@@ -2722,7 +2719,7 @@ is($row->{key3}, 4);
2722 2719
 
2723 2720
 test 'delete and id option';
2724 2721
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2725
-$dbi->execute($CREATE_TABLE->{1});
2722
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
2726 2723
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
2727 2724
 $dbi->delete(
2728 2725
     table => 'table1',
... ...
@@ -2742,7 +2739,7 @@ is_deeply($dbi->select(table => 'table1')->all, []);
2742 2739
 
2743 2740
 test 'model delete and id option';
2744 2741
 $dbi = MyDBI6->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2745
-$dbi->execute($CREATE_TABLE->{1});
2742
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
2746 2743
 $dbi->execute("create table table2 (key1, key2, key3)");
2747 2744
 $dbi->execute("create table table3 (key1, key2, key3)");
2748 2745
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
... ...
@@ -2758,7 +2755,7 @@ is_deeply($dbi->select(table => 'table1')->all, []);
2758 2755
 
2759 2756
 test 'select and id option';
2760 2757
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2761
-$dbi->execute($CREATE_TABLE->{1});
2758
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
2762 2759
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
2763 2760
 $result = $dbi->select(
2764 2761
     table => 'table1',
... ...
@@ -2797,7 +2794,7 @@ is($row->{key3}, 3);
2797 2794
 
2798 2795
 test 'model select_at';
2799 2796
 $dbi = MyDBI6->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2800
-$dbi->execute($CREATE_TABLE->{1});
2797
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
2801 2798
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3});
2802 2799
 $result = $dbi->model('table1')->select(id => [1, 2]);
2803 2800
 $row = $result->one;
... ...
@@ -2808,7 +2805,7 @@ is($row->{key3}, 3);
2808 2805
 test 'column separator is default .';
2809 2806
 $dbi = MyDBI7->connect(dsn => 'dbi:SQLite:dbname=:memory:');
2810 2807
 $dbi->execute('create table table1 (key1 char(255), key2 char(255));');
2811
-$dbi->execute($CREATE_TABLE->{2});
2808
+$dbi->execute('create table table2 (key1 char(255), key3 char(255));');
2812 2809
 $dbi->setup_model;
2813 2810
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
2814 2811
 $dbi->insert(table => 'table2', param => {key1 => 1, key3 => 3});
... ...
@@ -3227,7 +3224,7 @@ is($result->type_rule2_on->fetch_first->[0], '1bde');
3227 3224
 test 'separator';
3228 3225
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
3229 3226
 $dbi->execute('create table table1 (key1 char(255), key2 char(255));');
3230
-$dbi->execute($CREATE_TABLE->{2});
3227
+$dbi->execute('create table table2 (key1 char(255), key3 char(255));');
3231 3228
 
3232 3229
 $dbi->create_model(
3233 3230
     table => 'table1',
... ...
@@ -3284,7 +3281,7 @@ is_deeply($model2->select->one, {key1 => 1, key3 => 3});
3284 3281
 test 'filter_off';
3285 3282
 $dbi = DBIx::Custom->connect(dsn => 'dbi:SQLite:dbname=:memory:');
3286 3283
 $dbi->execute('create table table1 (key1 char(255), key2 char(255));');
3287
-$dbi->execute($CREATE_TABLE->{2});
3284
+$dbi->execute('create table table2 (key1 char(255), key3 char(255));');
3288 3285
 
3289 3286
 $dbi->create_model(
3290 3287
     table => 'table1',
... ...
@@ -3445,7 +3442,7 @@ test 'DBIx::Custom header';
3445 3442
 
3446 3443
 test 'Named placeholder :name(operater) syntax';
3447 3444
 $dbi->execute('drop table table1');
3448
-$dbi->execute($CREATE_TABLE->{1});
3445
+$dbi->execute('create table table1 (key1 char(255), key2 char(255), key3 char(255), key4 char(255), key5 char(255));');
3449 3446
 $dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2, key3 => 3, key4 => 4, key5 => 5});
3450 3447
 $dbi->insert(table => 'table1', param => {key1 => 6, key2 => 7, key3 => 8, key4 => 9, key5 => 10});
3451 3448