allow coderef in place of SQL for complex commands
[dbsrgits/DBIx-Data-Store.git] / t / crud.t
index bf762b5..71214c1 100644 (file)
--- a/t/crud.t
+++ b/t/crud.t
@@ -46,7 +46,11 @@ sub make_store {
       select_all => 'SELECT id, name FROM names',
       delete_all => 'DELETE FROM names',
       select_one => 'SELECT id, name FROM names WHERE id = ?',
-      insert_one => 'INSERT INTO names (name) VALUES (?)',# RETURNING (id)',
+      insert_one => sub {
+        my ($store, undef, $dbh, $args) = @_;
+        $store->_sth_for($dbh, 'INSERT INTO names (name) VALUES (?)', $args);
+        [ $dbh->last_insert_id(undef,undef,undef,undef) ];
+      },
       update_one => 'UPDATE names SET name = ? WHERE id = ?',
       delete_one => 'DELETE FROM names WHERE id = ?',
     },