Trouble making set_sql work...

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

From: Andy Harrison
Subject: Trouble making set_sql work...
Date: 14:28 on 13 Jul 2004
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've tried placing the set_sql statement under
Maillog::Report::top_stats but that did not help.  It does complain
that it's already defined if I leave the statement in BOTH places
though (obviously).

The relevent bits of code:

from main:

Maillog::Report::top_stats->show_top( $opt_top, $opt_top_limit );


package Maillog::DBI;

    use Class::DBI;
    use base 'Class::DBI::Pg';

    my $user    = "maillog";
    my $pw      = "not_the_password";
    my $DSN     = "dbi:Pg:dbname=maillog";

    Maillog::DBI->set_db( 'Main', $DSN, $user, $pw, { AutoCommit => 1 } )
        or die "Error setting up database connection: $@\n";


package Maillog::Report;

    use base 'Maillog::DBI';

    __PACKAGE__->set_sql( 'show_top' =>
                                qq { 
                                    SELECT option_data, COUNT(*) 
                                    FROM entry_options 
                                    WHERE option = '?' 
                                    GROUP BY option_data 
                                    ORDER BY count DESC
                                    LIMIT ?;
                                   }
                            );

package Maillog::Report::top_stats;

    use base 'Maillog::Report';

    sub use_table   { 'entry_options' }
    sub use_columns { qw/option msgid option_data procpid/ }


Any help would be appreciated.  Thanx!

        -- 
        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