From: Matt S Trout Date: Mon, 30 Sep 2019 18:30:04 +0000 (+0000) Subject: document values expander X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a06faabcf643ec59fff757ed531949db488f5835;p=scpubgit%2FQ-Branch.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