Re: [ECPG] generates bad code on declare/open - Mailing list pgsql-interfaces

From Michael Meskes
Subject Re: [ECPG] generates bad code on declare/open
Date
Msg-id 20020110082356.GC11923@feivel.credativ.de
Whole thread Raw
In response to [ECPG] generates bad code on declare/open  (Tim Nelson <TNELSON@ECS-INC.com>)
List pgsql-interfaces
On Wed, Jan 09, 2002 at 12:06:52PM -0500, Tim Nelson wrote:
> How do I handle host variables passed in the where clause
> of a declared cursor?  It seems "ecpg" 2.9 takes the declare/open
> and puts the resulting code near the open.  This seems to be a bad
> thing if the host variable is declared in a different block or function:

This is not really bad code but a documented feature. PostgreSQL does not
have an "open cursor" statement, but instead opens the cursor when it is
declared. So what else can ecpg do other than moving the declaration to the
open statement? You cannot open the cursor when the declare is issued
because the declaration might be outside the scope of the executing
function.

Michael
-- 
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!


pgsql-interfaces by date:

Previous
From: Christof Petig
Date:
Subject: Re: dynamic sql in ecpg
Next
From: "Jeroen T. Vermeulen"
Date:
Subject: libpqxx update