RsGetValue Function

Action

Retrieves any value from 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.

Include file

db.bdh

Syntax

RsGetValue( out sResult       : string,
            in  nResultMaxLen : number,
            in  sIdentifier   : string,
            in  nIndex        : number optional,
            out nResultCode   : number optional ): boolean;

Return value

  • Returns true if successfull,
  • false otherwise
Parameter Description
sResult Variable receiving the data retrieved from a fetched row.
nResultMaxLen Size of the variable receiving the value.
sIdentifier Identifier of the result data column.
nIndex Array index for the column item (optional).
nResultCode

Variable receiving the result code of the operation (optional). It can be one of the following:

  • RS_RESULTCODE_SUCCESS: function succeeded

  • RS_RESULTCODE_INVALID_INPUTPARAMETER: invalid input parameter

  • RS_RESULTCODE_INVLAID_COLUMN: the 'sIdentifier' is invalid

  • RS_RESULTCODE_INVALID_CELL: there exists no item at the chosen position

Example

var
  hConnection : number;
  cCursor     : cursor;
 
dcltrans
  transaction TMain
  var
    nAge  : number;
    sName : string;
  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);
      
    while OraFetch(cCursor) do
      RsGetValue(sName, STRING_COMPLETE, "1");
      nAge  := RsGetInt("2");
      write(sName, 32); write(nAge, 5); writeln;
    end;

    OraClose(cCursor);
    OraLogoff(hConnection);
  end TMain;

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