RsVerifyRowCount Function

Action

Checks whether the internal result set, which is filled whenever a data generating SQL statement is executed (SELECT statement), no matter which database API (ORA, ODBC) has generated it, has a specific amount of rows.

Include file

db.bdh

Syntax

RsVerifyRowCount( in  nRows     : number,
                  in  nOptions  : number optional,
                  in  nSeverity : number optional,
                  out nActRows  : number optional ): boolean;

Return value

  • true if verification was performed successfully,
  • false otherwise
Parameter Description
nRows Number of rows to verify.
nOptions Specifies the relation of the given result row count and the row count of the received data (optional).

Can be one of the following:

  • DB_FLAG_EQUAL (default)

  • DB_FLAG_LESSEQUAL

  • DB_FLAG_GREATEREQUAL

nSeverity Optional: Severity of the error that is raised if the verification fails. Can be one of the following values:
  • SEVERITY_SUCCESS: Success; no error (numerical value: 0)
  • SEVERITY_INFORMATIONAL: Informational; no error (numerical value: 1)
  • SEVERITY_WARNING: Warning; no error (numerical value: 2)
  • SEVERITY_ERROR: (Default) Error; simulation continues (numerical value: 3)
  • SEVERITY_TRANS_EXIT: Error; the active transaction is aborted (numerical value: 4)
  • SEVERITY_PROCESS_EXIT: Error; the simulation is aborted (numerical value: 5)
nActRows If this variable is provided, it will receive the actual number of rows (optional).

Example

var
  hConnection : number;
  cCursor     : cursor;

dcltrans
  transaction TMain
  var
    nAge : number;
  begin
    OraLogon(hConnection, "user", "password", "orclnet2");
    OraOpen(cCursor, hConnection);
    OraParse(cCursor, sqlSelect);
    OraBind(cCursor, ":1", SQLT_INT);
    OraSetInt(cCursor, ":1", 25);
    OraDefine(cCursor, 1, SQLT_CHR, 32);
    OraDefine(cCursor, 2, SQLT_INT);
    OraExec(cCursor);
    OraFetch(cCursor, ORA_FETCH_ALL);
     
    if ( not RsVerifyRowCount(10, 0, SEVERITY_WARNING) ) then
      writeln("Wrong row count!!!");
    end;

    nAge := RsGetInt("2");
    OraClose(cCursor);
    OraLogoff(hConnection);
  end TMain;

dclsql
  sqlSelect:
  SELECT * FROM persons WHERE age > :1;