Re: PQexec(), what should I do for the "NULL in command" problem?

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: jason <zhyuyang(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PQexec(), what should I do for the "NULL in command" problem?
Date: 2007-11-12 15:13:38
Message-ID: 20071112151338.GB13476@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)org> http://svana.org/kleptog/
> Those who make peaceful revolution impossible will make violent revolution inevitable.
> -- John F Kennedy

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Marlowe 2007-11-12 15:41:45 Re: Linux v.s. Mac OS-X Performance
Previous Message Edoardo Panfili 2007-11-12 15:10:47 Re: float to int