4D v13

ODBC_SQLGetDiagField

Home

 
4D v13
ODBC_SQLGetDiagField

ODBC_SQLGetDiagField 


 

ODBC_SQLGetDiagField ( handleType ; handleID ; recNb ; diagID ; diagInfoPtr ; stringLengthPtr ) -> Function result 
Parameter Type   Description
handleType  Longint in Type of ID to pass to handleID
handleID  Longint in Handle ID for the diagnostic data structure
recNb  Longint in Indicates the status record from which the application seeks information
diagID  Longint in Indicates the field of the diagnostic whose value is to be returned
diagInfoPtr  Pointer in Pointer to a variable in which to return the diagnostic information. The data type depends on the value of diagID
stringLengthPtr  Pointer in Total length of the string returned in diagInfoPtr
Function result  Longint in Returns the result of the MS ODBC API function SQLGetDiagField

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 theparameter 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 Reference at http://msdn.microsoft.com/en-us/library/ms710181(VS.85).aspx.

SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_ERROR, SQL_INVALID_HANDLE, or SQL_NO_DATA.

 
PROPERTIES 

Product: 4D
Theme: ODBC_Results
Number: 16955

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: 4D ODBC Pro 2004

 
SEE ALSO 

ODBC_SetErrorHandler
ODBC_SQLGetDiagRec