...
|
...
|
@@ -780,26 +780,6 @@ is($result->type_rule2_off->fetch_first->[0], '1bd');
|
780
|
780
|
$result = $dbi->select(table => 'table1');
|
781
|
781
|
is($result->type_rule2_on->fetch_first->[0], '1bde');
|
782
|
782
|
|
783
|
|
-test 'prefix';
|
784
|
|
-$dbi = DBIx::Custom->connect;
|
785
|
|
-eval { $dbi->execute('drop table table1') };
|
786
|
|
-$dbi->execute("create table table1 (key1 char(255), key2 char(255), primary key(key1))");
|
787
|
|
-$dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
|
788
|
|
-$dbi->insert(table => 'table1', param => {key1 => 1, key2 => 4}, prefix => 'or replace');
|
789
|
|
-$result = $dbi->execute('select * from table1;');
|
790
|
|
-$rows = $result->all;
|
791
|
|
-is_deeply($rows, [{key1 => 1, key2 => 4}], "basic");
|
792
|
|
-
|
793
|
|
-$dbi = DBIx::Custom->connect;
|
794
|
|
-eval { $dbi->execute('drop table table1') };
|
795
|
|
-$dbi->execute("create table table1 (key1 char(255), key2 char(255), primary key(key1))");
|
796
|
|
-$dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
|
797
|
|
-$dbi->update(table => 'table1', param => {key2 => 4},
|
798
|
|
- where => {key1 => 1}, prefix => 'or replace');
|
799
|
|
-$result = $dbi->execute('select * from table1;');
|
800
|
|
-$rows = $result->all;
|
801
|
|
-is_deeply($rows, [{key1 => 1, key2 => 4}], "basic");
|
802
|
|
-
|
803
|
783
|
test 'Model class';
|
804
|
784
|
use MyDBI1;
|
805
|
785
|
$dbi = MyDBI1->connect;
|
...
|
...
|
@@ -861,7 +841,7 @@ eval { $dbi->execute('drop table test') };
|
861
|
841
|
|
862
|
842
|
$dbi->execute('create table book (id)');
|
863
|
843
|
$dbi->execute('create table company (id, name);');
|
864
|
|
-$dbi->execute('create table test (id, name, primary key (id, name));');
|
|
844
|
+$dbi->execute('create table test (id, name);');
|
865
|
845
|
$dbi->setup_model;
|
866
|
846
|
is_deeply($dbi->model('book')->columns, ['id']);
|
867
|
847
|
is_deeply($dbi->model('company')->columns, ['id', 'name']);
|
...
|
...
|
@@ -876,10 +856,28 @@ is_deeply($dbi->model('company')->columns, ['id', 'name']);
|
876
|
856
|
|
877
|
857
|
|
878
|
858
|
|
|
859
|
+### SQLite only test
|
|
860
|
+test 'prefix';
|
|
861
|
+$dbi = DBIx::Custom->connect;
|
|
862
|
+eval { $dbi->execute('drop table table1') };
|
|
863
|
+$dbi->execute('create table table1 (key1 varchar, key2 varchar, primary key(key1));');
|
|
864
|
+$dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
|
|
865
|
+$dbi->insert(table => 'table1', param => {key1 => 1, key2 => 4}, prefix => 'or replace');
|
|
866
|
+$result = $dbi->execute('select * from table1;');
|
|
867
|
+$rows = $result->all;
|
|
868
|
+is_deeply($rows, [{key1 => 1, key2 => 4}], "basic");
|
879
|
869
|
|
|
870
|
+$dbi = DBIx::Custom->connect;
|
|
871
|
+eval { $dbi->execute('drop table table1') };
|
|
872
|
+$dbi->execute('create table table1 (key1 varchar, key2 varchar, primary key(key1));');
|
|
873
|
+$dbi->insert(table => 'table1', param => {key1 => 1, key2 => 2});
|
|
874
|
+$dbi->update(table => 'table1', param => {key2 => 4},
|
|
875
|
+ where => {key1 => 1}, prefix => 'or replace');
|
|
876
|
+$result = $dbi->execute('select * from table1;');
|
|
877
|
+$rows = $result->all;
|
|
878
|
+is_deeply($rows, [{key1 => 1, key2 => 4}], "basic");
|
880
|
879
|
|
881
|
880
|
|
882
|
|
-### SQLite only test
|
883
|
881
|
test 'quote';
|
884
|
882
|
$dbi = DBIx::Custom->connect;
|
885
|
883
|
$dbi->quote('"');
|
...
|
...
|
@@ -955,6 +953,7 @@ $result = $dbi->select(table => 'table1');
|
955
|
953
|
eval {$result->fetch_hash_multi};
|
956
|
954
|
like($@, qr/Row count must be specified/, "Not specified row count");
|
957
|
955
|
|
|
956
|
+
|
958
|
957
|
# DEPRECATED! test
|
959
|
958
|
test 'filter __ expression';
|
960
|
959
|
$dbi = DBIx::Custom->connect;
|