How to insert wchar_t type string to PostgreSQL

From: Yan Cheng CHEOK <yccheok(at)yahoo(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: How to insert wchar_t type string to PostgreSQL
Date: 2010-05-20 02:44:57
Message-ID: 565935.73402.qm@web65706.mail.ac4.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello all,

I am programming in Windows environment. Previously, we are using MBCs (http://msdn.microsoft.com/en-us/library/5z097dxa%28VS.71%29.aspx), in order to support language other than English.

The following function still can be used, as long as we are setting the database to correct encoding. For example, if we want to support china mainland, we will be using "GBK" as encoding.

PGresult *PQexec(PGconn *conn, const char *query);

But once we compile using unicode, we are no longer using char * typed string. Instead, we are using wchar_t * typed string.

But, I do not find any function as follow in libpq library.

PGresult *PQexec(PGconn *conn, const wchar_t *query);

May I know, how I can store wchar_t * typed string into PostgreSQl, using C library?

Thanks and Regards
Yan Cheng CHEOK

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Joshua Tolley 2010-05-20 02:57:33 Re: Connection lost
Previous Message Alvaro Herrera 2010-05-19 22:11:35 Re: Help writing a query to predict auto analyze