Retrieves the current value of a specified SQL statement attribute.
ODBC.bdh
OdbcGetStmtAttr( in cCursor : cursor, in nAttribute : number, out nValue : number): boolean;
true if successful
false otherwise
Parameter | Description |
---|---|
cCursor | Cursor associated with a database connection. |
nAttribute |
SQL statement attribute whose value is to be retrieved. This parameter must be set to one of the following values:
|
nValue | Variable that will receive the value of the SQL statement attribute. |
var hEnv, hDbc : number; cCursor : cursor; dcltrans transaction TMain var nTimeout : number; begin OdbcAlloc(SQL_HANDLE_ENV, hEnv); OdbcAlloc(SQL_HANDLE_DBC, hDbc, hEnv); OdbcConnect(hDbc, "DSN=database;UID=user;PWD=pass;"); OdbcOpen(cCursor, hDbc); OdbcSetStmtAttr(cCursor, SQL_ATTR_QUERY_TIMEOUT, 15); OdbcGetStmtAttr(cCursor, SQL_ATTR_QUERY_TIMEOUT, nTimeout ); 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;