Showing 1 changed files with 9 additions and 11 deletions
+9 -11
lib/DBIx/Custom.pm
... ...
@@ -1088,28 +1088,26 @@ sub values_clause {
1088 1088
     my $wrap = $opts->{wrap} || {};
1089 1089
     
1090 1090
     # Create insert parameter tag
1091
-    my $safety = $self->safety_character;
1091
+    my $safety = $self->{safety_character} || $self->safety_character;
1092 1092
     my @columns;
1093 1093
     my @placeholders;
1094 1094
     my $qp = $self->_q('');
1095 1095
     my $q = substr($qp, 0, 1) || '';
1096 1096
     my $p = substr($qp, 1, 1) || '';
1097 1097
     
1098
+    my $safety_re = qr/^[$safety\.]+$/;
1098 1099
     for my $column (sort keys %$param) {
1099 1100
         croak qq{"$column" is not safety column name } . _subname
1100
-          unless $column =~ /^[$safety\.]+$/;
1101
-        my $column_quote = "$q$column$p";
1102
-        $column_quote =~ s/\./$p.$q/;
1103
-        push @columns, $column_quote;
1104
-        
1105
-        my $func = $wrap->{$column} || sub { $_[0] };
1101
+          unless $column =~ /$safety_re/;
1102
+        push @columns, "$q$column$p";
1106 1103
         push @placeholders,
1107
-          ref $param->{$column} eq 'SCALAR' ? ${$param->{$column}}
1108
-        : $func->(":$column");
1104
+          ref $param->{$column} eq 'SCALAR' ? ${$param->{$column}} :
1105
+          $wrap->{$column} ? $wrap->{$column}->(":$column") :
1106
+          ":$column"
1109 1107
     }
1110 1108
     
1111
-    return '(' . join(', ', @columns) . ') ' . 'values ' .
1112
-           '(' . join(', ', @placeholders) . ')'
1109
+    '(' . join(', ', @columns) . ') ' . 'values ' .
1110
+      '(' . join(', ', @placeholders) . ')'
1113 1111
 }
1114 1112
 
1115 1113
 sub where { DBIx::Custom::Where->new(dbi => shift, @_) }