pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christof Petig <christof.petig@wtal.de>
To: Maurizio <maurizio.c@libero.it>
Cc: Michael Meskes <meskes@postgresql.org>
Cc: pgsql-hackers@postgresql.org
Subject: Re: Re: [INTERFACES] USE OF CURSORS IN ECPG
Date: Fri, 10 Nov 2000 11:52:48 +0100
Message-ID: <3A0BD380.4B5F37E@wtal.de> (raw)
References: <001101c048db$38a74d60$7394fea9@maurizio>
	<20001108123942.A7369@feivel.fam-meskes.de>
	<004301c04a53$f98ecc00$7394fea9@maurizio>

Maurizio wrote:

> But, how can I do ?
> I have to recall the same routine many times. I tried to prepare and declare
> the cursor inside the routine but when I compile with ecpg I receive the
> error Cursor already defined.

you should drop the cursor (exec sql close name;)
But there is trouble ahead (believe me - see below)

> Maurizioan

------------
(Oh, I misunderstood, if you get into trouble with transactions (waiting for
you ;-() you might consider the following lines)
------------
You certainly should disable autocommit!
  exec sql set autocommit to off;
otherwise you have no control over when a transaction starts and whether this
succeded.
Then at the start of your SubProgram do
  bool my_transaction;
  exec sql begin work;
  my_transaction=!sqlca.sqlcode;

at the end:
  if (my_transaction) exec sql commit work;

This should give you an idea on how to accomplish it. If not feel free to ask
me.

But (sigh) you need my NOTICE to sqlca patch applied. It's not in 7.0 but in
7.1! I don't know any other way (I'll attach the patch)

Christof

PS: You might consider applying the patch for (update where not_found) -> 100
and the cache which doubles ecpg's speed.

Attachments:

  Pgsql_Ecpg_Notice.diff.gz (application/x-gzip, 2.0K) download

  Pgsql_Ecpg_Notice2.diff.gz (application/x-gzip, 291B) download

  Pgsql_Ecpg_Update_100.diff.gz (application/x-gzip, 339B) download

  Pgsql_Ecpg_Type_Cache.diff.gz (application/x-gzip, 1.4K) download

view thread (4+ messages)

Message-ID: <3A0BD380.4B5F37E@wtal.de>
Permalink:  ../3A0BD380.4B5F37E@wtal.de/
Also on:    postgresql.org/message-id/3A0BD380.4B5F37E@wtal.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: christof.petig@wtal.de, maurizio.c@libero.it, meskes@postgresql.org, pgsql-hackers@postgresql.org
  Subject: Re: Re: [INTERFACES] USE OF CURSORS IN ECPG
  In-Reply-To: <3A0BD380.4B5F37E@wtal.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox