Re: bind parameter for LIMIT statement

[prev] [thread] [next] [Date index for 2005/01/26]

From: Tony Bowden
Subject: Re: bind parameter for LIMIT statement
Date: 10:38 on 26 Jan 2005
On Wed, Jan 26, 2005 at 11:22:11AM +0100, Julien GILLES wrote:
> __PACKAGE__->add_constructor(lasts => 'keywords like ? ORDER BY date
> DESC LIMIT %s');
> 
> My::Package->lasts("%foo%", 5);

That's not going to work, by any stretch of anyone's imagination.

add_constructor isn't going to be of much use here. You need to set the
SQL up directly: 

__PACKAGE__->set_sql(lasts => 'keywords like ? ORDER BY date DESC LIMIT %d');

And then call it like:

  my @results = Class->sth_to_objects(Class->sql_lasts(5), "%foo%");

Tony

bind parameter for LIMIT statement
Julien GILLES 15:20 on 25 Jan 2005

Re: bind parameter for LIMIT statement
Tony Bowden 15:33 on 25 Jan 2005

Re: bind parameter for LIMIT statement
Julien GILLES 15:57 on 25 Jan 2005

Re: bind parameter for LIMIT statement
Perrin Harkins 16:10 on 25 Jan 2005

Re: bind parameter for LIMIT statement
Julien GILLES 10:22 on 26 Jan 2005

Re: bind parameter for LIMIT statement
Tony Bowden 10:38 on 26 Jan 2005

Generated at 12:39 on 05 Feb 2005 by mariachi v0.52