X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FSQL%2FAbstract%2FReference.pm;h=257fd735ed7313bfef805798b244b4243a449108;hb=116bc0b69bc3d55647a4e195cf212a6af38ba5b8;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..257fd73 100644 --- a/lib/SQL/Abstract/Reference.pm +++ b/lib/SQL/Abstract/Reference.pm @@ -371,7 +371,7 @@ Directly appended to the key, remember you need to provide an operator: # expr { id => \[ - "= seriously(?, ?, ?, ?, ?)", + "= seriously(?, ?, ?, ?)", "use", "-ident", "and", @@ -381,11 +381,11 @@ Directly appended to the key, remember you need to provide an operator: # aqt { -literal => - [ 'id = seriously(?, ?, ?, ?, ?)', 'use', -ident => 'and', '-func' ] + [ 'id = seriously(?, ?, ?, ?)', 'use', -ident => 'and', '-func' ] } # query - id = seriously(?, ?, ?, ?, ?) + id = seriously(?, ?, ?, ?) [ 'use', -ident => 'and', '-func' ] (you may absolutely use this when there's no built-in expression type for @@ -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' ] } ] }, } }