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 | 32caccbc0711130230y59bb1841t8713ac6698a53701@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: PQexec(), what should I do for the "NULL in command" problem? (Martijn van Oosterhout <kleptog@svana.org>) |
| Список | pgsql-general |
> > > - out of line parameters > > How to? Is there any function for this? I mean the C interface. > > PQexecParams. > > > > - 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? > > True. You should realise that the text data type does not handle > embedded nulls, that's why the bytea datatype exists. If you don't want > the full conversion, you'll need to handle your own escaping. > PostgreSQL is not going return you strings with embedded NULLs... Thank you very much, I got that :) Jason
В списке pgsql-general по дате отправления: