Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to retrieve the number of rows deleted
Message
From
18/07/2005 13:10:46
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
How to retrieve the number of rows deleted
Environment versions
Visual FoxPro:
VFP 7
Miscellaneous
Thread ID:
01033589
Message ID:
01033589
Views:
72
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
Next
Reply
Map
View

Click here to load this message in the networking platform