From: | "yang zhenyu" <zhyuyang(at)gmail(dot)com> |
---|---|
To: | "Martijn van Oosterhout" <kleptog(at)svana(dot)org>, "yang zhenyu" <zhyuyang(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: PQexec(), what should I do for the "NULL in command" problem? |
Date: | 2007-11-13 10:30:42 |
Message-ID: | 32caccbc0711130230y59bb1841t8713ac6698a53701@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Christian Schröder | 2007-11-13 13:08:47 | Re: (Never?) Kill Postmaster? |
Previous Message | Decibel! | 2007-11-13 08:38:40 | Re: PITR and warm standby setup questions |