Delete row (SQLSetPos) and then fetch over ?

From: lothar(dot)behrens(at)lollisoft(dot)de
To: pgsql-odbc(at)postgresql(dot)org
Subject: Delete row (SQLSetPos) and then fetch over ?
Date: 2005-11-24 17:04:20
Message-ID: 438600A4.21217.1AB8D48@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-odbc

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

Browse pgsql-odbc by date

  From Date Subject
Next Message noreply 2005-11-25 08:57:30 [ psqlodbc-Bugs-1000435 ] Special characters in table names
Previous Message Dave Page 2005-11-24 15:23:22 Re: Continuing encoding fun....