Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > > - 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

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
       subscribe-nomail command to majordomo@xxxxxxxxxxxxxx so that your
       message can get through to the mailing list cleanly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux