From: lothar.behrens@lollisoft.de
To: pgsql-odbc@postgresql.org
Subject: Delete row (SQLSetPos) and then fetch over ?
Date: Thu, 24 Nov 2005 18:04:20 +0100
Message-ID: <438600A4.21217.1AB8D48@localhost> (raw)
Hi,
I am struggling with deleting a row in my cursor. The scenaio is as following:
I add some rows with empty data, some default columns and the like. Then I check
the contents by using the application to scroll over row by row. This works fine.
Deleting the second last row let the GUI afterwards show the last row. Looks ok as
expected. But after going one row back (the deleted row), my application shows
rubbish and may crash afterwards.
How looks like correct ODBC code to detect the 'navigation' to the 'deleted' row ?
Thanks, Lothar
My code looks like this:
lbErrCodes LB_STDCALL lbQuery::previous() {
UWORD RowStat[20];
UDWORD RowsFetched = 0;
retcode = SQLExtendedFetch( hstmt,
SQL_FETCH_PREV,
0, &RowsFetched, RowStat);
if (retcode == SQL_NO_DATA) {
// Go back to valid row
retcode = SQLExtendedFetch(hstmt,
SQL_FETCH_NEXT,
0, &RowsFetched, RowStat);
return ERR_DB_NODATA;
} else {
// Peek one row to detect if further scroll previous would be possible
retcode =
SQLExtendedFetch(hstmt, SQL_FETCH_PREV, 0, &RowsFetched,
RowStat);
if (retcode == SQL_NO_DATA) {
SQLExtendedFetch(hstmt,
SQL_FETCH_NEXT, 0, &RowsFetched, RowStat);
return WARN_DB_NODATA;
} else {
SQLExtendedFetch(hstmt,
SQL_FETCH_NEXT, 0, &RowsFetched, RowStat);
return ERR_NONE;
}
}
--
Lothar Behrens | Rapid Prototyping ...
Rosmarinstr 3 |
40235 Düsseldorf | www.lollisoft.de
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: lothar.behrens@lollisoft.de
Subject: Re: Delete row (SQLSetPos) and then fetch over ?
In-Reply-To: <438600A4.21217.1AB8D48@localhost>
References: <438600A4.21217.1AB8D48@localhost>
* 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