Note that you must pass the bind values in the same format as they are returned
by C</where>. That means that if you set L</bindtype> to C<columns>, you must
-provide the bind values in the C<< [ column_name => value ] >> format, so eg.
-the above example will look like:
+provide the bind values in the C<< [ column_meta => value ] >> format, where
+C<column_meta> is an opaque scalar value; most commonly the column name, but
+you can use any scalar scalar value (including references and blessed
+references), L<SQL::Abstract> will simply pass it through intact. So eg. the
+above example will look like:
my %where = (
date_column => \[q/= date '2008-09-30' - ?::integer/, [ dummy => 10 ]/]
args => ['test', '*', { a => {-in => \["(SELECT d FROM to_date(?, 'MM/DD/YY') AS d)", '02/02/02']}, b => 8 }],
exception_like => qr/bindtype 'columns' selected, you need to pass: \[column_name => bind_value\]/,
},
+ #53
+ {
+ func => 'insert',
+ new => {bindtype => 'columns'},
+ args => ['test', {a => 1, b => \["to_date(?, 'MM/DD/YY')", [{dummy => 1} => '02/02/02']]}],
+ stmt => 'INSERT INTO test (a, b) VALUES (?, to_date(?, \'MM/DD/YY\'))',
+ stmt_q => 'INSERT INTO `test` (`a`, `b`) VALUES (?, to_date(?, \'MM/DD/YY\'))',
+ bind => [[a => '1'], [{dummy => 1} => '02/02/02']],
+ },
+ #54
+ {
+ func => 'update',
+ new => {bindtype => 'columns'},
+ args => ['test', {a => 1, b => \["to_date(?, 'MM/DD/YY')", [{dummy => 1} => '02/02/02']]}, {a => {'between', [1,2]}}],
+ stmt => 'UPDATE test SET a = ?, b = to_date(?, \'MM/DD/YY\') WHERE ( a BETWEEN ? AND ? )',
+ stmt_q => 'UPDATE `test` SET `a` = ?, `b` = to_date(?, \'MM/DD/YY\') WHERE ( `a` BETWEEN ? AND ? )',
+ bind => [[a => '1'], [{dummy => 1} => '02/02/02'], [a => '1'], [a => '2']],
+ },
+ #55
+ {
+ func => 'select',
+ new => {bindtype => 'columns'},
+ args => ['test', '*', { a => \["= to_date(?, 'MM/DD/YY')", [{dummy => 1} => '02/02/02']]}],
+ stmt => q{SELECT * FROM test WHERE ( a = to_date(?, 'MM/DD/YY') )},
+ stmt_q => q{SELECT * FROM `test` WHERE ( `a` = to_date(?, 'MM/DD/YY') )},
+ bind => [[{dummy => 1} => '02/02/02']],
+ },
+ #56
+ {
+ func => 'select',
+ new => {bindtype => 'columns'},
+ args => ['test', '*', { a => {'<' => \["to_date(?, 'MM/DD/YY')", [{dummy => 1} => '02/02/02']]}, b => 8 }],
+ stmt => 'SELECT * FROM test WHERE ( a < to_date(?, \'MM/DD/YY\') AND b = ? )',
+ stmt_q => 'SELECT * FROM `test` WHERE ( `a` < to_date(?, \'MM/DD/YY\') AND `b` = ? )',
+ bind => [[{dummy => 1} => '02/02/02'], [b => 8]],
+ },
);