RE: SQL statement PREPARE does not work in ECPG - Mailing list pgsql-hackers

From Matsumura, Ryo
Subject RE: SQL statement PREPARE does not work in ECPG
Date
Msg-id 03040DFF97E6E54E88D3BFEE5F5480F737AC011D@G01JPEXMBYT04
Whole thread Raw
In response to Re: SQL statement PREPARE does not work in ECPG  (Michael Meskes <meskes@postgresql.org>)
Responses Re: SQL statement PREPARE does not work in ECPG
List 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

pgsql-hackers by date:

Previous
From: Kyotaro HORIGUCHI
Date:
Subject: Re: Protect syscache from bloating with negative cache entries
Next
From: David Steele
Date:
Subject: Re: Add exclusive backup deprecation notes to documentation