allow coderef in place of SQL for complex commands
[dbsrgits/DBIx-Data-Store.git] / lib / DBIx / Data / Store / Raw.pm
index 82885a9..9a5b269 100644 (file)
@@ -33,10 +33,15 @@ sub run_rowstream {
 }
 
 sub _exec_calling {
-  my ($self, $call, @sth_args) = @_;
-  $self->_exec(sub {
-    $self->_sth_for($_[0], @sth_args)->$call
-  });
+  my ($self, $sth_method, $to_call, $sth_args) = @_;
+  
+  $self->_exec(
+    ref($to_call) eq 'CODE'
+      ? sub { $self->$to_call($sth_method, $_[0], $sth_args) }
+      : sub {
+          $self->_sth_for($_[0], $to_call, $sth_args)->$sth_method
+        }
+  );
 }
 
 sub _exec {