[suggestion]support UNICODE host variables in ECPG

Поиск
Список
Период
Сортировка
От Nagaura, Ryohei
Тема [suggestion]support UNICODE host variables in ECPG
Дата
Msg-id EDA4195584F5064680D8130B1CA91C453A5F79@G01JPEXMBYT04
обсуждение исходный текст
Ответы RE: [suggestion]support UNICODE host variables in ECPG  ("Matsumura, Ryo" <matsumura.ryo@jp.fujitsu.com>)
RE: [suggestion]support UNICODE host variables in ECPG  ("Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com>)
Список pgsql-hackers
Hi all.

There is a demand for ECPG to support UNICODE host variables.
This topic has also appeared in thread [1].
I would like to discuss whether to support in postgres.

Do you have any opinion?

The specifications and usage described below are the same as in [1].

Requirements
============
1. support utext keyword in ECPG



The utext is used to define the Unicode host variable in ECPG application
in windows platform.



2. support  UVARCHAR keyword in ECPG



The UVARCHAR is used to define the Unicode vary length host variable in
ECPG application in windows platform.



3. Saving the content of the Unicode variables into the database as
database character set or getting the content from the database into the
Unicode variables.



4. Firstly can only consider the UTF8 as database character set and UTF16
as the Unicode format for host variable. A datatype convert will be done
between the UTF8 and UTF16 by ECPG.



5. Since Unicode has big-endian and little-endian format, a environment
variable is used to identify them and do the endianness convert accordingly.



Usage
============
int main() {
    EXEC SQL BEGIN DECLARE SECTION;
        utext employee[20] ;    /* define Unicode host variable  */
        UVARCHAR address[50] ;  /* defin a vary length Unicode host
variable  */
    EXEC SQL END DECLARE SECTION;



    ...



    EXEC SQL CREATE TABLE emp (ename char(20), address varchar(50));



    /* UTF8 is the database character set  */
    EXEC SQL INSERT INTO emp (ename) VALUES ('Mike', '1 sydney, NSW') ;



    /* Database character set converted to Unicode */
    EXEC SQL SELECT ename INTO :employee FROM emp ;



    /* Database character set converted to Unicode */
    EXEC SQL SELECT address INTO :address FROM emp ;



    wprintf(L"employee name is %s\n",employee);



    wprintf(L"employee address is %s\n", address.attr);



    DELETE * FROM emp;



    /* Unicode converted to Database character */
    EXEC SQL INSERT INTO emp (ename,address) VALUES (:employee, :address);



    EXEC SQL DROP TABLE emp;
    EXEC SQL DISCONNECT ALL;
 }

[1]
https://www.postgresql.org/message-id/flat/CAF3%2BxMLcare1QrDzTxP-3JZyH5SXRkGzNUf-khSgPfmpQpkz%2BA%40mail.gmail.com

Best regards,
---------------------
Ryohei Nagaura




В списке pgsql-hackers по дате отправления:

Предыдущее
От: amul sul
Дата:
Сообщение: Re: ALTER INDEX ... ALTER COLUMN not present in dump
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: ToDo: show size of partitioned table