4D v14.1ODBC_SQLGetDiagRec |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v14.1
ODBC_SQLGetDiagRec
|
ODBC_SQLGetDiagRec ( handleType ; handleID ; recNb ; sqlState ; nativeError ; messageText ; textLength ) -> Function result | ||||||||
Parameter | Type | Description | ||||||
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 information is sought. Status records are numbered from 1 | |||||
sqlState | String |
![]() |
Five-character SQLSTATE code pertaining to the diagnostic record recNb | |||||
nativeError | Longint |
![]() |
Native error code, specific to the data source | |||||
messageText | Text |
![]() |
Diagnostic message text string | |||||
textLength | Longint |
![]() |
Length of the string returned in messageText | |||||
Function result | Longint |
![]() |
Returns the result of the MS ODBC API function SQLGetDiagRec | |||||
The ODBC_SQLGetDiagRec command returns the current values of multiple fields of a diagnostic record that contains error, warning, and status information. Call this command any time one of the other 4D ODBC PRO commands does not return SQL_SUCCESS.
handleType defines the type of ID to pass to handleID, which can be one of the following:
Constant | Description |
SQL_HANDLE_ENV | Environment ID |
SQL_HANDLE_DBC | Connection ID |
SQL_HANDLE_STMT | Statement ID |
SQL_HANDLE_DESC | Descriptor 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.
Otherwise, handleID is the stmtID, which is a valid statement ID returned by ODBC_SQLAllocStmt.
recNb indicates the status record from which information is sought. Status records are numbered from 1.
sqlState is the five-character SQLSTATE code pertaining to recNb. The first two characters indicate the class; the next three indicate the subclass. This value comes from the SQL_DIAG_SQLSTATE diagnostic field.
nativeError is the native error code specific to the data source, from the SQL_DIAG_NATIVE diagnostic field.
messageText is the diagnostic message text string, which comes from the SQL_DIAG_MESSAGE_TEXT field.
For more information, please see the SQLGetDiagRec function in the MS ODBC API Reference at http://msdn.microsoft.com/en-us/library/ms716256(VS.85).aspx.
SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, or SQL_INVALID_HANDLE.
The following method is called after the result from calling ODBC_SQLExecute is not equal to SQL_SUCCESS. The debugMessage variable will contain the error message:
If($result#SQL_SUCCESS)
$resultDiag:=ODBC_SQLGetDiagRec(SQL_HANDLE_STMT;$statementID;1;SQLState;nativeError;
debugMessage;vTextLen)
End if
Product: 4D
Theme: ODBC_Results
Number:
16954
Created: 4D ODBC Pro 2004
ODBC_SetErrorHandler
ODBC_SQLGetDiagField
4D ODBC Pro ( 4D ODBC Pro v11.4)
4D ODBC Pro ( 4D ODBC Pro v12)
4D ODBC Pro ( 4D v13)
4D ODBC Pro ( 4D v14 R3)
4D ODBC Pro ( 4D v14.1)
4D ODBC Pro ( 4D v14 R2)
4D ODBC Pro ( 4D v14 R4)