Re: PQexec(), what should I do for the "NULL in command" problem?
От
yang zhenyu
Тема
Re: PQexec(), what should I do for the "NULL in command" problem?
Дата
Msg-id
32caccbc0711121852v4c9accdt3b5e1f490460c80e@mail.gmail.com
Ответ на
Re: PQexec(), what should I do for the "NULL in command" problem? (Martijn van Oosterhout)
Список
Дерево обсуждения
PQexec(), what should I do for the "NULL in command" problem? jason <zhyuyang@gmail.com>
Re: PQexec(), what should I do for the "NULL in command" problem? Martijn van Oosterhout <kleptog@svana.org>
Re: PQexec(), what should I do for the "NULL in command" problem? "yang zhenyu" <zhyuyang@gmail.com>
Re: PQexec(), what should I do for the "NULL in command" problem? Martijn van Oosterhout <kleptog@svana.org>
Re: PQexec(), what should I do for the "NULL in command" problem? "yang zhenyu" <zhyuyang@gmail.com>
On Nov 12, 2007 11:13 PM, Martijn van Oosterhout wrote: > 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. Thanks for reply :-) But would you please give me more details or some references? > Two ways: > - out of line parameters How to? Is there any function for this? I mean the C interface. > - escape the nulls, like \0 Do you mean this function? #unsigned char *PQescapeBytea(const unsigned char *from, # size_t from_length, # size_t *to_length); But after the "escape", the data is changed, and it cannot automatically change back when insert them into database. I have to "unescape" it when query. Is this necessary? Best Regards, Jason
В списке pgsql-general по дате отправления