Re: Trouble making set_sql work...

[prev] [thread] [next] [Date index for 2004/07/13]

From: Jay Strauss
Subject: Re: Trouble making set_sql work...
Date: 15:10 on 13 Jul 2004
Take a look at the beginners guide
http://www.class-dbi.com/cgi-bin/wiki/index.cgi?BeginnersGuide

But as an example:

__PACKAGE__->set_sql(persons => qq {
 select artist.artistid
 from artist, person
 where artist.artistid = person.artistid
 and person.gender = ?});


Then in your code you'd call it like:

my @persons = Music::Artist->search_persons("F");


Jay
----- Original Message ----- 
From: "Andy Harrison" <aharrison@xxxxx.xxx>
To: "Jesse Sheidlower" <jester@xxxxx.xxx>
Cc: "cdbi" <cdbi-talk@xxxxxx.xxxxx.xxx>
Sent: Tuesday, July 13, 2004 9:58 AM
Subject: Re: Trouble making set_sql work...


> On Tue, 13 Jul 2004 10:31:16 -0400, Jesse Sheidlower <jester@xxxxx.xxx>
wrote:
> > On Tue, Jul 13, 2004 at 10:28:05AM -0400, Andy Harrison wrote:
> > > This is stumping me...  I'm trying to use the set_sql method bit it's
> > > not working.
> > >
> > > The error message:
> > >
> > > Can't locate object method "show_top" via package
> > > "Maillog::Report::top_stats" (perhaps you forgot to load
> > > "Maillog::Report::top_stats"?) at maillog_parse.pl line 554.
> >
> > I think with set_sql, the CDBI method name is generated by
> > prefixing "search_" to the set_sql name. That is, you should
> > be running "search_show_top".
> >
> > Best,
> >
> > Jesse Sheidlower
> >
>
> Great, thanx Jesse!
>
> I changed the line in main (and added the prints) to the following:
>     print "::opt_top::>", $opt_top, "<:: \n::opt_top_limit::>",
> $opt_top_limit, "<::\n";
>     Maillog::Report::top_stats->search_show_top( $opt_top,
$opt_top_limit );
>
>
> Now the error message is something else entirely:
>
> ::opt_top::>senders<::
> ::opt_top_limit::>10<::
> Maillog::Report::top_statsMaillog::Report::top_stats can't
>                                     SELECT option_data, COUNT(*)
>                                     FROM entry_options
>                                     WHERE option = '?'
>                                     GROUP BY option_data
>                                     ORDER BY count DESC
>                                     LIMIT ?;
>                                    : execute called with 2 bind
> variables, 1 needed at
> /usr/local/lib/perl5/site_perl/5.6.1/DBIx/ContextualFetch.pm line 51.
> errexecute called with 2 bind variables, 1 needed at
> /usr/local/lib/perl5/site_perl/5.6.1/DBIx/ContextualFetch.pm line 51.
>  at maillog_parse.pl line 529
>
>
> Am I using the ? symbols incorrectly?
>
> -- 
> Andy Harrison
>
>

(message missing)

Trouble making set_sql work...
Andy Harrison 14:28 on 13 Jul 2004

Re: Trouble making set_sql work...
colm-cdbi 14:54 on 13 Jul 2004

Re: Trouble making set_sql work...
colm-cdbi 15:10 on 13 Jul 2004

Re: Trouble making set_sql work...
Andy Harrison 14:58 on 13 Jul 2004

Re: Trouble making set_sql work...
Jesse Sheidlower 15:04 on 13 Jul 2004

Re: Trouble making set_sql work...
Andy Harrison 16:36 on 13 Jul 2004

Re: Trouble making set_sql work...
John Beppu 16:46 on 13 Jul 2004

Re: Trouble making set_sql work...
Stuart Johnston 16:50 on 13 Jul 2004

Re: Trouble making set_sql work...
Andy Harrison 17:32 on 13 Jul 2004

Re: Trouble making set_sql work...
colm-cdbi 18:38 on 13 Jul 2004

Re: Trouble making set_sql work...
Andy Harrison 19:33 on 13 Jul 2004

Re: Trouble making set_sql work...
Drew Taylor 19:44 on 13 Jul 2004

Re: Trouble making set_sql work...
colm-cdbi 20:08 on 13 Jul 2004

Re: Trouble making set_sql work...
Andy Harrison 20:52 on 13 Jul 2004

Re: Trouble making set_sql work...
colm-cdbi 18:57 on 13 Jul 2004

Re: Trouble making set_sql work...
Jay Strauss 15:10 on 13 Jul 2004

Re: Trouble making set_sql work...
Perrin Harkins 17:51 on 13 Jul 2004

Re: Trouble making set_sql work...
Andy Harrison 18:23 on 13 Jul 2004

Re: Trouble making set_sql work...
Stuart Johnston 19:44 on 13 Jul 2004

Generated at 11:34 on 01 Dec 2004 by mariachi v0.52