SQLRowCount--Get row count

Purpose

Specification: DB2 CLI 1.1 ODBC 1.0 ISO CLI

SQLRowCount() returns the number of rows in a table that were affected by an UPDATE, INSERT, DELETE, or SELECT with scrollable cursor statement executed against the table.

SQLExecute() or SQLExecDirect() must be called before calling this function.

Syntax

SQLRETURN   SQLRowCount      (SQLHSTMT          StatementHandle,   /* hstmt */
                              SQLINTEGER   FAR  *RowCountPtr);     /* pcrow */

Function arguments

Table 78. SQLRowCount arguments

Data type Argument Use Description
SQLHSTMT StatementHandle input Statement handle.
SQLINTEGER RowCountPtr output Pointer to location where the number of rows affected is stored.

Usage

If the last executed statement referenced by the input statement handle is not an UPDATE, INSERT, or DELETE statement, or if it did not execute successfully, then the function sets the contents of RowCountPtr to -1.

Any rows in other tables that might have been affected by the statement are not included in the count.

Return codes

Diagnostics

Table 79. SQLRowCount SQLSTATEs

SQLSTATE Description Explanation
40003

08S01

Communication link failure. The communication link between the application and data source failed before the function completed.
58004 Unexpected system failure. Unrecoverable system error.
HY001 Memory allocation failure. DB2 CLI is unable to allocate memory required to support execution or completion of the function. It is likely that process-level memory has been exhausted for the application process. Consult the operating system configuration for information on process-level memory limitations.
HY010 Function sequence error. The function is called prior to calling SQLExecute() or SQLExecDirect() for the StatementHandle.
HY013 Unexpected memory handling error. DB2 CLI was unable to access memory required to support execution or completion of the function.

Restrictions

None.

Related reference