ODBC_SQLGetDiagField (handleType; handleID; recNb; diagID; diagInfoPtr; stringLengthPtr) Longint
|handleType||Longint||Type of ID to pass to handleID|
|handleID||Longint||Handle ID for the diagnostic data structure|
|recNb||Longint||Indicates the status record from which the|
|application seeks information|
|diagID||Longint||Indicates the field of the diagnostic whose value|
|is to be returned|
|diagInfoPtr||Pointer||Pointer to a variable in which to return the|
|The data type depends on the value of diagID|
|stringLengthPtr||Pointer||Total length of the string returned in diagInfoPtr|
|Function result||Longint||Returns the result of the MS ODBC API function|
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:
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:
|SQL_DIAG_CLASS_ORIGIN||A string that indicates the document that defines|
|the class portion of the SQLSTATE value in this|
|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|
|SQL_DIAG_MESSAGE_TEXT||An informational message on the error or|
|SQL_DIAG_NATIVE||A driver/data sourcespecific native error code.|
|SQL_DIAG_NUMBER||Number 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,|
|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.
SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, SQL_INVALID_HANDLE, or SQL_NO_DATA.