I'm helping someone retrieve some info from a MySQL db and I'm having
trouble sending multiple select statements with Perl. Here's a portion of the
code:
use SQL::SplitStatement;
my $query_4 = "CREATE TEMPORARY TABLE `temp_ip` AS
(SELECT `ip`
FROM `ip_addresses` "
.$daily.
" AND TRIM(`referrer`) LIKE '' GROUP BY `ip` HAVING COUNT(*) > 1);
SELECT `ip`, `page`, `url`, `time_stamp`
FROM `ip_addresses` "
.$daily.
"AND TRIM(`referrer`) LIKE '' AND `ip` IN (SELECT `ip` FROM `temp_ip`)";
my $sql_splitter = SQL::SplitStatement->new(
keep_terminators => 1,
keep_extra_spaces => 1,
keep_comments => 0,
keep_empty_statements => 1
);
my @statements = $sql_splitter->split($query_4);
my $sql_string = join ' ', @statements;
my $sth_4 = $dbh->prepare($sql_string);
$sth_4->execute();
I believe what's throwing a wrench in it is the ";" separating the 2
select statements. That's why I'm using SQL::SplitStatement, but that doesn't
seem to help, so I'm sure I'm doing something wrong. The SQL works fine, so my
problem must be with my Perl code.
I've read everything I can get my hands on but no luck. Any help would
be greatly appreciated.
Thanks,
Frank
http://www.surfshopcart.com/
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/