Re: SQL statement PREPARE does not work in ECPG

Поиск
Список
Период
Сортировка
От Michael Meskes
Тема Re: SQL statement PREPARE does not work in ECPG
Дата
Msg-id 78bf6c78ed1c0ec659688703bc4cb69d22bb5823.camel@postgresql.org
обсуждение исходный текст
Ответ на RE: SQL statement PREPARE does not work in ECPG  ("Takahashi, Ryohei" <r.takahashi_2@jp.fujitsu.com>)
Список pgsql-hackers
Takahashi-san,

> I tried as follows.
> ...
> Unfortunately, this does not work.
> ECPGst_execute seems good, but prepare statement is the same as my
> first post.

Ah right, my bad. The workaround should have been:

EXEC SQL PREPARE test_prep from "SELECT id from test_table where id =
$1";
EXEC SQL EXECUTE test_prep using 2;

> It fails with "PostgreSQL error : -202[too few arguments on line
> 16]".
> 
> This error is caused by following source code.
> ...
> I think next_insert() should ignore "$n" in the case of SQL statement
> PREPARE.

Actually I am not so sure.

> In addition, we should fix following, right?
> 
> (1)
> As Matsumura-san wrote, ECPG should not produce '"' for SQL statement
> PREPARE.

Why's that?

> (2)
> ECPG should produce argument for execute statement such as "EXEC SQL
> EXECUTE test_prep (2);"

Correct.

As for the PREPARE statement itself, could you try the attached small
patch please.

This seems to create the correct ECPGPrepare call, but I have not yet
tested it for many use cases.

Thanks.

Michael
-- 
Michael Meskes
Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org)
Meskes at (Debian|Postgresql) dot Org
Jabber: michael at xmpp dot meskes dot org
VfL Borussia! Força Barça! SF 49ers! Use Debian GNU/Linux, PostgreSQL

Вложения

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

Предыдущее
От: Michael Meskes
Дата:
Сообщение: Re: SQL statement PREPARE does not work in ECPG
Следующее
От: Christoph Berg
Дата:
Сообщение: Re: [HACKERS] Time to change pg_regress diffs to unified by default?