Showing 2 changed files with 10 additions and 5 deletions
+1 -2
lib/DBIx/Custom.pm
... ...
@@ -51,7 +51,7 @@ has [qw/connector dsn password quote user/],
51 51
     },
52 52
     last_sql => '',
53 53
     models => sub { {} },
54
-    query_builder => sub { DBIx::Custom::QueryBuilder->new(_dbi => shift) },
54
+    query_builder => sub { DBIx::Custom::QueryBuilder->new(dbi => shift) },
55 55
     result_class  => 'DBIx::Custom::Result',
56 56
     safety_character => '\w',
57 57
     stash => sub { {} },
... ...
@@ -1113,7 +1113,6 @@ sub _create_query {
1113 1113
 
1114 1114
         # Create query
1115 1115
         my $builder = $self->query_builder;
1116
-        $builder->{_tag_parse} = $self->tag_parse;
1117 1116
         $query = $builder->build_query($source);
1118 1117
 
1119 1118
         # Remove reserved word quote
+9 -3
lib/DBIx/Custom/QueryBuilder.pm
... ...
@@ -10,14 +10,15 @@ use DBIx::Custom::Util '_subname';
10 10
 push @DBIx::Custom::CARP_NOT, __PACKAGE__;
11 11
 push @DBIx::Custom::Where::CARP_NOT, __PACKAGE__;
12 12
 
13
+has 'dbi';
14
+
13 15
 sub build_query {
14 16
     my ($self, $source) = @_;
15 17
     
16 18
     my $query;
17 19
     
18 20
     # Parse tag. tag is DEPRECATED!
19
-    $self->{_tag_parse} = 1 unless defined $self->{_tag_parse};
20
-    if ($self->{_tag_parse} && $source =~ /(\s|^)\{/) {
21
+    if ($self->dbi->tag_parse && $source =~ /(\s|^)\{/) {
21 22
         $query = $self->_parse_tag($source);
22 23
         my $tag_count = delete $query->{tag_count};
23 24
         warn qq/Tag system such as {? name} is DEPRECATED! / .
... ...
@@ -70,7 +71,7 @@ sub _parse_parameter {
70 71
     # Get and replace parameters
71 72
     my $sql = $source || '';
72 73
     my $columns = [];
73
-    my $c = $self->{_dbi}->safety_character;
74
+    my $c = $self->dbi->safety_character;
74 75
     # Parameter regex
75 76
     $sql =~ s/([^:]):(\d+):([^:])/$1\\:$2\\:$3/g;
76 77
     my $re = qr/(^|.*?[^\\]):([$c\.]+)(?:\{(.*?)\})?(.*)/s;
... ...
@@ -316,4 +317,9 @@ and implements the following new ones.
316 317
 
317 318
 Create a new L<DBIx::Custom::Query> object from SQL source.
318 319
 
320
+=head2 C<dbi>
321
+
322
+    my $dbi = $builder->dbi;
323
+    $builder = $builder->dbi($dbi);
324
+
319 325
 =cut