From: | Richard Huxton <dev(at)archonet(dot)com> |
---|---|
To: | "Ausrack Webmaster" <webmaster(at)ausrack(dot)com(dot)au>, "'Alex Satrapa'" <alex(at)lintelsys(dot)com(dot)au> |
Cc: | <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: DBD::Pg problem |
Date: | 2003-12-03 10:21:10 |
Message-ID: | 200312031021.10834.dev@archonet.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)archonet(dot)com','dev(at)archonet(dot)com','Blah2');
do_ins('<dev(at)archonet(dot)com>','dev(at)archonet(dot)com','Blah3');
do_ins('<dev(at)archonet(dot)com>','<dev(at)archonet(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Randolf Richardson | 2003-12-03 10:24:06 | Re: embedded postgresql + C++ IDE |
Previous Message | Randolf Richardson | 2003-12-03 10:20:23 | Re: ISO 8601 'Time Intervals' of the 'format with time-unit deignators' |