Re: [ECPG] generates bad code on declare/open

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Tim Nelson <TNELSON(at)ECS-INC(dot)com>
Cc: "'pgsql-interfaces(at)postgresql(dot)org'" <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: [ECPG] generates bad code on declare/open
Date: 2002-01-10 08:23:56
Message-ID: 20020110082356.GC11923@feivel.credativ.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)Fam-Meskes(dot)De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!

In response to

Responses

Browse pgsql-interfaces by date

  From Date Subject
Next Message Jeroen T. Vermeulen 2002-01-10 23:27:04 libpqxx update
Previous Message Christof Petig 2002-01-10 07:41:20 Re: dynamic sql in ecpg