Hi, I've recently started using PostgreSQL and am trying to load a table
from a file. The file has 4275 records in it but the database only ends
up with 4241 records. When I was using the Pg module I could check the
status of the insert, I imagine I can do the same using the DBI module but
I don't know how. Could someone help me out? Here's the script I'm using
for the insert...
#!/usr/bin/perl -w
use DBI;
my $database_name = "paging";
my $database = "dbi:Pg:dbname=$database_name";
my $db_user = "rob";
my $DATA_TB = "data";
my $dbh = DBI->connect($database,$db_user,"") or
die "Can't connect to database\n";
my $sth = $dbh->prepare("INSERT INTO $DATA_TB(CustNo,PIN,CustName,
Serial,Model) VALUES (?,?,?,?,?");
open(IN, "data.dat") || die "Can't open input file:$!\n";
while(<IN>) {
chomp;
($CustNo, $PIN, $CustName, $Serial, $Model) = split(/\|/, $_);
print "$CustNo, $PIN, $CustName, $Serial, $Model\n";
$sth->execute($CustNo, $PIN, $CustName, $Serial, $Model);
#The above line is the one I would like to get the status of.
}
close(IN);
$dbh->disconnect;
Thanks;
Rob
Good judgement comes from experience, and experience -
well, that comes from poor judgement.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]