Skip Menu |

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

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

People
Owner: Nobody in particular
Requestors: mark [...] summersault.com
Cc:
AdminCc:

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



Subject: better support for complex queries with AND and OR
Hello, I'm using 1.13 now and it's really nice. However, I'm having trouble finding a clean syntax when developing complex queries, especially queries that predominantly use "AND" as the joiner, but use "OR" in a sub-clause. I also find the subtlety of how AND and OR are created sometimes hard to wrap my head around as I'm staring out it. So I'm interesting a little more explicit syntax to specify AND and OR, with an example as follows. my @where = ( {col_1 => 'val_1', }, 'AND', [ { col2 => 'val_2' }, 'OR', { col3 => 'val_3 }, ], ); The functionality I'm trying to describe includes: - Scalars found in the @where array are used to join the phrases together. They override any default joiner already set. - Array references within the parent where array can be used for grouping clauses together. I think a syntax like this would be easy to read and also allows the author to be more expressive for complex queries. What do you think? Regards, Mark
From: "Nathan Wiger" <nate [...] wiger.org>
To: <bug-SQL-Abstract [...] rt.cpan.org>
Subject: Re: [cpan #2643] better support for complex queries with AND and OR
Date: Fri, 23 May 2003 09:08:29 -0700
RT-Send-Cc:
Show quoted text
> my @where = ( > {col_1 => 'val_1', }, > 'AND', > [ > { col2 => 'val_2' }, > 'OR', > { col3 => 'val_3 }, > ], > > ); > > The functionality I'm trying to describe includes: > > - Scalars found in the @where array are used to join the phrases > together. They override any default joiner already set. > - Array references within the parent where array can be used for > grouping clauses together.
Send me a patch and I'll take a look. I'm not opposed to it at first glance. -Nate
From: "Nathan Wiger" <nate [...] wiger.org>
To: <bug-SQL-Abstract [...] rt.cpan.org>
Subject: Re: [cpan #2643] better support for complex queries with AND and OR
Date: Fri, 23 May 2003 09:20:35 -0700
RT-Send-Cc:
Oh, it should be noted that DBIx::Abstract works this way. You may have more luck with that module. I tried to design SQL::Abstract without that, since in practice I found using scalars in auto-generated data structures was damn near impossible. -Nate Show quoted text
> > The functionality I'm trying to describe includes: > > > > - Scalars found in the @where array are used to join the phrases > > together. They override any default joiner already set. > > - Array references within the parent where array can be used for > > grouping clauses together.
> > Send me a patch and I'll take a look. I'm not opposed to it at
first Show quoted text
> glance.