From: Matt S Trout Date: Mon, 30 Sep 2019 18:30:04 +0000 (+0000) Subject: document values expander X-Git-Tag: v2.000000~3^2~84 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1150ff41da5617fe6c480154ea13bd290f30cec0;p=dbsrgits%2FSQL-Abstract.git document values expander --- diff --git a/lib/SQL/Abstract/Reference.pm b/lib/SQL/Abstract/Reference.pm index b030f39..f20cb06 100644 --- a/lib/SQL/Abstract/Reference.pm +++ b/lib/SQL/Abstract/Reference.pm @@ -712,4 +712,36 @@ Expands the argument values: COALESCE(thing, ?) [ 'fallback' ] +=head2 values + +A hashref value is expanded as an expression: + + # expr + { -values => { -row => [ 1, 2 ] } } + + # aqt + { -values => [ + { -row => [ { -bind => [ undef, 1 ] }, { -bind => [ undef, 2 ] } ] } + ] } + + # query + VALUES (?, ?) + [ 1, 2 ] + +An arrayref value's elements are either expressions or arrayrefs to be +treated as rows: + + # expr + { -values => [ { -row => [ 1, 2 ] }, [ 3, 4 ] ] } + + # aqt + { -values => [ + { -row => [ { -bind => [ undef, 1 ] }, { -bind => [ undef, 2 ] } ] }, + { -row => [ { -bind => [ undef, 3 ] }, { -bind => [ undef, 4 ] } ] }, + ] } + + # query + VALUES (?, ?), (?, ?) + [ 1, 2, 3, 4 ] + =cut