From: Karen Etheridge Date: Mon, 28 Jul 2014 19:02:23 +0000 (-0700) Subject: Document including literal SQL and values in a resultset with "columns" X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=08e63d278057a059851b114425ddaa713dfea036;p=dbsrgits%2FDBIx-Class-Historic.git Document including literal SQL and values in a resultset with "columns" --- diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index d8c4628..3ec0268 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -4094,6 +4094,20 @@ chain such that it matches existing relationships: }, }); +Like elsewhere, literal SQL or literal values can be included by using a +scalar reference or a literal bind value, and these values will be available +in the result with C (see also +L): + + # equivalent SQL: SELECT 1, 'a string', IF(x,1,2) ... + columns => [ + { + foo => \1, + bar => \q{'a string'}, + baz => \[ '?', 'IF(x,1,2)' ], + } + ] + =head2 +columns B You B explicitly quote C<'+columns'> when using this attribute.