RE: SQL statement PREPARE does not work in ECPG

From: "Matsumura, Ryo" <matsumura(dot)ryo(at)jp(dot)fujitsu(dot)com>
To: 'Michael Meskes' <meskes(at)postgresql(dot)org>, "Takahashi, Ryohei" <r(dot)takahashi_2(at)jp(dot)fujitsu(dot)com>, "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: SQL statement PREPARE does not work in ECPG
Date: 2019-03-01 08:41:58
Message-ID: 03040DFF97E6E54E88D3BFEE5F5480F737AC011D@G01JPEXMBYT04
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Meskes-san, Takahashi-san

> If the standard allows it, we want to be able to process it.

I will try to implement it with the Idea-2 that doesn't use PQprepare() and
Takahasi-san's following idea.

> For example,
> - ECPG convert ":ID" to "$1" and "$1" in the original statement to "$$1"
> - next_insert() do not check "$$1"
> - ECPGdo() reconvert "$$1" to "$1"

But I will probably be late because I don't understand parse.pl very well.
I think that the following rule is made by parse.pl.

PreparableStmt:
SelectStmt
{
is_in_preparable_stmt = true; <--- I want to add it.
$$ = $1;
}
| InsertStmt
.....

The above variable is used in ecpg.trailer.

ecpg_param: PARAM {
if(is_in_preparable_stmt)
$$ = mm_strdup(replace_dollar_to_something());
else
$$ = make_name();
} ;

I will use @1 instend of $$1 because the replacing is almost same as the existing replacing function in ecpglib.
Is it good?

Regards
Ryo Matsumura

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Steele 2019-03-01 09:21:32 Re: Add exclusive backup deprecation notes to documentation
Previous Message Kyotaro HORIGUCHI 2019-03-01 08:32:45 Re: Protect syscache from bloating with negative cache entries