From: Norbert Buchmuller Date: Wed, 11 Feb 2009 14:51:00 +0000 (+0000) Subject: Added test cases to test the arrayref (\[$sql, @bind]) support if @bind is empty. X-Git-Tag: v1.70~239 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ef4d99a5581ca600bd53f881b04ecda14e413e89;p=dbsrgits%2FSQL-Abstract.git Added test cases to test the arrayref (\[$sql, @bind]) support if @bind is empty. --- diff --git a/t/01generate.t b/t/01generate.t index 0e955aa..b841181 100644 --- a/t/01generate.t +++ b/t/01generate.t @@ -370,6 +370,38 @@ my @tests = ( bind => [qw/1 2 3 4/, { answer => 42}], warning_like => qr/HASH ref as bind value in insert is not supported/i, }, + #40 + { + func => 'update', + args => ['test', {a => 1, b => \["42"]}, {a => {'between', [1,2]}}], + stmt => 'UPDATE test SET a = ?, b = 42 WHERE ( a BETWEEN ? AND ? )', + stmt_q => 'UPDATE `test` SET `a` = ?, `b` = 42 WHERE ( `a` BETWEEN ? AND ? )', + bind => [qw(1 1 2)], + }, + #41 + { + func => 'insert', + args => ['test', {a => 1, b => \["42"]}], + stmt => 'INSERT INTO test (a, b) VALUES (?, 42)', + stmt_q => 'INSERT INTO `test` (`a`, `b`) VALUES (?, 42)', + bind => [qw(1)], + }, + #42 + { + func => 'select', + args => ['test', '*', { a => \["= 42"], b => 1}], + stmt => q{SELECT * FROM test WHERE ( a = 42 ) AND (b = ? )}, + stmt_q => q{SELECT * FROM `test` WHERE ( `a` = 42 ) AND ( `b` = ? )}, + bind => [qw(1)], + }, + #43 + { + func => 'select', + args => ['test', '*', { a => {'<' => \["42"]}, b => 8 }], + stmt => 'SELECT * FROM test WHERE ( a < 42 AND b = ? )', + stmt_q => 'SELECT * FROM `test` WHERE ( `a` < 42 AND `b` = ? )', + bind => [qw(8)], + }, );