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 03040DFF97E6E54E88D3BFEE5F5480F737AC1DFB@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

Thank you for your comment.
I write three points in this mail.

1.
> This also seems to be conflicting with
> bd7c95f0c1a38becffceb3ea7234d57167f6d4bf. If we want to keep this
> commit in for the release, I think we need to get these things fixed. 

I understand it.
My idea is that add an argument for statement-name to ECPGdo() or
add a new function that is a wrapper of ECPGdo() and has the argument.
The argument is used for lookup related connection. Is it good?


2.
> I wrote:
> But it doesn't allow to use host variable in parameter clause of EXECUTE statement like the following.

I found a way to support host variables in parameter list of EXECUTE statement.
ecpg_build_params() replace each parameter to string-formatted data that can be
created by ecpg_store_input(). I will try it.


3.
I found a bug in my patch. Replacing $ to @ in AS clause is not good
because @ is absolute value operator.
Therefore, the replacing cannot accept valid statement like the following.

  exec sql prepare st(int) select $1 + @1;  -- It equals to "select $1 + 1"

I choose $$1 unavoidably.
Other character seems to be used as any operator.


P.S.
- PREPARE with FROM is the standard for Embedded SQL.
- PREPARE with AS is not defined in the standard.
- PREPARE with AS clause is PostgreSQL style.
- Oracle and MySQL support only the standard.

Regards
Ryo Matsumura

pgsql-hackers by date:

Previous
From: David Steele
Date:
Subject: Re: Remove Deprecated Exclusive Backup Mode
Next
From: Arthur Zakirov
Date:
Subject: [PROPOSAL] Drop orphan temp tables in single-mode