Skip Menu |

This queue is for tickets about the SQL-Abstract CPAN distribution.

Report information
The Basics
Id: 89601
Status: resolved
Priority: 0/
Queue: SQL-Abstract

People
Owner: Nobody in particular
Requestors: TIMB [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: It's not clear how to wrap an arbitrary expression with "NOT (...)"
Given an SQLA data structure representing a complex expression, I want to express that the expression should not be true. It's not clear how to do that from the docs (assuming it can be done - I'm still experimenting with -not_bool).
It turned out very simple of course: perl -MSQL::Abstract -we 'warn SQL::Abstract->new->where({ -not_bool => { x => "", y => ""} })' WHERE ( (NOT ( f = ? AND y = ? )) ) at -e line 1. So the point of this ticket is that the "Unary operators: bool" section of the docs only gives examples of applying -bool and -not_bool to simple boolean fields. I suggest changing the second example to include a more complex expression. Something like: my %where = ( -and => [ -bool => 'one', -bool => 'two', -not_bool => 'three', -not_bool => { priority => [ { '=', 2 }, { '>', 5 } ] }, ], );
On Fri Oct 18 06:02:33 2013, TIMB wrote: Show quoted text
> It turned out very simple of course: > > perl -MSQL::Abstract -we 'warn SQL::Abstract->new->where({ -not_bool > => { x => "", y => ""} })' > WHERE ( (NOT ( f = ? AND y = ? )) ) at -e line 1. > > So the point of this ticket is that the "Unary operators: bool" > section of the docs only gives examples of applying -bool and > -not_bool to simple boolean fields. > > I suggest changing the second example to include a more complex > expression. Something like: > > my %where = ( > -and => [ > -bool => 'one', > -bool => 'two', > -not_bool => 'three', > -not_bool => { priority => [ { '=', 2 }, { '>', 5 } ] }, > ], > );
Good idea, patched as per: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits/SQL-Abstract.git;a=commitdiff;h=23401b8 Thanks!
On Wed Dec 18 08:53:52 2013, RIBASUSHI wrote: Show quoted text
> On Fri Oct 18 06:02:33 2013, TIMB wrote:
> > It turned out very simple of course: > > > > perl -MSQL::Abstract -we 'warn SQL::Abstract->new->where({ -not_bool > > => { x => "", y => ""} })' > > WHERE ( (NOT ( f = ? AND y = ? )) ) at -e line 1. > > > > So the point of this ticket is that the "Unary operators: bool" > > section of the docs only gives examples of applying -bool and > > -not_bool to simple boolean fields. > > > > I suggest changing the second example to include a more complex > > expression. Something like: > > > > my %where = ( > > -and => [ > > -bool => 'one', > > -bool => 'two', > > -not_bool => 'three', > > -not_bool => { priority => [ { '=', 2 }, { '>', 5 } ] }, > > ], > > );
> > Good idea, patched as per: > http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits/SQL- > Abstract.git;a=commitdiff;h=23401b8 > > Thanks!