X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSQL%2FAbstract%2FReference.pm;h=4ec6df70970606c64d573fea5e0c57f9a2a6ba04;hb=e376aa8053a377ca85e9a16205132b30436b2ce5;hp=fd29f339d98e63b9261ae239c27e466893eac2e9;hpb=ef42b9a699e2dc37e13870b0f7f5db38cd907c71;p=scpubgit%2FQ-Branch.git diff --git a/lib/SQL/Abstract/Reference.pm b/lib/SQL/Abstract/Reference.pm index fd29f33..4ec6df7 100644 --- a/lib/SQL/Abstract/Reference.pm +++ b/lib/SQL/Abstract/Reference.pm @@ -744,6 +744,31 @@ treated as rows: VALUES (?, ?), (?, ?) [ 1, 2, 3, 4 ] +=head2 list + +Expects a value or an arrayref of values, expands them, and returns just +the expanded aqt for a single entry or a comma operator for multiple: + + # expr + { -list => [ { -ident => 'foo' } ] } + + # aqt + { -op => [ ',', { -ident => [ 'foo' ] } ] } + + # query + foo + [] + + # expr + { -list => [ { -ident => 'foo' }, { -ident => 'bar' } ] } + + # aqt + { -op => [ ',', { -ident => [ 'foo' ] }, { -ident => [ 'bar' ] } ] } + + # query + foo, bar + [] + =head2 between op The RHS of between must either be a pair of exprs/plain values, or a single @@ -1015,7 +1040,7 @@ The returning clause is expanded as a list expr with an ident default. { -bind => [ 'baz', 'argh' ] }, ] } ] }, returning => { -op => [ ',', { -ident => [ 'id' ] } ] }, - target => { -op => [ ',', { -ident => [ 'foo' ] } ] }, + target => { -ident => [ 'foo' ] }, } } # query @@ -1035,12 +1060,12 @@ The returning clause is expanded as a list expr with an ident default. [ ',', { -ident => [ 'bar' ] }, { -ident => [ 'baz' ] } ] } ] }, from => { -select => { - from => { -from_list => [ { -ident => [ 'other' ] } ] }, + from => { -ident => [ 'other' ] }, select => { -op => [ ',', { -ident => [ 'bar' ] }, { -ident => [ 'baz' ] } ] }, } }, - target => { -op => [ ',', { -ident => [ 'foo' ] } ] }, + target => { -ident => [ 'foo' ] }, } } # query @@ -1085,7 +1110,7 @@ The returning clause is expanded as a list expr with an ident default. ] }, ] }, ] }, - target => { -from_list => [ { -ident => [ 'foo' ] } ] }, + target => { -ident => [ 'foo' ] }, where => { -op => [ 'not', { -ident => [ 'quux' ] } ] }, } }