From: | Boszormenyi Zoltan <zb(at)cybertec(dot)at> |
---|---|
To: | Michael Meskes <meskes(at)postgresql(dot)org> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Hans-Juergen Schoenig <hs(at)cybertec(dot)at> |
Subject: | Re: ECPG support for struct in INTO list |
Date: | 2009-08-14 19:53:19 |
Message-ID: | 4A85C0AF.2080704@cybertec.at |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
I got around to fix the struct problem, when ECPG aborted
upon finding the following statement:
DECLARE mycur
CURSOR FOR
SELECT *
INTO :mystruct [:myindicatorstruct] ...
As I found out earlier, ECPG also aborted when the variable
is a pointer, like:
struct mytype *myvar;
I fixed both cases, and added the quirk to the lexer to keep
the last identifier as a function name before any ( or { is
encountered and this allowed me to detect and handle
out of scope DECLARE/OPEN/FETCH.
You know the ecpg lexer/grammar better than me,
you may find a better way to do this.
Anyway, the end result is that now in compat mode
ECPGinformix_get_var() type vars are not always used,
only when OPEN and FETCH are out of scope, i.e. they
are in a function different from where the cursor was
DECLAREd.
I added two regression tests, one tests only the struct
usability in compat mode, which didn't work before and
started this little "crusade". :-) The other tests struct pointers
and out of scope DECLARE/OPEN/FETCH.
Tell me that this isn't a useful feature in non-compat mode.
I will leave the rewrite to you if you find it so, I left a comment
for you in the code. ;-)
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 |
---|---|---|
pg85-outofscopedeclare-1-ctxdiff.patch | text/x-patch | 84.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Boszormenyi Zoltan | 2009-08-14 20:12:24 | Re: Split-up ECPG patches |
Previous Message | Michael Meskes | 2009-08-14 19:15:54 | Re: Split-up ECPG patches |