From: | Boszormenyi Zoltan <zb(at)cybertec(dot)at> |
---|---|
To: | Michael Meskes <meskes(at)postgresql(dot)org> |
Cc: | Hans-Juergen Schoenig <hs(at)cybertec(dot)at>, PG Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | ECPG support for string pseudo-type |
Date: | 2009-07-04 13:39:14 |
Message-ID: | 4A4F5B82.2070403@cybertec.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
in a continued effort for better Informix ESQL/C compatibility,
we added the "string" pseudo-type handling to ECPG.
This type in ESQL/C is documented as:
--------------------------------------------------
The string Data Type
The string data type is an ESQL/C data type that holds character data
that is
null terminated and does not contain trailing blanks. When an application
reads a value from a CHAR column into a host variable of data type
string, it
strips the value of any trailing blanks and appends a null terminator. The
behavior is the same if an application reads a value from a VARCHAR column
into a host variable of data type string.
Declare the string data type with a length of [n+1] (where n is the size
of the
column with values that you want read) to allow for the null terminator. Use
the following syntax to declare a host variable of the string data type:
EXEC SQL BEGIN DECLARE SECTION;
string str_name[n + 1];
EXEC SQL END DECLARE SECTION;
--------------------------------------------------
So, we added it accordingly. This means the following:
- "string" has become a type name, reserved word in ECPG.
- When ECPG encounters "string", it will be transparently replaced by
"char" in the generated C source, but ECPGt_string will be passed
to ECPGdo()
- ecpg_get_data() right-trims the string value if ECPGt_string was passed.
Two regression tests had to be modified because "string" is now
a type name: preproc/define.pgc and preproc/type.pgc.
The attached patch is built upon our previous patch supporting
dynamic cursor and SQLDA.
Best regards,
Zoltán Böszörményi
--
Bible has answers for everything. Proof:
"But let your communication be, Yea, yea; Nay, nay: for whatsoever is more
than these cometh of evil." (Matthew 5:37) - basics of digital technology.
"May your kingdom come" - superficial description of plate tectonics
----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/
Attachment | Content-Type | Size |
---|---|---|
ecpg-string-8.4-1-ctxdiff.patch | text/x-patch | 29.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2009-07-04 13:51:57 | Re: ECPG support for string pseudo-type |
Previous Message | Greg Stark | 2009-07-04 11:26:13 | Re: pg_migrator mention in documentation |