add support for hashrefs in insert
[dbsrgits/SQL-Abstract.git] / t / 01generate.t
index ebe3aad..dd72def 100644 (file)
@@ -323,7 +323,7 @@ my @tests = (
               stmt   => 'INSERT INTO test (a, b, c, d, e) VALUES (?, ?, ?, ?, ?)',
               stmt_q => 'INSERT INTO `test` (`a`, `b`, `c`, `d`, `e`) VALUES (?, ?, ?, ?, ?)',
               bind   => [qw/1 2 3 4/, { answer => 42}],
-              warns  => qr/HASH ref as bind value in insert is not supported/i,
+              warns  => qr/use -value/i,
       },
       {
               func   => 'update',
@@ -486,6 +486,13 @@ my @tests = (
       },
       {
               func   => 'insert',
+              args   => ['test', [ { -value => { foo => 'bar' } } ] ],
+              stmt   => 'INSERT INTO test VALUES (?)',
+              stmt_q => 'INSERT INTO `test` VALUES (?)',
+              bind   => [ { foo => 'bar' } ],
+      },
+      {
+              func   => 'insert',
               args   => ['test', [qw/1 2 3 4 5/], { returning => 'id' }],
               stmt   => 'INSERT INTO test VALUES (?, ?, ?, ?, ?) RETURNING id',
               stmt_q => 'INSERT INTO `test` VALUES (?, ?, ?, ?, ?) RETURNING `id`',