... | ... |
@@ -1,3 +1,6 @@ |
1 |
+0.1615 |
|
2 |
+ fixed DBIx::Custom::QueryBuilder build_query() bug |
|
3 |
+ required Perl 5.008001 to use @CARP_NOT |
|
1 | 4 |
0.1614 |
2 | 5 |
removed DBIx::Custom::Query start_tag and end tag attributes |
3 | 6 |
enable escaping '{' and '}' in the source of SQL |
... | ... |
@@ -1,5 +1,8 @@ |
1 | 1 |
package DBIx::Custom; |
2 | 2 |
|
3 |
+our $VERSION = '0.1615'; |
|
4 |
+ |
|
5 |
+use 5.008001; |
|
3 | 6 |
use strict; |
4 | 7 |
use warnings; |
5 | 8 |
|
... | ... |
@@ -498,14 +501,12 @@ sub AUTOLOAD { |
498 | 501 |
return $self->methods->{$method}->($self, @_); |
499 | 502 |
} |
500 | 503 |
|
504 |
+1; |
|
505 |
+ |
|
501 | 506 |
=head1 NAME |
502 | 507 |
|
503 | 508 |
DBIx::Custom - DBI interface, having hash parameter binding and filtering system |
504 | 509 |
|
505 |
-=cut |
|
506 |
- |
|
507 |
-our $VERSION = '0.1614'; |
|
508 |
- |
|
509 | 510 |
=head1 STABILITY |
510 | 511 |
|
511 | 512 |
B<This module is not stable>. |
... | ... |
@@ -68,11 +68,14 @@ sub _parse { |
68 | 68 |
my $before = ''; |
69 | 69 |
|
70 | 70 |
# Position |
71 |
- my $pos; |
|
71 |
+ my $pos = 0; |
|
72 | 72 |
|
73 | 73 |
# Parse |
74 | 74 |
my $original = $source; |
75 |
- while (my $c = substr($source, 0, 1, '')) { |
|
75 |
+ while (defined(my $c = substr($source, $pos, 1))) { |
|
76 |
+ |
|
77 |
+ # Last |
|
78 |
+ last unless length $c; |
|
76 | 79 |
|
77 | 80 |
# State is text |
78 | 81 |
if ($state eq 'text') { |
... | ... |
@@ -147,15 +147,19 @@ like($@, qr/\QColumn name and count of values must be specified in tag "{in }"/, |
147 | 147 |
test 'variouse source'; |
148 | 148 |
$source = "a {= b} c \\{ \\} {= \\{} {= \\}} d;"; |
149 | 149 |
$query = $builder->build_query($source); |
150 |
-is($query->sql, 'a b = ? c { } { = ? } = ? d;', "$test : 1"); |
|
150 |
+is($query->sql, 'a b = ? c { } { = ? } = ? d;', "$test : basic : 1"); |
|
151 | 151 |
|
152 | 152 |
$source = "abc;"; |
153 | 153 |
$query = $builder->build_query($source); |
154 |
-is($query->sql, 'abc;', "$test : 2"); |
|
154 |
+is($query->sql, 'abc;', "$test : basic : 2"); |
|
155 | 155 |
|
156 | 156 |
$source = "{= a}"; |
157 | 157 |
$query = $builder->build_query($source); |
158 |
-is($query->sql, 'a = ?;', "$test : 3"); |
|
158 |
+is($query->sql, 'a = ?;', "$test : only tag"); |
|
159 |
+ |
|
160 |
+$source = "000;"; |
|
161 |
+$query = $builder->build_query($source); |
|
162 |
+is($query->sql, '000;', "$test : contain 0 value"); |
|
159 | 163 |
|
160 | 164 |
$source = "a {= b} }"; |
161 | 165 |
eval{$builder->build_query($source)}; |
... | ... |
@@ -165,3 +169,4 @@ $source = "a {= {}"; |
165 | 169 |
eval{$builder->build_query($source)}; |
166 | 170 |
like($@, qr/unexpected "{"/, "$test : error : 2"); |
167 | 171 |
|
172 |
+ |