Hi,
I get an error message I don't understand. I've been following what I thought
was good practice when talking to a DB.
All help/comments appreciated!
Some code:
############################3
use strict;
use DBI;
...
open FILE, "${DIR}/$_" or die "Failed to open ${DIR}/$_";
$sql = qq{ INSERT INTO observations VALUES( ?, ?, ?, ? ) };
$sth = $dbh->prepare( $sql );
while(<FILE>) {
my($ap,$as,$ms,$at,$mt,$mp) = m/$regex/;
eval{
$sth->bind_param( 1, \$insertid, SQL_INT); #insertid from other
insertion
$sth->bind_param( 2, \$ap, SQL_DOUBLE);
$sth->bind_param( 3, \$as, SQL_DOUBLE);
$sth->bind_param( 4, \$at, SQL_DOUBLE);
$sth->execute();
$dbh->commit();
};
if( $@ ) {
warn "Database error: $DBI::errstr\n";
$dbh->rollback(); #just die if rollback is failing
die "Quitting.\n";
}
...
__END__
And the errors:
Bareword "SQL_INT" not allowed while "strict subs" in use at ./profiles2db.pl
line 118.
Bareword "SQL_DOUBLE" not allowed while "strict subs" in use
at ./profiles2db.pl line 119.
Bareword "SQL_DOUBLE" not allowed while "strict subs" in use
at ./profiles2db.pl line 120.
Bareword "SQL_DOUBLE" not allowed while "strict subs" in use
at ./profiles2db.pl line 121.
--
Bjørge Solli - Office:+47 55205847
Mohn-Sverdrupsenteret, Nansensenteret, Høyteknologisenteret T47
Thormöhlensgate 47, 5006 Bergen, Norway - www.nersc.no
Google Earth: www.nersc.no/GE - TOPAZ: topaz.nersc.no
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>