Re: DBD::Pg problem - Mailing list pgsql-general

From Richard Huxton
Subject Re: DBD::Pg problem
Date
Msg-id 200312031021.10834.dev@archonet.com
Whole thread Raw
In response to Re: DBD::Pg problem  ("Ausrack Webmaster" <webmaster@ausrack.com.au>)
List pgsql-general
On Wednesday 03 December 2003 09:43, Ausrack Webmaster wrote:
> Tried that ...it is definetely the to_email field, not any others that
> is causing
> the problem.

With the table schema you gave, the following seems to work fine for me. Only
changes from your example are to remove quoting on $parent and let
bind_param() sort out types by itself.


#!/usr/bin/perl -w

use DBI;

$dbh = DBI->connect("dbi:Pg:dbname=DBNAMEHERE", "", "");

do_ins('alpha','beta','Blah1');
do_ins('dev@archonet.com','dev@archonet.com','Blah2');
do_ins('<dev@archonet.com>','dev@archonet.com','Blah3');
do_ins('<dev@archonet.com>','<dev@archonet.com>','Blah4');

$dbh->disconnect;
exit;

sub do_ins {
    my ($from,$to,$subject) = @_;
    my $body = 'BBB';
    my $parent = 0;

    print STDERR "Trying f/t = $from / $to\n";
    $sql="insert into it_contact (email, to_email, subject,
    details,modify,parent) values(?,?,?,'$body',now(),$parent)";
    $sth = $dbh->prepare($sql);
    $sth->bind_param(1, $from);
    $sth->bind_param(2, $to);
    $sth->bind_param(3, $subject);
    $sth->execute;
    print STDERR "Ending f/t = $from / $to\n\n";
}



--
  Richard Huxton
  Archonet Ltd

pgsql-general by date:

Previous
From: "Ausrack Webmaster"
Date:
Subject: Re: DBD::Pg problem
Next
From: "John Sidney-Woollett"
Date:
Subject: Re: Transaction Question