wxWidgets and PostgreSQL

Ayen Yang ayen.krida at gmail.com
Fri Nov 2 06:48:09 PDT 2007


Dear VZ,

Thanks for your reply.

The PQgetvalue() function returns char*
I've tried to insert the returned value to a wxString variable, as below:

  wxString c;
  c.Printf( wxT("%s"), PQgetvalue(result, 0, 0) );

note: PQgetvalue(result, 0, 0) is a PostgreSQL function to retrieve
the value of the first column in the first row of 'result'.

The PQgetvalue should return an English statement as on the table, but
the resulting c contains different characters.
Please help me where I made mistakes. Thank you very very much.

Regards,
Ayen



On Nov 2, 2007 8:26 PM, Vadim Zeitlin <vadim at wxwidgets.org> wrote:
> On Fri, 2 Nov 2007 20:12:16 +0700 Ayen Yang <ayen.krida at gmail.com> wrote:
>
> AY> I think the problem is in the conversion from the PQgetvalue() to
> AY> wxString, but I don't know for sure.
> AY> I've tried many of wxString conversion functions, but the result is
> AY> still the same.
>
>  You don't need to try many different things, you'll just confuse yourself
> and anybody else trying to help you. You need to know 2 simple things: what
> is the string format returned by PQgetvalue() and what build of wx do you
> use. If you know this, wxString provides the conversion function you need.
> If you don't, you risk to waste a lot of time stumbling in the dark.
>
>  This is (by far) not the first time this question comes on this list and
> I'm amazed that people think that you need some black magic to convert
> strings between different encodings and Unicode. There is really nothing
> complicated in it if you just stop a moment and try to understand what
> you're doing. In particular, if you're guessing about what to do, something
> is wrong. You need to know, and not to guess. So while I don't know what
> does PQgetvalue() return, you really should -- but it seems that you don't.
> And until you know this it's useless to try to do anything.
>
>  Regards,
> VZ
>
> --
> TT-Solutions: wxWidgets consultancy and technical support
>                http://www.tt-solutions.com/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
>
>




More information about the wx-users mailing list