Обсуждение: ecpg cursors and scope

Поиск
Список
Период
Сортировка

ecpg cursors and scope

От
Dave Broudy
Дата:
I have two senarios about scoping and ecpg's parsing of cursor
declarations:

A) In seperate functions:

func1() {
  exec sql declare test_cur for ...
}
func2() {
  exec sql declare test_cur for ... /* same or different sql */
}

B) In an if:

if(...) {
  exec sql declare test_cur for ...
} else {
  exec sql declare test_cur for ... /* same or different sql */
}

These both yield "cursor test_cur already defined"

Is this by design? I seem to remember it working under 6.3.2, and this is
under 6.4.2

If I knew lex/yacc, I'd make an effort at a patch, alas my compilers class
of a few years ago made us parse the old fashioned way :) Does anyone know
of a work-around?

Thanks,

Dave Broudy             dave@broudy.net



Re: [INTERFACES] ecpg cursors and scope

От
Michael Meskes
Дата:
On Tue, Apr 20, 1999 at 09:46:14PM -0400, Dave Broudy wrote:
> I have two senarios about scoping and ecpg's parsing of cursor
> declarations:
> ...

AFAIK teh standrad the cursor is valid in the scope of its module, i.e. the
source file it's listed in.

> Is this by design? I seem to remember it working under 6.3.2, and this is
> under 6.4.2

The new version does comply much more to the standard.

Michael
--
Michael Meskes                         | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz    | Go Rhein Fire!
Tel.: (+49) 2431/72651                 | Use Debian GNU/Linux!
Email: Michael.Meskes@gmx.net          | Use PostgreSQL!