Showing 4 changed files with 21 additions and 14 deletions
+2
Changes
... ...
@@ -1,3 +1,5 @@
1
+0.1710
2
+    - Fixed fisrt where clause failed.
1 3
 0.1709
2 4
     - fixed named placeholder bug and added escape syntax
3 5
 0.1708
+1 -2
lib/DBIx/Custom.pm
... ...
@@ -1078,9 +1078,8 @@ sub where {
1078 1078
     
1079 1079
     # Create where
1080 1080
     return DBIx::Custom::Where->new(
1081
-        query_builder => $self->query_builder,
1082
-        safety_character => $self->safety_character,
1083 1081
         quote => $self->_quote,
1082
+        dbi => $self,
1084 1083
         @_
1085 1084
     );
1086 1085
 }
+9 -5
lib/DBIx/Custom/QueryBuilder.pm
... ...
@@ -306,6 +306,15 @@ DBIx::Custom::QueryBuilder - Query builder
306 306
         "select from table title = :title and author = :author"
307 307
     );
308 308
 
309
+=head1 ATTRIBUTES
310
+
311
+=head2 C<dbi>
312
+
313
+    my $dbi = $builder->dbi;
314
+    $builder = $builder->dbi($dbi);
315
+
316
+L<DBIx::Custom> object.
317
+
309 318
 =head1 METHODS
310 319
 
311 320
 L<DBIx::Custom::QueryBuilder> inherits all methods from L<Object::Simple>
... ...
@@ -317,9 +326,4 @@ and implements the following new ones.
317 326
 
318 327
 Create a new L<DBIx::Custom::Query> object from SQL source.
319 328
 
320
-=head2 C<dbi>
321
-
322
-    my $dbi = $builder->dbi;
323
-    $builder = $builder->dbi($dbi);
324
-
325 329
 =cut
+9 -7
lib/DBIx/Custom/Where.pm
... ...
@@ -9,7 +9,7 @@ use overload '""' => sub { shift->to_string }, fallback => 1;
9 9
 # Carp trust relationship
10 10
 push @DBIx::Custom::CARP_NOT, __PACKAGE__;
11 11
 
12
-has [qw/param query_builder quote safety_character /],
12
+has [qw/dbi param quote/],
13 13
     clause => sub { [] };
14 14
 
15 15
 sub new {
... ...
@@ -29,7 +29,7 @@ sub to_string {
29 29
     my $self = shift;
30 30
     
31 31
     # Check if column name is safety character;
32
-    my $safety = $self->safety_character;
32
+    my $safety = $self->dbi->safety_character;
33 33
     if (ref $self->param eq 'HASH') {
34 34
         foreach my $column (keys %{$self->param}) {
35 35
             croak qq{"$column" is not safety column name (} . _subname . ")"
... ...
@@ -93,7 +93,7 @@ sub _parse {
93 93
         my $pushed;
94 94
         
95 95
         # Column
96
-        my $columns = $self->query_builder->build_query($clause)->columns;
96
+        my $columns = $self->dbi->query_builder->build_query($clause)->columns;
97 97
         if (@$columns == 0) {
98 98
             push @$where, $clause;
99 99
             $pushed = 1;
... ...
@@ -112,7 +112,7 @@ sub _parse {
112 112
         }
113 113
         
114 114
         # Check safety
115
-        my $safety = $self->safety_character;
115
+        my $safety = $self->dbi->safety_character;
116 116
         croak qq{"$column" is not safety column name (} . _subname . ")"
117 117
           unless $column =~ /^[$safety\.]+$/;
118 118
         
... ...
@@ -183,10 +183,12 @@ If all parameter names is exists.
183 183
         date => ['2010-11-11', '2011-03-05'],
184 184
     });
185 185
 
186
-=head2 C<safety_character>
186
+=head2 C<dbi>
187 187
 
188
-    my $safety_character = $self->safety_character;
189
-    $where = $self->safety_character("\w");
188
+    my $dbi = $where->dbi;
189
+    $where = $where->dbi($dbi);
190
+
191
+L<DBIx::Custom> object.
190 192
 
191 193
 =head1 METHODS
192 194