Updating cursors

From: "Jarmo Paavilainen" <netletter(at)comder(dot)com>
To: <pgsql-general(at)hub(dot)org>
Subject: Updating cursors
Date: 2000-09-04 07:20:10
Message-ID: 000701c01640$8f706640$1501a8c0@theboss.comder.private
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

Ive a SELECT cursor which I want to update/delete but postgresql does not
support these:

UPDATE myTable SET myColumn = 'myValue' WHERE CURRENT OF myCursor
DELETE myTable WHERE CURRENT OF myCursor

Does there exist any workaround?
Or is my syntax wrong?

One workaround would be to get the row id and to be able to update it.
Something like this:

... a row is selected and fetched ...

int i = GetRowId( ); // C function that reads a unique row id.
ExecuteSQL( "UPDATE myTable SET myColumn = 'myValue' WHERE @ROWID = %d",
i );
ExecuteSQL( "DELETE myTable WHERE @ROWID = %d", i );
// ExecuteSQL(...) is a C function that parses and executes the string.

// Jarmo

PS. I hope Im sending this mail to the right address, if not Im sorry DS.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Hiroshi Inoue 2000-09-04 09:11:52 RE: Updating cursors
Previous Message Alfred Perlstein 2000-09-04 05:44:53 Re: subselect in CHECK constraint?