Hi Friends,
Here, I am trying to connect sqlite DB and access some data for matching values
with STDIN.But when i try to debug the code it gives following message. I went
through google , and couldn't find any solution yet. Can some body help me
pelase.
closing dbh with active statement handles at xxx.pl line 48, <STDIN> line 1.
This is my perl code,
#!/usr/bin/perl
use DBI;
use strict;
use warnings;
#
## no buffered output, auto flush
$|=1;
my ($dbh,$sth,$dbargs,$VALUEB,$query);
$dbargs = {AutoCommit => 0, PrintError => 1};
$dbh = DBI->connect("dbi:SQLite:dbname=List","","",$dbargs);
if ($dbh->err()) {
print;
exit;
}
while (<STDIN>) {
chomp;
my ($url, $url2, $ip) = split(/ /);
$query = "SELECT * from Groups where XvalueAddress = '". $ip ."'";
$sth = $dbh->prepare($query);
$sth->execute();
if (my $ref = $sth->fetchrow_hashref()) {
$VALUEB = $ref->{'CallId'};
#if (!defined $VALUEB) {
# $VALUEB = "NA";
#}
}else{
$VALUEB = "NA";
}
if (!($url =~ m#valueB#)) {
if ($url =~ m#\?#) {
$url .= ("&valueB=" . $VALUEB);
} else {
$url .= ("?valueB=" . $VALUEB);
}
print $url."\n";
} else {
print "\n";
}
}
$sth->finish();
$dbh->commit();
$dbh->disconnect();
Many Thanks
Luke.
Send instant messages to your online friends http://uk.messenger.yahoo.com