Hugh Lampert wrote:
> Ash Berlin wrote:
>>> On 8/10/06, *Ash Berlin* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> 
>>> wrote:
>>>
>>>     Right then guys:
>>>
>>>     I am trying to build the following query:
>>>     [......]
>>>     Any recourse?
> 
> Perhaps this is a crazy idea but I see I'm not the only one who 
> struggles with the DBIC syntax.  As a SQL DBA/Developer I'm a lot more 
> comfortable with SQL syntax than coding queries for DBIC. Would it be 
> possible to write a utility module or script that given a valid SQL 
> query in a string would produce the corresponding DBIC method call? 
> 
> (Please don't tell me to write this myself, I'm not that big a genius!)

Yes, it would be possible. But I'd much rather provide a query syntax for DBIC 
that more closely mirrors the SQL syntax. My two current thoughts on this are 
via operator overloading -

my $this_millenium = FROM $cds_rs WHERE { $_->year >= 2000 & $_->tracks->count 
 > 10 };

or via some hybrid syntax -

my $this_millenium = $cds_rs->search( AND( 'year' GTE 2000, 'count(tracks)' GT 
10 ) );

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to