OdbcGetCursorName Function

Action

Retrieves the name of a cursor.

Include file

ODBC.bdh

Syntax

OdbcGetCursorName( in  cCursor : cursor,
                   out sName   : string ): boolean;

Return value

  • true if successful

  • false otherwise

Parameter Description
cCursor Cursor associated with a database connection.
sName String receiving the user-defined

Example

var
  hEnv, hDbc : number;
  cCursor : cursor;

dcltrans
  transaction TMain
  var
    sName: string;
  begin
    OdbcAlloc(SQL_HANDLE_ENV, hEnv);
    OdbcAlloc(SQL_HANDLE_DBC, hDbc, hEnv);
    OdbcConnect(hDbc, "DSN=database;UID=user;PWD=pass;");
    OdbcOpen(cCursor, hDbc);
    OdbcGetCursorName(cCursor, sName); writeln(sName);
    OdbcPrepare(cCursor, sqlSelect);
    OdbcExecute(cCursor);

    while OdbcFetch(cCursor) do
       write("name: " + OdbcGetString(cCursor, "1"));
       writeln(" age: " + (string)OdbcGetInt(cCursor, "2"));
    end;

    OdbcClose(cCursor, SQL_DROP);
    OdbcCommit(hDbc);
    OdbcDisconnect(hDbc);
    OdbcFree(hDbc);
    OdbcFree(hEnv);
  end TMain;

dclsql
  sqlSelect:
    SELECT * FROM persons;