Re: Use of C function parameters from embedded SQL

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Dick Brooks <dick(at)8760(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Use of C function parameters from embedded SQL
Date: 2001-06-21 07:11:04
Message-ID: 20010621091104.A4208@feivel.credativ.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Jun 14, 2001 at 02:16:29PM -0500, Dick Brooks wrote:
> Here is a section of embedded SQL code that works fine in Oracle (some code
> removed for brevity):
>
> void open_database(char *user_name, char*pass_word)
> {
> EXEC SQL CONNECT :user_name IDENTIFIED BY :pass_word;
> }

This only work with Pro*C if you run it in full parse mode. That means Pro*C
will parse your complete C file an not just the EXEC SQL parts. I would not
recommend doing this. At first glance it looks like a nice feature but you
can run into numerous sorts of trouble.

> The only way I could get ecpg to process this code was to include a DECLARE
> section, for example:

Yes, that's the standard way of doing this.

> Does anyone know of a workaround to allow use of the function parameters
> with having to declare them first?

No, there is none. The full parse mode has been on my todo list for a long
time but with very low priority. Sorry.

Michael

--
Michael Meskes
Michael(at)Fam-Meskes(dot)De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2001-06-21 08:43:19 Re: this is a "If update confirmed, commit, else rollback" question.
Previous Message Tom Lane 2001-06-21 05:43:59 Re: Problems with pgsql 7.1.2 and ExecEvalExpr