| ... | ... |
@@ -1167,9 +1167,7 @@ sub _create_query {
|
| 1167 | 1167 |
# Filter SQL |
| 1168 | 1168 |
if ($sqlfilter) {
|
| 1169 | 1169 |
my $sql = $query->sql; |
| 1170 |
- $sql =~ s/\s*;$//; |
|
| 1171 | 1170 |
$sql = $sqlfilter->($sql); |
| 1172 |
- $sql .= ';'; |
|
| 1173 | 1171 |
$query->sql($sql); |
| 1174 | 1172 |
} |
| 1175 | 1173 |
|
| ... | ... |
@@ -41,7 +41,6 @@ sub build_query {
|
| 41 | 41 |
else { $query = $self->_parse_parameter($source) }
|
| 42 | 42 |
|
| 43 | 43 |
my $sql = $query->sql; |
| 44 |
- $sql .= ';' unless $source =~ /;$/; |
|
| 45 | 44 |
$query->sql($sql); |
| 46 | 45 |
|
| 47 | 46 |
# Check placeholder count |
| ... | ... |
@@ -58,13 +58,13 @@ use DBIx::Custom; |
| 58 | 58 |
has user => 'dbix_custom'; |
| 59 | 59 |
has password => 'dbix_custom'; |
| 60 | 60 |
|
| 61 |
- sub create_table1 { "create table $table1 ($key1 varchar(255), $key2 varchar(255)) engine=InnoDB;" }
|
|
| 61 |
+ sub create_table1 { "create table $table1 ($key1 varchar(255), $key2 varchar(255)) engine=InnoDB" }
|
|
| 62 | 62 |
sub create_table1_2 { "create table $table1 ($key1 varchar(255), $key2 varchar(255), "
|
| 63 |
- . "$key3 varchar(255), key4 varchar(255), key5 varchar(255)) engine=InnoDB;" } |
|
| 64 |
- sub create_table1_type { "create table $table1 ($key1 $date_typename, $key2 $datetime_typename) engine=InnoDB;" }
|
|
| 63 |
+ . "$key3 varchar(255), key4 varchar(255), key5 varchar(255)) engine=InnoDB" } |
|
| 64 |
+ sub create_table1_type { "create table $table1 ($key1 $date_typename, $key2 $datetime_typename) engine=InnoDB" }
|
|
| 65 | 65 |
sub create_table1_highperformance { "create table $table1 ($key1 varchar(255), $key2 varchar(255), "
|
| 66 |
- . "$key3 varchar(255), $key4 varchar(255), $key5 varchar(255), $key6 varchar(255), $key7 varchar(255)) engine=InnoDB;" } |
|
| 67 |
- sub create_table2 { "create table $table2 ($key1 varchar(255), $key3 varchar(255)) engine=InnoDB;" }
|
|
| 66 |
+ . "$key3 varchar(255), $key4 varchar(255), $key5 varchar(255), $key6 varchar(255), $key7 varchar(255)) engine=InnoDB" } |
|
| 67 |
+ sub create_table2 { "create table $table2 ($key1 varchar(255), $key3 varchar(255)) engine=InnoDB" }
|
|
| 68 | 68 |
sub create_table2_2 { "create table $table2 ($key1 varchar(255), $key2 varchar(255), $key3 varchar(255)) engine=InnoDB" }
|
| 69 | 69 |
sub create_table3 { "create table $table3 ($key1 varchar(255), $key2 varchar(255), $key3 varchar(255)) engine=InnoDB" }
|
| 70 | 70 |
sub create_table_reserved {
|
| ... | ... |
@@ -11,6 +11,36 @@ use DBIx::Custom; |
| 11 | 11 |
package DBIx::Custom; |
| 12 | 12 |
no warnings 'redefine'; |
| 13 | 13 |
|
| 14 |
+ my $table1 = 'TABLE1'; |
|
| 15 |
+ my $table2 = 'TABLE2'; |
|
| 16 |
+ my $table2_alias = 'TABLE2_ALIAS'; |
|
| 17 |
+ my $table3 = 'TABLE3'; |
|
| 18 |
+ my $key1 = 'KEY1'; |
|
| 19 |
+ my $key2 = 'KEY2'; |
|
| 20 |
+ my $key3 = 'KEY3'; |
|
| 21 |
+ my $key4 = 'KEY4'; |
|
| 22 |
+ my $key5 = 'KEY5'; |
|
| 23 |
+ my $key6 = 'KEY6'; |
|
| 24 |
+ my $key7 = 'KEY7'; |
|
| 25 |
+ my $key8 = 'KEY8'; |
|
| 26 |
+ my $key9 = 'KEY9'; |
|
| 27 |
+ my $key10 = 'KEY10'; |
|
| 28 |
+ |
|
| 29 |
+ has table1 => $table1; |
|
| 30 |
+ has table2 => $table2; |
|
| 31 |
+ has table2_alias => $table2_alias; |
|
| 32 |
+ has table3 => $table3; |
|
| 33 |
+ has key1 => $key1; |
|
| 34 |
+ has key2 => $key2; |
|
| 35 |
+ has key3 => $key3; |
|
| 36 |
+ has key4 => $key4; |
|
| 37 |
+ has key5 => $key5; |
|
| 38 |
+ has key6 => $key6; |
|
| 39 |
+ has key7 => $key7; |
|
| 40 |
+ has key8 => $key8; |
|
| 41 |
+ has key9 => $key9; |
|
| 42 |
+ has key10 => $key10; |
|
| 43 |
+ |
|
| 14 | 44 |
my $date_typename = 'CHAR(10)'; |
| 15 | 45 |
my $datetime_typename = 'DATE'; |
| 16 | 46 |
|
| ... | ... |
@@ -61,15 +91,15 @@ use DBIx::Custom; |
| 61 | 91 |
)/x |
| 62 | 92 |
}; |
| 63 | 93 |
|
| 64 |
- sub create_table1 { 'create table table1 (key1 varchar2(255), key2 varchar2(255));' }
|
|
| 65 |
- sub create_table1_2 {'create table table1 (key1 varchar2(255), key2 varchar2(255), '
|
|
| 66 |
- . 'key3 varchar2(255), key4 varchar2(255), key5 varchar2(255));' } |
|
| 67 |
- sub create_table1_type { "create table table1 (key1 $date_typename, key2 $datetime_typename);" }
|
|
| 68 |
- sub create_table1_highperformance { "create table table1 (ab varchar2(255), bc varchar2(255), "
|
|
| 69 |
- . "ik varchar2(255), hi varchar2(255), ui varchar2(255), pq varchar2(255), dc varchar2(255));" } |
|
| 70 |
- sub create_table2 { 'create table table2 (key1 varchar2(255), key3 varchar2(255));' }
|
|
| 71 |
- sub create_table2_2 { "create table table2 (key1 varchar2(255), key2 varchar2(255), key3 varchar2(255))" }
|
|
| 72 |
- sub create_table3 { "create table table3 (key1 varchar2(255), key2 varchar2(255), key3 varchar2(255))" }
|
|
| 94 |
+ sub create_table1 { "create table $table1 ($key1 varchar2(255), $key2 varchar2(255))" }
|
|
| 95 |
+ sub create_table1_2 { "create table $table1 ($key1 varchar2(255), $key2 varchar2(255), "
|
|
| 96 |
+ . "$key3 varchar2(255), $key4 varchar2(255), $key5 varchar2(255))" } |
|
| 97 |
+ sub create_table1_type { "create table $table1 ($key1 $date_typename, $key2 $datetime_typename)" }
|
|
| 98 |
+ sub create_table1_highperformance { "create table $table1 ($key1 varchar2(255), $key2 varchar2(255), "
|
|
| 99 |
+ . "$key3 varchar2(255), $key4 varchar2(255), $key5 varchar2(255), $key6 varchar2(255), $key7 varchar2(255))" } |
|
| 100 |
+ sub create_table2 { "create table $table2 ($key1 varchar2(255), $key3 varchar2(255))" }
|
|
| 101 |
+ sub create_table2_2 { "create table $table2 ($key1 varchar2(255), $key2 varchar2(255), $key3 varchar2(255))" }
|
|
| 102 |
+ sub create_table3 { "create table $table3 ($key1 varchar2(255), $key2 varchar2(255), $key3 varchar2(255))" }
|
|
| 73 | 103 |
sub create_table_reserved { 'create table "table" ("select" varchar2(255), "update" varchar2(255))' }
|
| 74 | 104 |
} |
| 75 | 105 |
|
| ... | ... |
@@ -89,13 +89,13 @@ use DBIx::Custom; |
| 89 | 89 |
)/x |
| 90 | 90 |
}; |
| 91 | 91 |
|
| 92 |
- sub create_table1 { "create table $table1 ($key1 varchar(255), $key2 varchar(255));" }
|
|
| 92 |
+ sub create_table1 { "create table $table1 ($key1 varchar(255), $key2 varchar(255))" }
|
|
| 93 | 93 |
sub create_table1_2 {"create table $table1 ($key1 varchar(255), $key2 varchar(255), "
|
| 94 |
- . "$key3 varchar(255), $key4 varchar(255), $key5 varchar(255));" } |
|
| 95 |
- sub create_table1_type { "create table $table1 ($key1 $date_typename, $key2 $datetime_typename);" }
|
|
| 94 |
+ . "$key3 varchar(255), $key4 varchar(255), $key5 varchar(255))" } |
|
| 95 |
+ sub create_table1_type { "create table $table1 ($key1 $date_typename, $key2 $datetime_typename)" }
|
|
| 96 | 96 |
sub create_table1_highperformance { "create table $table1 ($key1 varchar(255), $key2 varchar(255), "
|
| 97 |
- . "$key3 varchar(255), $key4 varchar(255), $key5 varchar(255), $key6 varchar(255), $key7 varchar(255));" } |
|
| 98 |
- sub create_table2 { "create table $table2 ($key1 varchar(255), $key3 varchar(255));" }
|
|
| 97 |
+ . "$key3 varchar(255), $key4 varchar(255), $key5 varchar(255), $key6 varchar(255), $key7 varchar(255))" } |
|
| 98 |
+ sub create_table2 { "create table $table2 ($key1 varchar(255), $key3 varchar(255))" }
|
|
| 99 | 99 |
sub create_table2_2 { "create table $table2 ($key1 varchar(255), $key2 varchar(255), $key3 varchar(255))" }
|
| 100 | 100 |
sub create_table3 { "create table $table3 ($key1 varchar(255), $key2 varchar(255), $key3 varchar(255))" }
|
| 101 | 101 |
sub create_table_reserved { 'create table "table" ("select" varchar(255), "update" varchar(255))' }
|
| ... | ... |
@@ -52,13 +52,13 @@ use DBIx::Custom; |
| 52 | 52 |
sub datetime_datatype { lc $datetime_datatype }
|
| 53 | 53 |
|
| 54 | 54 |
has dsn => 'dbi:SQLite:dbname=:memory:'; |
| 55 |
- sub create_table1 { "create table $table1 ($key1 varchar, $key2 varchar);" }
|
|
| 56 |
- sub create_table1_2 {"create table $table1 ($key1 varchar, $key2 varchar, $key3 varchar, key4 varchar, key5 varchar);" }
|
|
| 57 |
- sub create_table1_type { "create table $table1 ($key1 $date_typename, $key2 $datetime_typename);" }
|
|
| 55 |
+ sub create_table1 { "create table $table1 ($key1 varchar, $key2 varchar)" }
|
|
| 56 |
+ sub create_table1_2 {"create table $table1 ($key1 varchar, $key2 varchar, $key3 varchar, key4 varchar, key5 varchar)" }
|
|
| 57 |
+ sub create_table1_type { "create table $table1 ($key1 $date_typename, $key2 $datetime_typename)" }
|
|
| 58 | 58 |
|
| 59 |
- sub create_table1_highperformance { "create table $table1 (key1 varchar, key2 varchar, key3 varchar, key4 varchar, key5 varchar, key6 varchar, key7 varchar);" }
|
|
| 59 |
+ sub create_table1_highperformance { "create table $table1 (key1 varchar, key2 varchar, key3 varchar, key4 varchar, key5 varchar, key6 varchar, key7 varchar)" }
|
|
| 60 | 60 |
|
| 61 |
- sub create_table2 { "create table $table2 ($key1 varchar, $key3 varchar);" }
|
|
| 61 |
+ sub create_table2 { "create table $table2 ($key1 varchar, $key3 varchar)" }
|
|
| 62 | 62 |
sub create_table2_2 { "create table $table2 ($key1 varchar, $key2 varchar, $key3 varchar)" }
|
| 63 | 63 |
sub create_table3 { "create table $table3 ($key1 varchar, $key2 varchar, $key3 varchar)" }
|
| 64 | 64 |
sub create_table_reserved { 'create table "table" ("select" varchar, "update" varchar)' }
|
| ... | ... |
@@ -54,13 +54,13 @@ use DBIx::Custom; |
| 54 | 54 |
sub datetime_datatype { lc $datetime_datatype }
|
| 55 | 55 |
|
| 56 | 56 |
has dsn => 'dbi:SQLite:dbname=:memory:'; |
| 57 |
- sub create_table1 { "create table $table1 ($key1 varchar, $key2 varchar);" }
|
|
| 58 |
- sub create_table1_2 {"create table $table1 ($key1 varchar, $key2 varchar, $key3 varchar, key4 varchar, key5 varchar);" }
|
|
| 59 |
- sub create_table1_type { "create table $table1 ($key1 $date_typename, $key2 $datetime_typename);" }
|
|
| 57 |
+ sub create_table1 { "create table $table1 ($key1 varchar, $key2 varchar)" }
|
|
| 58 |
+ sub create_table1_2 {"create table $table1 ($key1 varchar, $key2 varchar, $key3 varchar, key4 varchar, key5 varchar)" }
|
|
| 59 |
+ sub create_table1_type { "create table $table1 ($key1 $date_typename, $key2 $datetime_typename)" }
|
|
| 60 | 60 |
|
| 61 |
- sub create_table1_highperformance { "create table $table1 (key1 varchar, key2 varchar, key3 varchar, key4 varchar, key5 varchar, key6 varchar, key7 varchar);" }
|
|
| 61 |
+ sub create_table1_highperformance { "create table $table1 (key1 varchar, key2 varchar, key3 varchar, key4 varchar, key5 varchar, key6 varchar, key7 varchar)" }
|
|
| 62 | 62 |
|
| 63 |
- sub create_table2 { "create table $table2 ($key1 varchar, $key3 varchar);" }
|
|
| 63 |
+ sub create_table2 { "create table $table2 ($key1 varchar, $key3 varchar)" }
|
|
| 64 | 64 |
sub create_table2_2 { "create table $table2 ($key1 varchar, $key2 varchar, $key3 varchar)" }
|
| 65 | 65 |
sub create_table3 { "create table $table3 ($key1 varchar, $key2 varchar, $key3 varchar)" }
|
| 66 | 66 |
sub create_table_reserved { 'create table "table" ("select" varchar, "update" varchar)' }
|
| ... | ... |
@@ -412,13 +412,13 @@ use DBIx::Custom; |
| 412 | 412 |
has user => 'dbix_custom'; |
| 413 | 413 |
has password => 'dbix_custom'; |
| 414 | 414 |
|
| 415 |
- sub create_table1 { "create table $table1 ($key1 varchar(255), $key2 varchar(255));" }
|
|
| 415 |
+ sub create_table1 { "create table $table1 ($key1 varchar(255), $key2 varchar(255))" }
|
|
| 416 | 416 |
sub create_table1_2 {"create table $table1 ($key1 varchar(255), $key2 varchar(255), "
|
| 417 |
- . "$key3 varchar(255), $key4 varchar(255), $key5 varchar(255));" } |
|
| 418 |
- sub create_table1_type { "create table $table1 ($key1 $date_typename, $key2 $datetime_typename);" }
|
|
| 417 |
+ . "$key3 varchar(255), $key4 varchar(255), $key5 varchar(255))" } |
|
| 418 |
+ sub create_table1_type { "create table $table1 ($key1 $date_typename, $key2 $datetime_typename)" }
|
|
| 419 | 419 |
sub create_table1_highperformance { "create table $table1 ($key1 varchar(255), $key2 varchar(255), "
|
| 420 |
- . "$key3 varchar(255), $key4 varchar(255), $key5 varchar(255), $key6 varchar(255), $key7 varchar(255));" } |
|
| 421 |
- sub create_table2 { "create table $table2 ($key1 varchar(255), $key3 varchar(255));" }
|
|
| 420 |
+ . "$key3 varchar(255), $key4 varchar(255), $key5 varchar(255), $key6 varchar(255), $key7 varchar(255))" } |
|
| 421 |
+ sub create_table2 { "create table $table2 ($key1 varchar(255), $key3 varchar(255))" }
|
|
| 422 | 422 |
sub create_table2_2 { "create table $table2 ($key1 varchar(255), $key2 varchar(255), $key3 varchar(255))" }
|
| 423 | 423 |
sub create_table3 { "create table $table3 ($key1 varchar(255), $key2 varchar(255), $key3 varchar(255))" }
|
| 424 | 424 |
sub create_table_reserved { 'create table "table" ("select" varchar(255), "update" varchar(255))' }
|
| ... | ... |
@@ -253,7 +253,7 @@ $dbi->type_rule( |
| 253 | 253 |
] |
| 254 | 254 |
); |
| 255 | 255 |
$result = $dbi->execute( |
| 256 |
- "select * from $table1 where $key1 = :$key1 and $key2 = :$table1.$key2;", |
|
| 256 |
+ "select * from $table1 where $key1 = :$key1 and $key2 = :$table1.$key2", |
|
| 257 | 257 |
param => {$key1 => '2010-01-03', "$table1.$key2" => '2010-01-01 01:01:02'}
|
| 258 | 258 |
); |
| 259 | 259 |
$row = $result->one; |
| ... | ... |
@@ -274,7 +274,7 @@ $dbi->type_rule( |
| 274 | 274 |
] |
| 275 | 275 |
); |
| 276 | 276 |
$result = $dbi->execute( |
| 277 |
- "select * from $table1 where $key1 = :$key1 and $key2 = :$table1.$key2;", |
|
| 277 |
+ "select * from $table1 where $key1 = :$key1 and $key2 = :$table1.$key2", |
|
| 278 | 278 |
param => {$key1 => '2010-01-02', "$table1.$key2" => '2010-01-01 01:01:02'},
|
| 279 | 279 |
table => $table1 |
| 280 | 280 |
); |
| ... | ... |
@@ -678,7 +678,7 @@ test 'Direct query'; |
| 678 | 678 |
$dbi->delete_all(table => $table1); |
| 679 | 679 |
$insert_source = "insert into $table1 {insert_param $key1 $key2}";
|
| 680 | 680 |
$dbi->execute($insert_source, param => {$key1 => 1, $key2 => 2});
|
| 681 |
-$result = $dbi->execute("select * from $table1;");
|
|
| 681 |
+$result = $dbi->execute("select * from $table1");
|
|
| 682 | 682 |
$rows = $result->all; |
| 683 | 683 |
is_deeply($rows, [{$key1 => 1, $key2 => 2}]);
|
| 684 | 684 |
|
| ... | ... |
@@ -687,17 +687,17 @@ $dbi->delete_all(table => $table1); |
| 687 | 687 |
$dbi->register_filter(twice => sub { $_[0] * 2},
|
| 688 | 688 |
three_times => sub { $_[0] * 3});
|
| 689 | 689 |
|
| 690 |
-$insert_source = "insert into $table1 {insert_param $key1 $key2};";
|
|
| 690 |
+$insert_source = "insert into $table1 {insert_param $key1 $key2}";
|
|
| 691 | 691 |
$insert_query = $dbi->execute($insert_source, {}, query => 1);
|
| 692 | 692 |
$insert_query->filter({$key1 => 'twice'});
|
| 693 | 693 |
$dbi->execute($insert_query, param => {$key1 => 1, $key2 => 2});
|
| 694 |
-$result = $dbi->execute("select * from $table1;");
|
|
| 694 |
+$result = $dbi->execute("select * from $table1");
|
|
| 695 | 695 |
$rows = $result->filter({$key2 => 'three_times'})->all;
|
| 696 | 696 |
is_deeply($rows, [{$key1 => 2, $key2 => 6}], "filter fetch_filter");
|
| 697 | 697 |
|
| 698 | 698 |
test 'Filter in'; |
| 699 | 699 |
$dbi->delete_all(table => $table1); |
| 700 |
-$insert_source = "insert into $table1 {insert_param $key1 $key2};";
|
|
| 700 |
+$insert_source = "insert into $table1 {insert_param $key1 $key2}";
|
|
| 701 | 701 |
$insert_query = $dbi->execute($insert_source, {}, query => 1);
|
| 702 | 702 |
$dbi->execute($insert_query, param => {$key1 => 2, $key2 => 4});
|
| 703 | 703 |
$select_source = "select * from $table1 where {in $table1.$key1 2} and {in $table1.$key2 2}";
|
| ... | ... |
@@ -713,19 +713,19 @@ $dbi->execute($create_table1_2); |
| 713 | 713 |
$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
| 714 | 714 |
$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
| 715 | 715 |
|
| 716 |
-$source = "select * from $table1 where $key1 = :$key1 and {<> $key2} and {< $key3} and {> $key4} and {>= $key5};";
|
|
| 716 |
+$source = "select * from $table1 where $key1 = :$key1 and {<> $key2} and {< $key3} and {> $key4} and {>= $key5}";
|
|
| 717 | 717 |
$query = $dbi->execute($source, {}, query => 1);
|
| 718 | 718 |
$result = $dbi->execute($query, param => {$key1 => 1, $key2 => 3, $key3 => 4, $key4 => 3, $key5 => 5});
|
| 719 | 719 |
$rows = $result->all; |
| 720 | 720 |
is_deeply($rows, [{$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}], "basic tag1");
|
| 721 | 721 |
|
| 722 |
-$source = "select * from $table1 where $key1 = :$key1 and {<> $key2} and {< $key3} and {> $key4} and {>= $key5};";
|
|
| 722 |
+$source = "select * from $table1 where $key1 = :$key1 and {<> $key2} and {< $key3} and {> $key4} and {>= $key5}";
|
|
| 723 | 723 |
$query = $dbi->execute($source, {}, query => 1);
|
| 724 | 724 |
$result = $dbi->execute($query, {$key1 => 1, $key2 => 3, $key3 => 4, $key4 => 3, $key5 => 5});
|
| 725 | 725 |
$rows = $result->all; |
| 726 | 726 |
is_deeply($rows, [{$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}], "basic tag1");
|
| 727 | 727 |
|
| 728 |
-$source = "select * from $table1 where {<= $key1} and {like $key2};";
|
|
| 728 |
+$source = "select * from $table1 where {<= $key1} and {like $key2}";
|
|
| 729 | 729 |
$query = $dbi->execute($source, {}, query => 1);
|
| 730 | 730 |
$result = $dbi->execute($query, param => {$key1 => 1, $key2 => '%2%'});
|
| 731 | 731 |
$rows = $result->all; |
| ... | ... |
@@ -737,7 +737,7 @@ $dbi->execute($create_table1_2); |
| 737 | 737 |
$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
| 738 | 738 |
$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
| 739 | 739 |
|
| 740 |
-$source = "select * from $table1 where {in $key1 2};";
|
|
| 740 |
+$source = "select * from $table1 where {in $key1 2}";
|
|
| 741 | 741 |
$query = $dbi->execute($source, {}, query => 1);
|
| 742 | 742 |
$result = $dbi->execute($query, param => {$key1 => [9, 1]});
|
| 743 | 743 |
$rows = $result->all; |
| ... | ... |
@@ -748,7 +748,7 @@ $dbi->delete_all(table => $table1); |
| 748 | 748 |
$insert_source = "insert into $table1 {insert_param $key1 $key2 $key3 $key4 $key5}";
|
| 749 | 749 |
$dbi->execute($insert_source, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
| 750 | 750 |
|
| 751 |
-$result = $dbi->execute("select * from $table1;");
|
|
| 751 |
+$result = $dbi->execute("select * from $table1");
|
|
| 752 | 752 |
$rows = $result->all; |
| 753 | 753 |
is_deeply($rows, [{$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5}], "basic");
|
| 754 | 754 |
|
| ... | ... |
@@ -761,7 +761,7 @@ $dbi->execute($insert_source, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key
|
| 761 | 761 |
$update_source = "update $table1 {update_param $key1 $key2 $key3 $key4} where {= $key5}";
|
| 762 | 762 |
$dbi->execute($update_source, param => {$key1 => 1, $key2 => 1, $key3 => 1, $key4 => 1, $key5 => 5});
|
| 763 | 763 |
|
| 764 |
-$result = $dbi->execute("select * from $table1 order by $key1;");
|
|
| 764 |
+$result = $dbi->execute("select * from $table1 order by $key1");
|
|
| 765 | 765 |
$rows = $result->all; |
| 766 | 766 |
is_deeply($rows, [{$key1 => 1, $key2 => 1, $key3 => 1, $key4 => 1, $key5 => 5},
|
| 767 | 767 |
{$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}], "basic");
|
| ... | ... |
@@ -831,7 +831,7 @@ eval { $dbi->execute("drop table $table1") };
|
| 831 | 831 |
$dbi->execute($create_table1); |
| 832 | 832 |
$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
| 833 | 833 |
$dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
| 834 |
-$result = $dbi->execute("select * from $table1;");
|
|
| 834 |
+$result = $dbi->execute("select * from $table1");
|
|
| 835 | 835 |
$rows = $result->all; |
| 836 | 836 |
is_deeply($rows, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}], "basic");
|
| 837 | 837 |
|
| ... | ... |
@@ -842,7 +842,7 @@ $dbi->register_filter( |
| 842 | 842 |
); |
| 843 | 843 |
$dbi->default_bind_filter('twice');
|
| 844 | 844 |
$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2}, filter => {$key1 => 'three_times'});
|
| 845 |
-$result = $dbi->execute("select * from $table1;");
|
|
| 845 |
+$result = $dbi->execute("select * from $table1");
|
|
| 846 | 846 |
$rows = $result->all; |
| 847 | 847 |
is_deeply($rows, [{$key1 => 3, $key2 => 4}], "filter");
|
| 848 | 848 |
$dbi->default_bind_filter(undef); |
| ... | ... |
@@ -871,7 +871,7 @@ eval { $dbi->execute("drop table $table1") };
|
| 871 | 871 |
$dbi->execute($create_table1); |
| 872 | 872 |
$dbi->insert({$key1 => 1, $key2 => 2}, table => $table1);
|
| 873 | 873 |
$dbi->insert({$key1 => 3, $key2 => 4}, table => $table1);
|
| 874 |
-$result = $dbi->execute("select * from $table1;");
|
|
| 874 |
+$result = $dbi->execute("select * from $table1");
|
|
| 875 | 875 |
$rows = $result->all; |
| 876 | 876 |
is_deeply($rows, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}], "basic");
|
| 877 | 877 |
|
| ... | ... |
@@ -879,7 +879,7 @@ eval { $dbi->execute("drop table $table1") };
|
| 879 | 879 |
$dbi->execute($create_table1); |
| 880 | 880 |
$dbi->insert(table => $table1, param => {$key1 => \"'1'", $key2 => 2});
|
| 881 | 881 |
$dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
| 882 |
-$result = $dbi->execute("select * from $table1;");
|
|
| 882 |
+$result = $dbi->execute("select * from $table1");
|
|
| 883 | 883 |
$rows = $result->all; |
| 884 | 884 |
is_deeply($rows, [{$key1 => 1, $key2 => 2}, {$key1 => 3, $key2 => 4}], "basic");
|
| 885 | 885 |
|
| ... | ... |
@@ -889,7 +889,7 @@ $dbi->execute($create_table1_2); |
| 889 | 889 |
$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
| 890 | 890 |
$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
| 891 | 891 |
$dbi->update(table => $table1, param => {$key2 => 11}, where => {$key1 => 1});
|
| 892 |
-$result = $dbi->execute("select * from $table1 order by $key1;");
|
|
| 892 |
+$result = $dbi->execute("select * from $table1 order by $key1");
|
|
| 893 | 893 |
$rows = $result->all; |
| 894 | 894 |
is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 3, $key4 => 4, $key5 => 5},
|
| 895 | 895 |
{$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}],
|
| ... | ... |
@@ -899,14 +899,14 @@ $dbi->execute("delete from $table1");
|
| 899 | 899 |
$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
| 900 | 900 |
$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
| 901 | 901 |
$dbi->update(table => $table1, param => {$key2 => 12}, where => {$key2 => 2, $key3 => 3});
|
| 902 |
-$result = $dbi->execute("select * from $table1 order by $key1;");
|
|
| 902 |
+$result = $dbi->execute("select * from $table1 order by $key1");
|
|
| 903 | 903 |
$rows = $result->all; |
| 904 | 904 |
is_deeply($rows, [{$key1 => 1, $key2 => 12, $key3 => 3, $key4 => 4, $key5 => 5},
|
| 905 | 905 |
{$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}],
|
| 906 | 906 |
"update key same as search key"); |
| 907 | 907 |
|
| 908 | 908 |
$dbi->update(table => $table1, param => {$key2 => [12]}, where => {$key2 => 2, $key3 => 3});
|
| 909 |
-$result = $dbi->execute("select * from $table1 order by $key1;");
|
|
| 909 |
+$result = $dbi->execute("select * from $table1 order by $key1");
|
|
| 910 | 910 |
$rows = $result->all; |
| 911 | 911 |
is_deeply($rows, [{$key1 => 1, $key2 => 12, $key3 => 3, $key4 => 4, $key5 => 5},
|
| 912 | 912 |
{$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}],
|
| ... | ... |
@@ -918,7 +918,7 @@ $dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $ke
|
| 918 | 918 |
$dbi->register_filter(twice => sub { $_[0] * 2 });
|
| 919 | 919 |
$dbi->update(table => $table1, param => {$key2 => 11}, where => {$key1 => 1},
|
| 920 | 920 |
filter => {$key2 => sub { $_[0] * 2 }});
|
| 921 |
-$result = $dbi->execute("select * from $table1 order by $key1;");
|
|
| 921 |
+$result = $dbi->execute("select * from $table1 order by $key1");
|
|
| 922 | 922 |
$rows = $result->all; |
| 923 | 923 |
is_deeply($rows, [{$key1 => 1, $key2 => 22, $key3 => 3, $key4 => 4, $key5 => 5},
|
| 924 | 924 |
{$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}],
|
| ... | ... |
@@ -1001,7 +1001,7 @@ $dbi->execute($create_table1_2); |
| 1001 | 1001 |
$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
| 1002 | 1002 |
$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
| 1003 | 1003 |
$dbi->update({$key2 => 11}, table => $table1, where => {$key1 => 1});
|
| 1004 |
-$result = $dbi->execute("select * from $table1 order by $key1;");
|
|
| 1004 |
+$result = $dbi->execute("select * from $table1 order by $key1");
|
|
| 1005 | 1005 |
$rows = $result->all; |
| 1006 | 1006 |
is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 3, $key4 => 4, $key5 => 5},
|
| 1007 | 1007 |
{$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}],
|
| ... | ... |
@@ -1012,7 +1012,7 @@ $dbi->execute($create_table1_2); |
| 1012 | 1012 |
$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $key4 => 4, $key5 => 5});
|
| 1013 | 1013 |
$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
| 1014 | 1014 |
$dbi->update(table => $table1, param => {$key2 => \"'11'"}, where => {$key1 => 1});
|
| 1015 |
-$result = $dbi->execute("select * from $table1 order by $key1;");
|
|
| 1015 |
+$result = $dbi->execute("select * from $table1 order by $key1");
|
|
| 1016 | 1016 |
$rows = $result->all; |
| 1017 | 1017 |
is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 3, $key4 => 4, $key5 => 5},
|
| 1018 | 1018 |
{$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}],
|
| ... | ... |
@@ -1025,7 +1025,7 @@ $dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2, $key3 => 3, $ke
|
| 1025 | 1025 |
$dbi->insert(table => $table1, param => {$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10});
|
| 1026 | 1026 |
$dbi->register_filter(twice => sub { $_[0] * 2 });
|
| 1027 | 1027 |
$dbi->update_all(table => $table1, param => {$key2 => 10}, filter => {$key2 => 'twice'});
|
| 1028 |
-$result = $dbi->execute("select * from $table1;");
|
|
| 1028 |
+$result = $dbi->execute("select * from $table1");
|
|
| 1029 | 1029 |
$rows = $result->all; |
| 1030 | 1030 |
is_deeply($rows, [{$key1 => 1, $key2 => 20, $key3 => 3, $key4 => 4, $key5 => 5},
|
| 1031 | 1031 |
{$key1 => 6, $key2 => 20, $key3 => 8, $key4 => 9, $key5 => 10}],
|
| ... | ... |
@@ -1038,16 +1038,16 @@ $dbi->execute($create_table1); |
| 1038 | 1038 |
$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
| 1039 | 1039 |
$dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
| 1040 | 1040 |
$dbi->delete(table => $table1, where => {$key1 => 1});
|
| 1041 |
-$result = $dbi->execute("select * from $table1;");
|
|
| 1041 |
+$result = $dbi->execute("select * from $table1");
|
|
| 1042 | 1042 |
$rows = $result->all; |
| 1043 | 1043 |
is_deeply($rows, [{$key1 => 3, $key2 => 4}], "basic");
|
| 1044 | 1044 |
|
| 1045 |
-$dbi->execute("delete from $table1;");
|
|
| 1045 |
+$dbi->execute("delete from $table1");
|
|
| 1046 | 1046 |
$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
| 1047 | 1047 |
$dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
| 1048 | 1048 |
$dbi->register_filter(twice => sub { $_[0] * 2 });
|
| 1049 | 1049 |
$dbi->delete(table => $table1, where => {$key2 => 1}, filter => {$key2 => 'twice'});
|
| 1050 |
-$result = $dbi->execute("select * from $table1;");
|
|
| 1050 |
+$result = $dbi->execute("select * from $table1");
|
|
| 1051 | 1051 |
$rows = $result->all; |
| 1052 | 1052 |
is_deeply($rows, [{$key1 => 3, $key2 => 4}], "filter");
|
| 1053 | 1053 |
|
| ... | ... |
@@ -1092,7 +1092,7 @@ eval { $dbi->execute("drop table $table1") };
|
| 1092 | 1092 |
$dbi->execute($create_table1); |
| 1093 | 1093 |
$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
| 1094 | 1094 |
$dbi->delete(table => $table1, where => {$key1 => 1}, prefix => ' ');
|
| 1095 |
-$result = $dbi->execute("select * from $table1;");
|
|
| 1095 |
+$result = $dbi->execute("select * from $table1");
|
|
| 1096 | 1096 |
$rows = $result->all; |
| 1097 | 1097 |
is_deeply($rows, [], "basic"); |
| 1098 | 1098 |
|
| ... | ... |
@@ -1123,7 +1123,7 @@ $dbi->execute($create_table1); |
| 1123 | 1123 |
$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
| 1124 | 1124 |
$dbi->insert(table => $table1, param => {$key1 => 3, $key2 => 4});
|
| 1125 | 1125 |
$dbi->delete_all(table => $table1); |
| 1126 |
-$result = $dbi->execute("select * from $table1;");
|
|
| 1126 |
+$result = $dbi->execute("select * from $table1");
|
|
| 1127 | 1127 |
$rows = $result->all; |
| 1128 | 1128 |
is_deeply($rows, [], "basic"); |
| 1129 | 1129 |
|
| ... | ... |
@@ -1237,7 +1237,7 @@ $dbi->execute($create_table1); |
| 1237 | 1237 |
{
|
| 1238 | 1238 |
local $Carp::Verbose = 0; |
| 1239 | 1239 |
eval{$dbi->execute("select * frm $table1")};
|
| 1240 |
- like($@, qr/\Qselect * frm $table1;/, "fail prepare"); |
|
| 1240 |
+ like($@, qr/\Qselect * frm $table1/, "fail prepare"); |
|
| 1241 | 1241 |
like($@, qr/\.t /, "fail : not verbose"); |
| 1242 | 1242 |
} |
| 1243 | 1243 |
{
|
| ... | ... |
@@ -1307,10 +1307,10 @@ test 'cache'; |
| 1307 | 1307 |
eval { $dbi->execute("drop table $table1") };
|
| 1308 | 1308 |
$dbi->cache(1); |
| 1309 | 1309 |
$dbi->execute($create_table1); |
| 1310 |
-$source = "select * from $table1 where $key1 = :$key1 and $key2 = :$key2;"; |
|
| 1310 |
+$source = "select * from $table1 where $key1 = :$key1 and $key2 = :$key2"; |
|
| 1311 | 1311 |
$dbi->execute($source, {}, query => 1);
|
| 1312 | 1312 |
is_deeply($dbi->{_cached}->{$source},
|
| 1313 |
- {sql => "select * from $table1 where $key1 = ? and $key2 = ?;", columns => [$key1, $key2], tables => []}, "cache");
|
|
| 1313 |
+ {sql => "select * from $table1 where $key1 = ? and $key2 = ?", columns => [$key1, $key2], tables => []}, "cache");
|
|
| 1314 | 1314 |
|
| 1315 | 1315 |
eval { $dbi->execute("drop table $table1") };
|
| 1316 | 1316 |
$dbi->execute($create_table1); |
| ... | ... |
@@ -1325,7 +1325,7 @@ $dbi->execute($create_table1); |
| 1325 | 1325 |
{
|
| 1326 | 1326 |
local $Carp::Verbose = 0; |
| 1327 | 1327 |
eval{$dbi->execute("select * frm $table1")};
|
| 1328 |
- like($@, qr/\Qselect * frm $table1;/, "fail prepare"); |
|
| 1328 |
+ like($@, qr/\Qselect * frm $table1/, "fail prepare"); |
|
| 1329 | 1329 |
like($@, qr/\.t /, "fail : not verbose"); |
| 1330 | 1330 |
} |
| 1331 | 1331 |
{
|
| ... | ... |
@@ -1384,7 +1384,7 @@ $dbi->apply_filter( |
| 1384 | 1384 |
$table1, $key1 => {out => 'twice', in => 'three_times'},
|
| 1385 | 1385 |
$key2 => {out => 'three_times', in => 'twice'});
|
| 1386 | 1386 |
$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
| 1387 |
-$result = $dbi->execute("select * from $table1;");
|
|
| 1387 |
+$result = $dbi->execute("select * from $table1");
|
|
| 1388 | 1388 |
$row = $result->fetch_hash_first; |
| 1389 | 1389 |
is_deeply($row, {$key1 => 2, $key2 => 6}, "insert");
|
| 1390 | 1390 |
$result = $dbi->select(table => $table1); |
| ... | ... |
@@ -1403,7 +1403,7 @@ $dbi->apply_filter( |
| 1403 | 1403 |
$table1, $key1 => {out => undef}
|
| 1404 | 1404 |
); |
| 1405 | 1405 |
$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2});
|
| 1406 |
-$result = $dbi->execute("select * from $table1;");
|
|
| 1406 |
+$result = $dbi->execute("select * from $table1");
|
|
| 1407 | 1407 |
$row = $result->one; |
| 1408 | 1408 |
is_deeply($row, {$key1 => 1, $key2 => 6}, "insert");
|
| 1409 | 1409 |
|
| ... | ... |
@@ -1416,7 +1416,7 @@ $dbi->apply_filter( |
| 1416 | 1416 |
); |
| 1417 | 1417 |
$dbi->insert(table => $table1, param => {$key1 => 1, $key2 => 2}, filter => {$key1 => undef});
|
| 1418 | 1418 |
$dbi->update(table => $table1, param => {$key1 => 2}, where => {$key2 => 2});
|
| 1419 |
-$result = $dbi->execute("select * from $table1;");
|
|
| 1419 |
+$result = $dbi->execute("select * from $table1");
|
|
| 1420 | 1420 |
$row = $result->one; |
| 1421 | 1421 |
is_deeply($row, {$key1 => 4, $key2 => 2}, "update");
|
| 1422 | 1422 |
|
| ... | ... |
@@ -1429,7 +1429,7 @@ $dbi->apply_filter( |
| 1429 | 1429 |
); |
| 1430 | 1430 |
$dbi->insert(table => $table1, param => {$key1 => 2, $key2 => 2}, filter => {$key1=> undef});
|
| 1431 | 1431 |
$dbi->delete(table => $table1, where => {$key1 => 1});
|
| 1432 |
-$result = $dbi->execute("select * from $table1;");
|
|
| 1432 |
+$result = $dbi->execute("select * from $table1");
|
|
| 1433 | 1433 |
$rows = $result->all; |
| 1434 | 1434 |
is_deeply($rows, [], "delete"); |
| 1435 | 1435 |
|
| ... | ... |
@@ -1454,7 +1454,7 @@ $dbi->apply_filter( |
| 1454 | 1454 |
$table1, $key1 => {out => 'twice', in => 'twice'}
|
| 1455 | 1455 |
); |
| 1456 | 1456 |
$dbi->insert(table => $table1, param => {$key1 => 2, $key2 => 2}, filter => {$key1 => undef});
|
| 1457 |
-$result = $dbi->execute("select * from $table1 where $key1 = :$key1 and $key2 = :$key2;",
|
|
| 1457 |
+$result = $dbi->execute("select * from $table1 where $key1 = :$key1 and $key2 = :$key2",
|
|
| 1458 | 1458 |
param => {$key1 => 1, $key2 => 2},
|
| 1459 | 1459 |
table => [$table1]); |
| 1460 | 1460 |
$rows = $result->all; |
| ... | ... |
@@ -1468,7 +1468,7 @@ $dbi->apply_filter( |
| 1468 | 1468 |
$table1, $key1 => {out => 'twice', in => 'twice'}
|
| 1469 | 1469 |
); |
| 1470 | 1470 |
$dbi->insert(table => $table1, param => {$key1 => 2, $key2 => 2}, filter => {$key1 => undef});
|
| 1471 |
-$result = $dbi->execute("select * from {table $table1} where $key1 = :$key1 and $key2 = :$key2;",
|
|
| 1471 |
+$result = $dbi->execute("select * from {table $table1} where $key1 = :$key1 and $key2 = :$key2",
|
|
| 1472 | 1472 |
param => {$key1 => 1, $key2 => 2});
|
| 1473 | 1473 |
$rows = $result->all; |
| 1474 | 1474 |
is_deeply($rows, [{$key1 => 4, $key2 => 2}], "execute table tag");
|
| ... | ... |
@@ -3125,10 +3125,10 @@ $dbi = DBIx::Custom->connect; |
| 3125 | 3125 |
eval { $dbi->execute("drop table $table1") };
|
| 3126 | 3126 |
$dbi->execute($create_table1); |
| 3127 | 3127 |
$dbi->execute("select * from $table1");
|
| 3128 |
-is($dbi->last_sql, "select * from $table1;"); |
|
| 3128 |
+is($dbi->last_sql, "select * from $table1"); |
|
| 3129 | 3129 |
|
| 3130 | 3130 |
eval{$dbi->execute("aaa")};
|
| 3131 |
-is($dbi->last_sql, 'aaa;'); |
|
| 3131 |
+is($dbi->last_sql, 'aaa'); |
|
| 3132 | 3132 |
|
| 3133 | 3133 |
test 'DBIx::Custom header'; |
| 3134 | 3134 |
$dbi = DBIx::Custom->connect; |
| ... | ... |
@@ -3264,13 +3264,13 @@ $datas = [ |
| 3264 | 3264 |
# Basic tests |
| 3265 | 3265 |
{ name => 'placeholder basic',
|
| 3266 | 3266 |
source => "a {? k1} b {= k2} {<> k3} {> k4} {< k5} {>= k6} {<= k7} {like k8}", ,
|
| 3267 |
- sql_expected => "a ? b k2 = ? k3 <> ? k4 > ? k5 < ? k6 >= ? k7 <= ? k8 like ?;", |
|
| 3267 |
+ sql_expected => "a ? b k2 = ? k3 <> ? k4 > ? k5 < ? k6 >= ? k7 <= ? k8 like ?", |
|
| 3268 | 3268 |
columns_expected => [qw/k1 k2 k3 k4 k5 k6 k7 k8/] |
| 3269 | 3269 |
}, |
| 3270 | 3270 |
{
|
| 3271 | 3271 |
name => 'placeholder in', |
| 3272 |
- source => "{in k1 3};",
|
|
| 3273 |
- sql_expected => "k1 in (?, ?, ?);", |
|
| 3272 |
+ source => "{in k1 3}",
|
|
| 3273 |
+ sql_expected => "k1 in (?, ?, ?)", |
|
| 3274 | 3274 |
columns_expected => [qw/k1 k1 k1/] |
| 3275 | 3275 |
}, |
| 3276 | 3276 |
|
| ... | ... |
@@ -3278,19 +3278,19 @@ $datas = [ |
| 3278 | 3278 |
{
|
| 3279 | 3279 |
name => 'placeholder with table name', |
| 3280 | 3280 |
source => "{= a.k1} {= a.k2}",
|
| 3281 |
- sql_expected => "a.k1 = ? a.k2 = ?;", |
|
| 3281 |
+ sql_expected => "a.k1 = ? a.k2 = ?", |
|
| 3282 | 3282 |
columns_expected => [qw/a.k1 a.k2/] |
| 3283 | 3283 |
}, |
| 3284 | 3284 |
{
|
| 3285 | 3285 |
name => 'placeholder in with table name', |
| 3286 | 3286 |
source => "{in a.k1 2} {in b.k2 2}",
|
| 3287 |
- sql_expected => "a.k1 in (?, ?) b.k2 in (?, ?);", |
|
| 3287 |
+ sql_expected => "a.k1 in (?, ?) b.k2 in (?, ?)", |
|
| 3288 | 3288 |
columns_expected => [qw/a.k1 a.k1 b.k2 b.k2/] |
| 3289 | 3289 |
}, |
| 3290 | 3290 |
{
|
| 3291 | 3291 |
name => 'not contain tag', |
| 3292 | 3292 |
source => "aaa", |
| 3293 |
- sql_expected => "aaa;", |
|
| 3293 |
+ sql_expected => "aaa", |
|
| 3294 | 3294 |
columns_expected => [], |
| 3295 | 3295 |
} |
| 3296 | 3296 |
]; |
| ... | ... |
@@ -3317,7 +3317,7 @@ $dbi->register_tag( |
| 3317 | 3317 |
); |
| 3318 | 3318 |
|
| 3319 | 3319 |
$query = $builder->build_query("{p a b}");
|
| 3320 |
-is($query->{sql}, "? a b;", "register_tag sql");
|
|
| 3320 |
+is($query->{sql}, "? a b", "register_tag sql");
|
|
| 3321 | 3321 |
is_deeply($query->{columns}, [2], "register_tag columns");
|
| 3322 | 3322 |
|
| 3323 | 3323 |
eval{$builder->build_query('{? }')};
|
| ... | ... |
@@ -3377,21 +3377,21 @@ like($@, qr/\QColumn name and count of values must be specified in tag "{in }"/,
|
| 3377 | 3377 |
"in : key not exist"); |
| 3378 | 3378 |
|
| 3379 | 3379 |
test 'variouse source'; |
| 3380 |
-$source = "a {= b} c \\{ \\} {= \\{} {= \\}} d;";
|
|
| 3380 |
+$source = "a {= b} c \\{ \\} {= \\{} {= \\}} d";
|
|
| 3381 | 3381 |
$query = $builder->build_query($source); |
| 3382 |
-is($query->sql, 'a b = ? c { } { = ? } = ? d;', "basic : 1");
|
|
| 3382 |
+is($query->sql, 'a b = ? c { } { = ? } = ? d', "basic : 1");
|
|
| 3383 | 3383 |
|
| 3384 |
-$source = "abc;"; |
|
| 3384 |
+$source = "abc"; |
|
| 3385 | 3385 |
$query = $builder->build_query($source); |
| 3386 |
-is($query->sql, 'abc;', "basic : 2"); |
|
| 3386 |
+is($query->sql, 'abc', "basic : 2"); |
|
| 3387 | 3387 |
|
| 3388 | 3388 |
$source = "{= a}";
|
| 3389 | 3389 |
$query = $builder->build_query($source); |
| 3390 |
-is($query->sql, 'a = ?;', "only tag"); |
|
| 3390 |
+is($query->sql, 'a = ?', "only tag"); |
|
| 3391 | 3391 |
|
| 3392 |
-$source = "000;"; |
|
| 3392 |
+$source = "000"; |
|
| 3393 | 3393 |
$query = $builder->build_query($source); |
| 3394 |
-is($query->sql, '000;', "contain 0 value"); |
|
| 3394 |
+is($query->sql, '000', "contain 0 value"); |
|
| 3395 | 3395 |
|
| 3396 | 3396 |
$source = "a {= b} }";
|
| 3397 | 3397 |
eval{$builder->build_query($source)};
|
| ... | ... |
@@ -3456,8 +3456,8 @@ $dbi->execute($create_table1); |
| 3456 | 3456 |
eval { $dbi->execute("drop table $table2") };
|
| 3457 | 3457 |
$dbi->execute($create_table2); |
| 3458 | 3458 |
$dbi->setup_model; |
| 3459 |
-$dbi->execute("insert into $table1 ($key1, $key2) values (1, 2);");
|
|
| 3460 |
-$dbi->execute("insert into $table2 ($key1, $key3) values (1, 4);");
|
|
| 3459 |
+$dbi->execute("insert into $table1 ($key1, $key2) values (1, 2)");
|
|
| 3460 |
+$dbi->execute("insert into $table2 ($key1, $key3) values (1, 4)");
|
|
| 3461 | 3461 |
$model = $dbi->model($table1); |
| 3462 | 3462 |
$result = $model->select( |
| 3463 | 3463 |
column => [ |
| ... | ... |
@@ -3548,7 +3548,7 @@ update $table1 $update_param |
| 3548 | 3548 |
where $key1 = 1 |
| 3549 | 3549 |
EOS |
| 3550 | 3550 |
$dbi->execute($sql, param => $param); |
| 3551 |
-$result = $dbi->execute("select * from $table1 order by $key1;", table => $table1);
|
|
| 3551 |
+$result = $dbi->execute("select * from $table1 order by $key1", table => $table1);
|
|
| 3552 | 3552 |
$rows = $result->all; |
| 3553 | 3553 |
is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 3, $key4 => 4, $key5 => 5},
|
| 3554 | 3554 |
{$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}],
|
| ... | ... |
@@ -3568,7 +3568,7 @@ update $table1 $update_param |
| 3568 | 3568 |
where $key1 = 1 |
| 3569 | 3569 |
EOS |
| 3570 | 3570 |
$dbi->execute($sql, param => $param); |
| 3571 |
-$result = $dbi->execute("select * from $table1 order by $key1;", table => $table1);
|
|
| 3571 |
+$result = $dbi->execute("select * from $table1 order by $key1", table => $table1);
|
|
| 3572 | 3572 |
$rows = $result->all; |
| 3573 | 3573 |
is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 33, $key4 => 4, $key5 => 5},
|
| 3574 | 3574 |
{$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}],
|
| ... | ... |
@@ -3587,7 +3587,7 @@ update $table1 set $update_param |
| 3587 | 3587 |
where $key1 = 1 |
| 3588 | 3588 |
EOS |
| 3589 | 3589 |
$dbi->execute($sql, param => $param); |
| 3590 |
-$result = $dbi->execute("select * from $table1 order by $key1;", table => $table1);
|
|
| 3590 |
+$result = $dbi->execute("select * from $table1 order by $key1", table => $table1);
|
|
| 3591 | 3591 |
$rows = $result->all; |
| 3592 | 3592 |
is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 33, $key4 => 4, $key5 => 5},
|
| 3593 | 3593 |
{$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}],
|
| ... | ... |
@@ -3612,7 +3612,7 @@ update $table1 set $update_param |
| 3612 | 3612 |
where $key1 = 1 |
| 3613 | 3613 |
EOS |
| 3614 | 3614 |
$dbi->execute($sql, param => $param, table => $table1); |
| 3615 |
-$result = $dbi->execute("select * from $table1 order by $key1;");
|
|
| 3615 |
+$result = $dbi->execute("select * from $table1 order by $key1");
|
|
| 3616 | 3616 |
$rows = $result->all; |
| 3617 | 3617 |
is_deeply($rows, [{$key1 => 1, $key2 => 11, $key3 => 3, $key4 => 4, $key5 => 5},
|
| 3618 | 3618 |
{$key1 => 6, $key2 => 7, $key3 => 8, $key4 => 9, $key5 => 10}],
|
| ... | ... |
@@ -3628,7 +3628,7 @@ eval { $dbi->execute("drop table $table2") };
|
| 3628 | 3628 |
$dbi->execute($create_table2); |
| 3629 | 3629 |
$dbi->insert(table => $table2, param => {$key1 => 1, $key3 => 5});
|
| 3630 | 3630 |
eval { $dbi->execute("drop table $table3") };
|
| 3631 |
-$dbi->execute("create table $table3 ($key3 int, $key4 int);");
|
|
| 3631 |
+$dbi->execute("create table $table3 ($key3 int, $key4 int)");
|
|
| 3632 | 3632 |
$dbi->insert(table => $table3, param => {$key3 => 5, $key4 => 4});
|
| 3633 | 3633 |
$rows = $dbi->select( |
| 3634 | 3634 |
table => $table1, |