Dalin has asked for the wisdom of the Perl Monks concerning the following question:
But when I run the script I get the following -$select00->bind_param(1,$id,SQL_INTEGER)|| die $select00->errstr; $select00->bind_param(3,$item,SQL_INTEGER)|| die $select00->errstr;
Here is the entire code -DBI::st=HASH(0x80f86e0)->bind_param(...): attribute parameter 'SQL_INT +EGER' is n ot a hash ref at ./dbtest.insert line 19.
Also, do I need to quote the SQL_INTEGER parts of the bind_params? I get#!/usr/bin/perl -w # # use strict; use DBI; my $dsn="dbi:Pg:dbname=tabletest"; my $user="postgres"; my $passwd=""; # # # my ($dbh,$id,$descr,$item,$latin); $dbh = DBI->connect($dsn, $user, $passwd, { RaiseError => 1, AutoCommi +t => 0 }); my $select00 = $dbh->prepare('INSERT INTO hobby (id,descr,item,latin) +VALUES (?, ?,?,?)')|| die $dbh->errstr; $select00->bind_param(1,$id,SQL_INTEGER)|| die $select00->errs +tr; $select00->bind_param(3,$item,SQL_INTEGER)|| die $select00->er +rstr; my $csvfile="/home/bradley/dbtest/item_instk.csv"; open (CSV,"$csvfile"); while (<CSV>) { chop; $id = 1; ($item,$descr,$latin) = split /\//; $select00->execute( $id, $descr, $item, $latin )||die $dbh->er +rstr; ++$id; } close CSV; $dbh->disconnect;
If I don't quote them. Any help anyone can provide would be greatly appreciated. Thanks Bradley Where ever there is confusion to be had... I'll be there.Bareword "SQL_INTEGER" not allowed while "strict subs" in use at ./dbt +est.insert line 18.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBI data types
by maverick (Curate) on Aug 21, 2001 at 23:12 UTC | |
by runrig (Abbot) on Aug 21, 2001 at 23:18 UTC | |
by htoug (Deacon) on Aug 22, 2001 at 15:02 UTC | |
by Dalin (Sexton) on Aug 21, 2001 at 23:54 UTC | |
|
Re: DBI data types
by blakem (Monsignor) on Aug 21, 2001 at 23:08 UTC | |
by Dalin (Sexton) on Aug 21, 2001 at 23:18 UTC |