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

From Ausrack Webmaster
Subject Re: DBD::Pg problem
Date
Msg-id 000001c3b96e$9a273df0$0100a8c0@jason
Whole thread Raw
In response to Re: DBD::Pg problem  (Martijn van Oosterhout <kleptog@svana.org>)
Responses Re: DBD::Pg problem
List pgsql-general
The thing is...I am not. I am inserting it into a varchar field.

$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, {pg_type => DBD::Pg::PG_TEXT});
        $sth->bind_param(2, $to, {pg_type => DBD::Pg::PG_TEXT});
        $sth->bind_param(3, $subject, {pg_type => DBD::Pg::PG_TEXT});
        $sth->execute;

\d it_contact;
                                           Table "public.it_contact"
   Column   |            Type             |
Modifiers
------------+-----------------------------+-----------------------------
---------------------------------------
 contact_id | integer                     | not null default
nextval('public.it_contact_contact_id_seq'::text)
 email      | character varying(100)      |
 to_email   | character varying(100)      |
 subject    | text                        |
 fname      | character varying(30)       |
 lname      | character varying(30)       |
 kafname    | character varying(30)       |
 kalname    | character varying(30)       |
 details    | text                        |
 modify     | timestamp without time zone |
 status     | smallint                    |
 parent     | integer                     |


Jason

-----Original Message-----
From: pgsql-general-owner@postgresql.org
[mailto:pgsql-general-owner@postgresql.org] On Behalf Of Martijn van
Oosterhout
Sent: Wednesday, December 03, 2003 3:52 PM
To: Ausrack Webmaster
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] DBD::Pg problem


pg_atoi is the string to int converter. You're trying to insert it into
an integer field.

On Wed, Dec 03, 2003 at 03:45:53PM +0900, Ausrack Webmaster wrote:
> Hi
>
> I am trying to insert a simple email address into a text field,
> and I get the below error:
>
> DBD::Pg::st execute failed: ERROR:  pg_atoi: error in
> "<support@somedomain.com>": can't parse "<support@somedomain.com>"
>
> I figure it is because of the < and @ in the value, but why does it
> take these as operators even when the value has single quotes around
> it? I have even tried binding the values and PG_TEXT beforehand and
> still not luck.
>
> Any help would be greatly appreciated.
>
> Jason Frisch
>
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster

--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> "All that is needed for the forces of evil to triumph is for enough
> good men to do nothing." - Edmond Burke "The penalty good people pay
> for not being interested in politics is to be governed by people worse

> than themselves." - Plato



pgsql-general by date:

Previous
From: David Garamond
Date:
Subject: Money data type in PostgreSQL?
Next
From: "John Sidney-Woollett"
Date:
Subject: Transaction Question