[jifty-devel] Frustration with limit's limitations

Jesse Vincent jesse at bestpractical.com
Thu Jun 26 19:55:06 EDT 2008


limit is the oldest part of dbix::searchbuilder. I wrote the code in  
1999 just after leaving microsoft. I share your desire for something  
more concise and expressive.  Ruslan has been working on a generalized  
version of rt's ticketsql for jdbi though I dunno if it's ready yet.   
You CAN do what you want with a combination of entry aggregators and  
named subclauses, but it is still clunkier than it should be.

Solutions would be greatly appreciated, but please pick a better name  
for your new search method that makes more sense than limit.  I regret  
that poor naming every day.


Jesse

Sent from my phone. Please forgive my brevity.

On Jun 27, 2008, at 2:23 AM, "Sterling Hanenkamp" <sterling at hanenkamp.com 
 > wrote:

> Every so often I want to defenestrate Jifty::DBI for the simple fact  
> that I cannot describe a basic WHERE clause with it. For example,  
> the query:
>
> SELECT *
> FROM tasks
> WHERE parent = 12 AND task_type = 'action' AND (status = 'open' OR  
> (status = 'done' AND completed_on >= '2008-06-26 11:39:22'))
>
> Is there a way to do this? I haven't found a combination of limits  
> and subclauses that will let me do this that works. The code within  
> limit() is pretty complicated, so I haven't been able to unravel  
> what it is doing, let alone how this is supposed to work. I'll write  
> up a complex query example in the documentation if someone will give  
> me a demonstration on how this is supposed to be done. I have not  
> found a good example of a complex query either.
>
> My other issue with limit is that the format used in limit() is  
> pretty verbose. Has there been any consideration for allowing  
> arbitrary SQL to be used. I.e., this is arguably more straitforward:
>
> $tasks->limit(sql => "completed_on >= '2008-06-26 11:39:22'");
>
> than:
>
> $tasks->limit(column => 'completed_on', operator => '>=', value =>  
> '2008-06-26 11:39:22');
>
> Or the use of a more flexible and compact format for limits, such as  
> is used by SQL::Abstract:
>
> $tasks->limit(abstract => [ completed_on => [ '>=', '2008-06-26  
> 11:39:22' ] ]);
>
> Cheers,
> Sterling
> _______________________________________________
> jifty-devel mailing list
> jifty-devel at lists.jifty.org
> http://lists.jifty.org/cgi-bin/mailman/listinfo/jifty-devel


More information about the jifty-devel mailing list