Re: ECPG support for struct in INTO list

Поиск
Список
Период
Сортировка
От Boszormenyi Zoltan
Тема Re: ECPG support for struct in INTO list
Дата
Msg-id 4A72BC89.9050403@cybertec.at
обсуждение исходный текст
Ответ на Re: ECPG support for struct in INTO list  (Michael Meskes <meskes@postgresql.org>)
Ответы Re: ECPG support for struct in INTO list  (Michael Meskes <meskes@postgresql.org>)
Список pgsql-hackers
Michael Meskes írta:
> On Fri, Jul 17, 2009 at 03:58:21PM +0200, Boszormenyi Zoltan wrote:
>
>> Attached is the short example I can reproduce with.
>> The version I used was final PostgreSQL 8.4.0, without our
>> extensions posted already. I added an indication to ecpg_type_name():
>>
>> [zozo@db00 ecpg-test]$ ecpg -C INFORMIX test28.pgc
>> ...
>> But you are right about the "supposed to work" part,
>> if I modify it the way below, it works:
>>
>
> Thanks for spotting this. It appears to be a bug in Informix compatibility
> mode. Without -C INFORMIX it works nicely. Thus I guess we have to find and fix
> the bug. Your patch probably/hopefully is not needed.
>
> Michael
>

My previous patch on this broke "make check" in ecpg,
so ignore that. Your comment that it's a bug in Informix-mode
made me look around more. Find the attached patch I came up with.
Now my previous test code works and produces similar C code
as without "-C INFORMIX". Can it be this simple?
Can you see anything wrong with this approach?

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/

diff -dcrpN pgsql85dev.4string/src/interfaces/ecpg/preproc/ecpg.header
pgsql85dev.5struct/src/interfaces/ecpg/preproc/ecpg.header
*** pgsql85dev.4string/src/interfaces/ecpg/preproc/ecpg.header    2009-07-15 11:19:06.000000000 +0200
--- pgsql85dev.5struct/src/interfaces/ecpg/preproc/ecpg.header    2009-07-31 11:38:50.000000000 +0200
*************** adjust_informix(struct arguments *list)
*** 266,271 ****
--- 266,273 ----
              ptr->variable = new_variable(cat_str(4, make_str("("),
mm_strdup(ecpg_type_name(ptr->variable->type->type)),make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)),
ECPGmake_simple_type(ptr->variable->type->type,ptr->variable->type->size, ptr->variable->type->lineno), 0); 
              sprintf(temp, "%d, (", ecpg_informix_var++);
          }
+         else if (ptr->variable->type->type == ECPGt_struct || ptr->variable->type->type == ECPGt_union)
+             continue;
          else
          {
              ptr->variable = new_variable(cat_str(4, make_str("*("),
mm_strdup(ecpg_type_name(ptr->variable->type->type)),make_str(" *)(ECPG_informix_get_var("), mm_strdup(temp)),
ECPGmake_simple_type(ptr->variable->type->type,ptr->variable->type->size, ptr->variable->type->lineno), 0); 

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

Предыдущее
От: KaiGai Kohei
Дата:
Сообщение: Re: [PATCH] [v8.5] Security checks on largeobjects
Следующее
От: PFC
Дата:
Сообщение: More thoughts on sorting