From: Peter Rabbitson Date: Sat, 20 Sep 2014 23:03:12 +0000 (+0200) Subject: Truly fix literal+bind examples (build upon a3e3e6a18) X-Git-Tag: v1.79~8 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=3ae1c5e20cfd486c0a0def29832f05977d0092a0;p=dbsrgits%2FSQL-Abstract.git Truly fix literal+bind examples (build upon a3e3e6a18) Throw away the dummy text - it was always misleading and incorrect Add some space to clarify which part is which --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 48a2f5b..61d4762 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -1718,7 +1718,7 @@ say something like this: my %data = ( name => 'Bill', - date_entered => \["to_date(?,'MM/DD/YYYY')", "03/02/2003"], + date_entered => \[ "to_date(?,'MM/DD/YYYY')", "03/02/2003" ], ); The first value in the array is the actual SQL. Any other values are @@ -1919,7 +1919,7 @@ are or are not included. You could wrap that above C loop in a simple sub called C or something and reuse it repeatedly. You still get a layer of abstraction over manual SQL specification. -Note that if you set L to C, the C<\[$sql, @bind]> +Note that if you set L to C, the C<\[ $sql, @bind ]> construct (see L) will expect the bind values in this format. @@ -2683,7 +2683,7 @@ not so common, but perfectly legal Perl). For example, to find a date in Postgres you can use something like this: my %where = ( - date_column => \[q/= date '2008-09-30' - ?::integer/, 10] + date_column => \[ "= date '2008-09-30' - ?::integer", 10 ] ) This would create: @@ -2700,7 +2700,7 @@ L will simply pass it through intact. So if C is set to C the above example will look like: my %where = ( - date_column => \[q/= date '2008-09-30' - ?::integer/, [ dummy => 10 ]] + date_column => \[ "= date '2008-09-30' - ?::integer", [ {} => 10 ] ] ) Literal SQL is especially useful for nesting parenthesized clauses in the @@ -3091,7 +3091,7 @@ The main changes are : =item * -support for literal SQL through the C<< \ [$sql, bind] >> syntax. +support for literal SQL through the C<< \ [ $sql, @bind ] >> syntax. =item *