From: | "David Martnez Cuevas" <david(at)mail(dot)estadistica(dot)unam(dot)mx> |
---|---|
To: | pgsql-interfaces(at)postgresql(dot)org |
Subject: | Inserting null values from Perl DBI |
Date: | 1999-03-16 19:59:06 |
Message-ID: | 36EEB80A.ED0B203B@mail.estadistica.unam.mx |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
Hi.
I've been dealing with perl, dbi and postgres, but i'm having troubles
while inserting null values.
This is what i'm doing like:
##################################################
$conn_seq = DBI->connect("dbi:Pg:dbname=$bd",'','') or finaliza(
$DBI::errstr);
$conn = DBI->connect("dbi:Pg:dbname=$bd",'','', {AutoCommit => 0}) or
finaliza( $DBI::errstr);
$educacion_ready = $conn->prepare(q{
insert into educacion (educacion,nombre,
duracion,fecha,
asistentes,constancias,
dependencia,modalidad,
sede,diplomado,
modulos,depponente)
values (?,?,?,?,?,?,?,?,?,?,?,?)}) or finaliza( $DBI::errstr);
.......
while(<IN_FILE>) {
.......
# here, i take values from many files. Basically, i need to prevent
# from bad typing of users. When certain conditions becomes true,
# i should insert null values into this loop:
$get_seq = $conn_seq->prepare("select nextval('seq_educacion')") or
finaliza( $DBI::errstr);
$get_seq->execute;
$nextval = ($get_seq->fetchrow)[0];
$educacion_ready->execute($nextval,$nombre,$duracion,$fecha,
$asistentes,$constancias,$cve_dep,$modalidad,
$sede,$diplomado,$modulos,$depponente) or finaliza(
$DBI::errstr);
}
$conn->commit || finaliza($conn->errstr);
###########################################################
But when placeholders must take a 'null' value, they doesn't work.
I've already tried to fix it using 'undef' values, but i get the same
error:
DBD::Pg::st execute failed: ERROR: attribute undef not found
What can i do ??
NOTE: Please e-mail-me directly... i'm not suscribed to interfaces
mailing list
Thank you.
David Martínez Cuevas
david(at)estadistica(dot)unam(dot)mx
From | Date | Subject | |
---|---|---|---|
Next Message | pacilli | 1999-03-17 19:07:39 | My problem with iODBC->psqlodbc |
Previous Message | Christopher R. Jones | 1999-03-15 19:12:20 | DBD-Pg-0.89 on NT |