Re: PQexec(), what should I do for the "NULL in command" problem? - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: PQexec(), what should I do for the "NULL in command" problem?
Date
Msg-id 20071112151338.GB13476@svana.org
Whole thread Raw
In response to PQexec(), what should I do for the "NULL in command" problem?  (jason <zhyuyang@gmail.com>)
Responses Re: PQexec(), what should I do for the "NULL in command" problem?  ("yang zhenyu" <zhyuyang@gmail.com>)
List pgsql-general
On Thu, Nov 08, 2007 at 06:39:23PM -0800, jason wrote:
> As you know the interface of PQexec():
> PGresult *PQexec(PGconn *conn, const char *command);
>
> "command" contains  some SQL statements.
>
> But there exist "\0" in some data filed, and I found PQexec() failed
> on such situation.

Two ways:
- out of line parameters
- escape the nulls, like \0

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
>  -- John F Kennedy

Attachment

pgsql-general by date:

Previous
From: Edoardo Panfili
Date:
Subject: Re: float to int
Next
From: "Scott Marlowe"
Date:
Subject: Re: Linux v.s. Mac OS-X Performance