Xbasic

SQL::CallResult Object

Description

SQL::CallResult Object and an example.

This SQL::CallResult object provides a more complete description of a function call on an object in the SQL namespace. Most SQL objects have a member property of type SQL::CallResult. The .Text property contains either "Success" or the last error.

DIM c as SQL::Connection
DIM cs as C
cs = "{A5API=Access, FileName=C:\doesNotExist.mdb}"

? c.open(cs) 
= .F.

? c.callResult.text
= Database API specific error
API Specific Result is: -1 - '[Microsoft][ODBC Microsoft Access Driver] Could not find file '(unknown)'.
SQL State is: HY000
[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
SQL State is: IM006'
Name
Description
Handling Errors with the SQL::CallResult Object

AlphaDAO contains a special object named SQL::CallResult to help you diagnose problems. Suppose you take the following script, which works, and change the name of the database from "alphasports.mdb" to "alpha.mdb".

Using the CallResult LastInsertedIdentity Property

The LastInsertedIdentity property contains the primary key for the last record that was inserted.

Properties

CodeNumeric

Default = 0. The number identifying the result.

TextCharacter

Default = "Success". A description of the result.

NativeCodeNumeric

Default = 0. The numeric value (if any) returned by the underlying database driver.

NativeTextCharacter

Default = "". The description (if any) returned by the underlying database driver.

SyntaxCharacter

Default = "". The syntax type in use when the call was made.

APICharacter

Default = "". The API (driver) in use when the call was made.

RowsAffectedNumeric

Default = 0. The number of rows affected by an insert/update/delete SQL statement.

SuccessLogical

Default = TRUE (.T.). TRUE (.T.) if the call succeeded; otherwise FALSE (.F.).

ErrorLogical

Default = FALSE (.F.). TRUE (.T.) if the call failed; otherwise FALSE (.F.).

CanceledLogical

Default = FALSE (.F.). TRUE (.T.) if the call was cancelled; otherwise FALSE (.F.).

WarningsLogical

Default = FALSE (.F.).

LastInsertedIdentity*

This property is valid only after an INSERT successfully completes. See Using the CallResult LastInsertedIdentity Property for an example.

RowsReturnedNumeric

RowsReturned property

See Also