I run
SQLEXEC( nConn, "DELETE FROM mytable WHERE mycondition")
against Postgres SQL database
and want to know how many rows this command deletes.
sqlexec() does not return number of rows deleted, there is no SQLRowCount() function or access to ODBC result header from VFP. There is not @@RowCount like variable or function in Postgres.
Any idea ?
ODBC specs say:
After an application updates, deletes, or inserts rows, it can call
SQLRowCount to determine how many rows were affected. SQLRowCount returns
this value whether or not the rows were updated, deleted, or inserted by
executing an UPDATE, DELETE, or INSERT statement, by executing a
positioned update or delete statement, or by calling SQLSetPos.
..
The number of affected rows is also returned in the SQL_DIAG_ROW_COUNT
diagnostic header field in the diagnostic area associated with the
statement handle. However, the data in this field is reset after every
function call on the same statement handle, whereas the value returned by
SQLRowCount remains the same until a call to SQLBulkOperations,
SQLExecute, SQLExecDirect, SQLPrepare, or SQLSetPos.
Andrus