ODBC_SQLGetDiagField

4D - Documentation   Français   English   German   4D ODBC PRO, Command Theme List   4D ODBC PRO, Command Alphabetical List   Back   Previous   Next

version 2004


ODBC_SQLGetDiagField (handleType; handleID; recNb; diagID; diagInfoPtr; stringLengthPtr) Longint

ParameterTypeDescription
handleTypeLongintType of ID to pass to handleID
handleIDLongintHandle ID for the diagnostic data structure
recNbLongintIndicates the status record from which the
application seeks information
diagIDLongintIndicates the field of the diagnostic whose value
is to be returned
diagInfoPtrPointerPointer to a variable in which to return the
diagnostic information.
The data type depends on the value of diagID
stringLengthPtrPointerTotal length of the string returned in diagInfoPtr
Function resultLongintReturns the result of the MS ODBC API function
SQLGetDiagField

Description

The ODBC_SQLGetDiagField command returns the current value of a field of a record of the diagnostic data structure (associated with a specified handleID) that contains error, warning, and status information.

handleType defines the type of ID to pass to handleID, which can be one of the following constants:

ConstantDescription
SQL_HANDLE_ENVEnvironment ID
SQL_HANDLE_DBCConnection ID
SQL_HANDLE_STMTStatement ID
SQL_HANDLE_DESCDescriptor ID

handleID is a handle ID for the diagnostic data structure, of the type indicated by handleType. If

handleType is SQL_HANDLE_ENV, this parameter is taken into account and the constant SQL_DEFAULT_ID can be then used.

handleID is the connectionID if handleType is equal to SQL_HANDLE_DBC. connectionID is a valid connection ID returned by ODBC_SQLAllocConnect and a connection must be established using the ODBC_SQLConnect command.

If handleType is SQL_HANDLE_STMT, handleID is the stmtID, which is a valid statement ID returned by ODBC_SQLAllocStmt.

recNb indicates the status record from which the application seeks information.

diagID indicates the field of the diagnostic whose value is to be returned. It can be one of the following values:

ConstantDescription
SQL_DIAG_CLASS_ORIGIN A string that indicates the document that defines
the class portion of the SQLSTATE value in this
record
SQL_DIAG_COLUMN_NUMBER The column number in the result set or the
parameter number in the set of parameters
SQL_DIAG_CONNECTION_NAME A string that indicates the name of the
connection that the diagnostic record relates to.
SQL_DIAG_CURSOR_ROW_COUNT The count of rows in the cursor.
SQL_DIAG_DYNAMIC_FUNCTION This is a string that describes the SQL statement
that the underlying function executed
SQL_DIAG_DYNAMIC_FUNCTION_CODE This is a numeric code that describes the SQL
statement that was executed by the underlying
function.
SQL_DIAG_MESSAGE_TEXT An informational message on the error or
warning.
SQL_DIAG_NATIVE A driver/data source–specific native error code.
SQL_DIAG_NUMBERNumber of status records that are available
SQL_DIAG_RETURNCODE Return code returned by the function
SQL_DIAG_ROW_COUNT Number of rows affected by an insert, delete, or
update performed by ODBC_SQLExecute,
ODBC_SQLExecDirect, ODBC_SQLBulkOperations,
or ODBC_SQLSetPos
SQL_DIAG_SERVER_NAME A string that indicates the server name that the
diagnostic record relates to.
SQL_DIAG_SQLSTATE A five-character SQLSTATE diagnostic code
SQL_DIAG_SUBCLASS_ORIGIN A string with the same format and valid values
as SQL_DIAG_CLASS_ORIGIN, that identifies
the defining portion of the subclass portion of
the SQLSTATE code

diagInfoPtr is a pointer to the variable in which the diagnostic information will be returned. Its type is dependent on the diagID.

stringLengthPtr is a pointer to a variable in which to return the length of the string/text returned in diagInfoPtr.

For more information, please see the SQLGetDiagField function in the MS ODBC API at http://msdn.microsoft.com/library/en-us/odbc/htm/odbcsqlgetdiagfield.asp.

Function Results

SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, SQL_INVALID_HANDLE, or SQL_NO_DATA.

See Also

ODBC_SetErrorHandler, ODBC_SQLGetDiagRec.


4D - Documentation   Français   English   German   4D ODBC PRO, Command Theme List   4D ODBC PRO, Command Alphabetical List   Back   Previous   Next