},
{
func => 'insert',
- args => ['test', [qw/1 2 3 4 5/]],
- stmt => 'INSERT INTO test VALUES (?, ?, ?, ?, ?)',
- stmt_q => 'INSERT INTO `test` VALUES (?, ?, ?, ?, ?)',
- bind => [qw/1 2 3 4 5/],
+ args => ['test', [1..30]],
+ stmt => 'INSERT INTO test VALUES ('.join(', ', ('?')x30).')',
+ stmt_q => 'INSERT INTO `test` VALUES ('.join(', ', ('?')x30).')',
+ bind => [1..30],
},
{
func => 'insert',
esc => '\\',
bind => [],
},
+ {
+ func => 'update',
+ args => ['mytable', { foo => 42 }, { baz => 32 }, { returning => 'id' }],
+ stmt => 'UPDATE mytable SET foo = ? WHERE baz = ? RETURNING id',
+ stmt_q => 'UPDATE `mytable` SET `foo` = ? WHERE `baz` = ? RETURNING `id`',
+ bind => [42, 32],
+ },
+ {
+ func => 'update',
+ args => ['mytable', { foo => 42 }, { baz => 32 }, { returning => \'*' }],
+ stmt => 'UPDATE mytable SET foo = ? WHERE baz = ? RETURNING *',
+ stmt_q => 'UPDATE `mytable` SET `foo` = ? WHERE `baz` = ? RETURNING *',
+ bind => [42, 32],
+ },
+ {
+ func => 'update',
+ args => ['mytable', { foo => 42 }, { baz => 32 }, { returning => ['id','created_at'] }],
+ stmt => 'UPDATE mytable SET foo = ? WHERE baz = ? RETURNING id, created_at',
+ stmt_q => 'UPDATE `mytable` SET `foo` = ? WHERE `baz` = ? RETURNING `id`, `created_at`',
+ bind => [42, 32],
+ },
+ {
+ func => 'delete',
+ args => ['test', {requestor => undef}, {returning => 'id'}],
+ stmt => 'DELETE FROM test WHERE ( requestor IS NULL ) RETURNING id',
+ stmt_q => 'DELETE FROM `test` WHERE ( `requestor` IS NULL ) RETURNING `id`',
+ bind => []
+ },
+ {
+ func => 'delete',
+ args => ['test', {requestor => undef}, {returning => \'*'}],
+ stmt => 'DELETE FROM test WHERE ( requestor IS NULL ) RETURNING *',
+ stmt_q => 'DELETE FROM `test` WHERE ( `requestor` IS NULL ) RETURNING *',
+ bind => []
+ },
+ {
+ func => 'delete',
+ args => ['test', {requestor => undef}, {returning => ['id', 'created_at']}],
+ stmt => 'DELETE FROM test WHERE ( requestor IS NULL ) RETURNING id, created_at',
+ stmt_q => 'DELETE FROM `test` WHERE ( `requestor` IS NULL ) RETURNING `id`, `created_at`',
+ bind => []
+ },
);
# check is( not) => undef