`
`SQLDrivers
`
`Related Functions
`
`For information about
`
`See
`
`Discovering and listing values required to
`connect to a data source
`Connecting to a data source
`Returning data source names
`Connecting to a data source using a
`connection string or dialog box
`
`SQLBrowseConnect (extension)
`
`SQLConnect
`SQLDataSources (extension)
`SQLDriverConnect (extension)
`
`Page 201 of 434
`
`RA v. AMS
`Ex. 1020
`
`(cid:9)
`
`
`SQLError
`
`Core (cid:9)
`
`Syntax
`
`SQLError (cid:9)
`
`287
`
`ODBC 1.0
`
`SQLError returns error or status information.
`
`RETCODE SQLError(henv, hdbc, hstmt, szSqlState, pfNativeError, szErrorMsg,
`cbErrorMsgMax, pcbErrorMsg)
`
`The SQLError function accepts the following arguments.
`
`Type (cid:9)
`HENV (cid:9)
`
`HDBC (cid:9)
`
`HSTMT (cid:9)
`
`Argument (cid:9)
`
`henv (cid:9)
`
`hdbc (cid:9)
`
`hstmt (cid:9)
`
`Use (cid:9)
`
`Input (cid:9)
`
`Input (cid:9)
`
`Input (cid:9)
`
`UCHAR FAR * (cid:9)
`
`szSqlState (cid:9)
`
`Output (cid:9)
`
`SDWORD FAR * (cid:9)
`
`pfNativeError (cid:9)
`
`Output (cid:9)
`
`UCHAR FAR * (cid:9)
`
`szErrorMsg (cid:9)
`
`Output (cid:9)
`
`SWORD (cid:9)
`
`cbErrorMsgMax (cid:9)
`
`Input (cid:9)
`
`SWORD FAR * (cid:9)
`
`pcbErrorMsg (cid:9)
`
`Output (cid:9)
`
`Description
`
`Environment handle or
`SQL_NULL_HENV.
`Connection handle or
`SQL_NULL_HDBC.
`Statement handle or
`SQL_14ULL_HSTMT.
`SQLSTATE as null-terminated
`string. For a list of
`SQLSTATEs, see Appendix A,
`"ODBC Error Codes."
`Native error code (specific to
`the data source).
`Pointer to storage for the error
`message text.
`Maximum length of the
`szErrorMsg buffer. This must
`be less than or equal to
`SQL_MAX_MESSAGE_
`LENGTH — 1.
`Pointer to the total number of
`bytes (excluding the null
`termination byte) available to
`return in szErrorMsg. If the
`number of bytes available to
`return is greater than or equal to
`cbErrorMsgMax, the error
`message text in szErrorMsg is
`truncated to cbErrorMsgMax
`— 1 bytes.
`
`Returns (cid:9)
`
`Diagnostics (cid:9)
`
`SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_NO_DATA_FOUND,
`SQL_ERROR, or SQL_INVALID_HANDLE.
`
`SQLError does not post error values for itself. SQLError returns
`SQL_NO_DATA_FOUND when it is unable to retrieve any error information, (in
`which case szSqlState equals 00000). If SQLError cannot access error values for
`
`Page 202 of 434
`
`RA v. AMS
`Ex. 1020
`
`
`
`288 (cid:9)
`
`SQLError
`
`Comments
`
`any reason that would normally return SQL_ERROR, SQLError returns
`SQL_ERROR but does not post any error values. If the buffer for the error
`message is too short, SQLError returns SQL_SUCCESS_WITH_INFO but,
`again, does not return a SQLSTATE value for SQLError.
`
`To determine that a truncation occurred in the error message, an application can
`compare cbErrorMsgMax to the actual length of the message text written to
`pcbErrorMsg.
`
`An application typically calls SQLError when a previous call to an ODBC
`function returns SQL_ERROR or SQL_SUCCESS_WITH_INFO. However, any
`ODBC function can post zero or more errors each time it is called, so an
`application can call SQLError after any ODBC function call.
`
`SQLError retrieves an error from the data structure associated with the rightmost
`non-null handle argument. An application requests error information as follows:
`
`n To retrieve errors associated with an environment, the application passes the
`corresponding henv and includes SQL_NULL_HDBC and
`SQL_NULL_HSTMT in hdbc and hstmt, respectively. The driver returns the
`error status of the ODBC function most recently called with the same henv.
`n To retrieve errors associated with a connection, the application passes the
`corresponding hdbc plus an hstmt equal to SQL_NULL_HSTMT. In such a
`case, the driver ignores the henv argument. The driver returns the error status
`of the ODBC function most recently called with the hdbc.
`n To retrieve errors associated with a statement, an application passes the
`corresponding hstmt. If the call to SQLError contains a valid hstmt, the driver
`ignores the hdbc and henv arguments. The driver returns the error status of the
`ODBC function most recently called with the hstmt.
`n To retrieve multiple errors for a function call, an application calls SQLError
`multiple times. For each error, the driver returns SQL_SUCCESS and removes
`that error from the list of available errors.
`
`When there is no additional information for the rightmost non-null handle,
`SQLError returns SQL_NO_DATA_FOUND. In this case, szSqlState equals
`00000 (Success), pfNativeError is undefined, pcbErrorMsg equals 0, and
`szErrorMsg contains a single null termination byte (unless cbErrorMsgMax
`equals 0).
`
`The Driver Manager stores error information in its henv, hdbc, and hstmt
`structures. Similarly, the driver stores error information in its henv, hdbc, and
`hstmt structures. When the application calls SQLError, the Driver Manager
`checks if there are any errors in its structure for the specified handle. If there are
`errors for the specified handle, it returns the first error; if there are no errors, it
`calls SQLError in the driver.
`
`Page 203 of 434
`
`RA v. AMS
`Ex. 1020
`
`
`
`SQLError (cid:9)
`
`289
`
`The Driver Manager can store up to 64 errors with an henv and its associated
`hdbcs and hstmts. When this limit is reached, the Driver Manager discards any
`subsequent errors posted on the Driver Manager's henv, hdbcs, or hstmts. The
`number of errors that a driver can store is driver-dependent.
`
`An error is removed from the structure associated with a handle when SQLError
`is called for that handle and returns that error. All errors stored for a given handle
`are removed when that handle is used in a subsequent function call. For example,
`errors on an hstmt that were returned by SQLExecDirect are removed when
`SQLExecDirect or SQLTables is called with that hstmt. The errors stored on a
`given handle are not removed as the result of a call to a function using an
`associated handle of a different type. For example, errors on an hdbc that were
`returned by SQLNativeSql are not removed when SQLError or SQLExecDirect
`is called with an hstmt associated with that hdbc.
`
`For more information about error codes, see Appendix A, "ODBC Error Codes."
`
`Related Functions None.
`
`Page 204 of 434
`
`RA v. AMS
`Ex. 1020
`
`
`
`290 (cid:9)
`SQLExecDirect
`SQLExecDirect
`
`ODBC 1.0
`
`Core
`
`SQLExecDirect executes a preparable statement, using the current values of the
`parameter marker variables if any parameters exist in the statement.
`SQLExecDirect is the fastest way to submit an SQL statement for one-time
`execution.
`
`Syntax (cid:9)
`
`RETCODE SQLExecDirect(hstmt, szSqlStr, cbSqlStr)
`
`Returns (cid:9)
`
`Diagnostics (cid:9)
`
`The SQLExecDirect function uses the following arguments.
`
`Type
`
`HSTMT
`UCHAR FAR *
`SDWORD
`
`Argument
`
`hstrnt
`szSqlStr
`cbSqlStr
`
`Use
`
`Input
`Input
`Input
`
`Description
`
`Statement handle.
`SQL statement to be executed.
`Length of szSqlStr.
`
`SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_NEED_DATA,
`SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.
`
`When SQLExecDirect returns either SQL_ERROR or
`SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value may be obtained
`by calling SQLError. The following table lists the SQLSTATE values commonly
`returned by SQLExecDirect and explains each one in the context of this function;
`the notation "(DM)" precedes the descriptions of SQLSTATEs returned by the
`Driver Manager. The return code associated with each SQLSTATE value is
`SQL_ERROR, unless noted otherwise.
`
`SQLSTATE (cid:9)
`
`Error
`
`Description
`
`01000 (cid:9)
`
`General warning (cid:9)
`
`01004 (cid:9)
`
`Data truncated (cid:9)
`
`Driver-specific informational message.
`(Function returns
`SQL_SUCCESS_WITH_INFO.)
`The argument szSqlStr contained an SQL
`statement that contained a character or
`binary parameter or literal and the value
`exceeded the maximum length of the
`associated table column.
`The argument szSqlStr contained an SQL
`statement that contained a numeric
`parameter or literal and the fractional part
`of the value was truncated.
`The argument szSqlStr contained an SQL
`statement that contained a date or time
`parameter or literal and a timestamp value
`was truncated.
`
`Page 205 of 434
`
`RA v. AMS
`Ex. 1020
`
`(cid:9)
`
`
`SQLSTATE (cid:9)
`
`Error (cid:9)
`
`Description
`
`SQLExecDirect (cid:9)
`
`291
`
`Privilege not (cid:9)
`revoked (cid:9)
`
`The argument szSq/Str contained a
`REVOKE statement and the user did not
`have the specified privilege. (Function
`returns SQL_SUCCESS_WITH_INFO.)
`No rows updated or The argument szSq/Str contained a
`positioned update or delete statement and
`deleted (cid:9)
`no rows were updated or deleted. (Function
`returns SQL_SUCCESS_WITH_INFO.)
`The argument szSq/Str contained a
`positioned update or delete statement and
`more than one row was updated or deleted.
`(Function returns
`SQL_SUCCESS_WITH_INFO.)
`The number of parameters specified in
`SQLBindParameter was less than the
`number of parameters in the SQL statement
`contained in the argument szSq/Str.
`The communication link between the driver
`and the data source to which the driver was
`connected failed before the function
`completed processing.
`The argument szSq/Str contained an
`INSERT statement and the number of
`values to be inserted did not match the
`degree of the derived table.
`The argument szSq/Str contained a
`CREATE VIEW statement and the
`number of names specified is not the same
`degree as the derived table defined by the
`query specification.
`The argument szSq/Str contained an SQL
`statement which contained a numeric
`parameter or literal and the value caused the
`whole (as opposed to fractional) part of the
`number to be truncated when assigned to
`the associated table column.
`Error in assignment The argument szSq/Str contained an SQL
`statement that contained a parameter or
`literal and the value was incompatible with
`the data type of the associated table
`column.
`
`01006 (cid:9)
`
`01S03 (cid:9)
`
`01SO4 (cid:9)
`
`07001 (cid:9)
`
`08S01 (cid:9)
`
`21S01 (cid:9)
`
`21S02 (cid:9)
`
`22003 (cid:9)
`
`22005 (cid:9)
`
`More than one row (cid:9)
`updated or deleted (cid:9)
`
`Wrong number of (cid:9)
`parameters (cid:9)
`
`Communication (cid:9)
`link failure (cid:9)
`
`Insert value list (cid:9)
`does not match (cid:9)
`column list (cid:9)
`
`Degree of derived (cid:9)
`table does not (cid:9)
`match column list (cid:9)
`
`Numeric value out (cid:9)
`of range (cid:9)
`
`Page 206 of 434
`
`RA v. AMS
`Ex. 1020
`
`
`
`292 (cid:9)
`
`SQLExecDirect
`
`SQLSTATE (cid:9)
`
`Error (cid:9)
`
`Description
`
`22008 (cid:9)
`
`22012 (cid:9)
`
`23000 (cid:9)
`
`24000 (cid:9)
`
`34000 (cid:9)
`
`37000 (cid:9)
`
`40001 (cid:9)
`
`42000 (cid:9)
`
`I1V1001 (cid:9)
`
`Datetime field (cid:9)
`overflow (cid:9)
`
`Division by zero (cid:9)
`
`Integrity constraint (cid:9)
`violation (cid:9)
`
`The argument szSq/Str contained an SQL
`statement that contained a date, time, or
`timestamp parameter or literal and the value
`was, respectively, an invalid date, time, or
`timestamp.
`The argument szSq/Str contained an SQL
`statement which contained an arithmetic
`expression which caused division by zero.
`The argument szSq/Str contained an SQL
`statement which contained a parameter or
`literal. The parameter value was NULL for
`a column defined as NOT NULL in the
`associated table column, a duplicate value
`was supplied for a column constrained to
`contain only unique values, or some other
`integrity constraint was violated.
`(DM) A cursor was open on the hstmt and
`SQLFetch or SQLExtendedFetch had
`been called.
`A cursor was open on the hstint but
`SQLFetch or SQLExtendedFetch had not
`been called.
`The argument szSq/Str contained a
`positioned update or delete statement and
`the cursor was positioned before the start of
`the result set or after the end of the result
`set.
`Invalid cursor name The argument szSq/Str contained a
`positioned update or delete statement and
`the cursor referenced by the statement
`being executed was not open.
`The argument szSq/Str contained an SQL
`statement that was not preparable or
`contained a syntax error.
`Serialization failure The transaction to which the SQL statement
`contained in the argument szSq/Str
`belonged was terminated to prevent
`deadlock.
`The user did not have permission to execute
`the SQL statement contained in the
`argument szSq/Str.
`(DM) The driver associated with the hstmt
`does not support the function.
`
`Invalid cursor state (cid:9)
`
`Syntax error or (cid:9)
`access violation (cid:9)
`
`Syntax error or (cid:9)
`access violation (cid:9)
`
`Driver does not (cid:9)
`support this (cid:9)
`function
`
`Page 207 of 434
`
`RA v. AMS
`Ex. 1020
`
`
`
`SQLSTATE (cid:9)
`
`Error (cid:9)
`
`Description
`
`SQLExecDirect (cid:9)
`
`293
`
`S0001 (cid:9)
`
`S0002 (cid:9)
`
`50011 (cid:9)
`
`S0012 (cid:9)
`
`Base table or view (cid:9)
`already exists (cid:9)
`
`Table or view not (cid:9)
`found (cid:9)
`
`The argument szSqlStr contained a
`CREATE TABLE or CREATE VIEW
`statement and the table name or view name
`specified already exists.
`The argument szSqlStr contained a DROP
`TABLE or a DROP VIEW statement and
`the specified table name or view name did
`not exist.
`The argument szSqlStr contained an
`ALTER TABLE statement and the
`specified table name did not exist.
`The argument szSqlStr contained a
`CREATE VIEW statement and a table
`name or view name defined by the query
`specification did not exist.
`The argument szSqlStr contained a
`CREATE INDEX statement and the
`specified table name did not exist.
`The argument szSqlStr contained a
`GRANT or REVOKE statement and the
`specified table name or view name did not
`exist.
`The argument szSqlStr contained a
`SELECT statement and a specified table
`name or view name did not exist.
`The argument szSqlStr contained a
`DELETE, INSERT, or UPDATE
`statement and the specified table name did
`not exist.
`The argument szSqlStr contained a
`CREATE TABLE statement and a table
`specified in a constraint (referencing a table
`other than the one being created) did not
`exist.
`Index already exists The argument szSqlStr contained a
`CREATE INDEX statement and the
`specified index name already existed.
`The argument szSqlStr contained a DROP
`INDEX statement and the specified index
`name did not exist.
`
`Index not found (cid:9)
`
`Page 208 of 434
`
`RA v. AMS
`Ex. 1020
`
`
`
`294 (cid:9)
`
`SQLExecDirect
`
`SQLSTATE (cid:9)
`
`Error (cid:9)
`
`Description
`
`S0021
`
`Column already
`exists
`
`S0022
`
`Column not found
`
`S1000
`
`General error
`
`51001
`
`S1008
`
`Memory allocation
`failure
`
`Operation canceled
`
`S1009
`
`Invalid argument
`value
`
`The argument szSqlStr contained an
`ALTER TABLE statement and the column
`specified in the ADD clause is not unique
`or identifies an existing column in the base
`table.
`The argument szSqlStr contained a
`CREATE INDEX statement and one or
`more of the column names specified in the
`column list did not exist.
`The argument szSqlStr contained a
`GRANT or REVOKE statement and a
`specified column name did not exist.
`The argument szSqlStr contained a
`SELECT, DELETE, INSERT, or
`UPDATE statement and a specified column
`name did not exist.
`The argument szSqlStr contained a
`CREATE TABLE statement and a column
`specified in a constraint (referencing a table
`other than the one being created) did not
`exist.
`An error occurred for which there was no
`specific SQLSTATE and for which no
`implementation-specific SQLSTATE was
`defined. The error message returned by
`SQLError in the argument szErrorMsg
`describes the error and its cause.
`The driver was unable to allocate memory
`required to support execution or completion
`of the function.
`Asynchronous processing was enabled for
`the hstmt. The function was called and
`before it completed execution, SQLCancel
`was called on the hstmt. Then the function
`was called again on the hstmt.
`The function was called and, before it
`completed execution, SQLCancel was
`called on the hstmt from a different thread
`in a multithreaded application.
`(DM) The argument szSqlStr was a null
`pointer.
`
`Page 209 of 434
`
`RA v. AMS
`Ex. 1020
`
`(cid:9)
`(cid:9)
`(cid:9)
`(cid:9)
`(cid:9)
`(cid:9)
`
`
`SQLSTATE
`
`Error
`
`Description
`
`SQLExecDirect (cid:9)
`
`295
`
`S1010 (cid:9)
`
`Function sequence (cid:9)
`error (cid:9)
`
`S1090 (cid:9)
`
`Invalid string or (cid:9)
`buffer length (cid:9)
`
`S1109 (cid:9)
`
`Invalid cursor (cid:9)
`position (cid:9)
`
`S1C00 (cid:9)
`
`Driver not capable (cid:9)
`
`SlT00 (cid:9)
`
`Timeout expired (cid:9)
`
`(DM) An asynchronously executing
`function (not this one) was called for the
`hstmt and was still executing when this
`function was called.
`(DM) SQLExecute, SQLExecDirect, or
`SQLSetPos was called for the hstmt and
`returned SQL_NEED_DATA. This
`function was called before data was sent for
`all data-at-execution parameters or
`columns.
`(DM) The argument cbSqlStr was less than
`or equal to 0, but not equal to SQL_NTS.
`A parameter value, set with
`SQLBindParameter, was a null pointer
`and the parameter length value was not 0,
`SQL_NULL_DATA,
`SQL_DATA_AT_EXEC, or less than or
`equal to
`SQL_LEN_DATA_AT_EXEC_OFFSET.
`A parameter value, set with
`SQLBindParameter, was not a null
`pointer and the parameter length value was
`less than 0, but was not SQL_NTS,
`SQL_NULL_DATA,
`SQL_DATA_AT_EXEC, or less than or
`equal to
`SQL_LEN_DATA_AT_EXEC_OFFSET.
`The argument szSqlStr contained a
`positioned update or delete statement and
`the cursor was positioned (by SQLSetPos
`or SQLExtendedFetch) on a row for
`which the value in the rgfRowStatus array
`in SQLExtendedFetch was
`SQL_ROW_DELETED or
`SQL_ROW_ERROR.
`The combination of the current settings of
`the SQL_CONCURRENCY and
`SQL_CURSOR_TYPE statement options
`was not supported by the driver or data
`source.
`The timeout period expired before the data
`source returned the result set. The timeout
`period is set through SQLSetStmtOption,
`SQL_QUERY_TIMEOUT.
`
`Page 210 of 434
`
`RA v. AMS
`Ex. 1020
`
`
`
`296 (cid:9)
`
`SQLExecDirect
`
`Comments
`
`The application calls SQLExecDirect to send an SQL statement to the data
`source. The driver modifies the statement to use the form of SQL used by the data
`source, then submits it to the data source. In particular, the driver modifies the
`escape clauses used to define ODBC-specific SQL. For a description of SQL
`statement grammar, see "Supporting ODBC Extensions to SQL" in Chapter 14
`and Appendix C, "SQL Grammar."
`
`The application can include one or more parameter markers in the SQL statement.
`To include a parameter marker, the application embeds a question mark (?) into
`the SQL statement at the appropriate position.
`
`If the SQL statement is a SELECT statement, and if the application called
`SQLSetCursorName to associate a cursor with an hstmt, then the driver uses the
`specified cursor. Otherwise, the driver generates a cursor name.
`
`If the data source is in manual-commit mode (requiring explicit transaction
`initiation), and a transaction has not already been initiated, the driver initiates a
`transaction before it sends the SQL statement.
`
`If an application uses SQLExecDirect to submit a COMMIT or ROLLBACK
`statement, it will not be interoperable between DBMS products. To commit or roll
`back a transaction, call SQLTransact.
`
`If SQLExecDirect encounters a data-at-execution parameter, it returns
`SQL_NEED_DATA. The application sends the data using SQLParamData and
`SQLPutData. See SQLBindParameter, SQLParamOptions, SQLParamData,
`and SQLPutData for more information.
`
`Code Example (cid:9)
`
`See SQLBindCol, SQLExtendedFetch, SQLGetData, and SQLProcedures.
`
`Related Functions
`
`For information about (cid:9)
`
`Assigning storage for a column in a result (cid:9)
`set
`Canceling statement processing
`Executing a prepared SQL statement
`Fetching a block of data or scrolling
`through a result set
`Fetching a row of data
`Returning a cursor name
`Fetching part or all of a column of data
`Returning the next parameter to send data
`for
`
`See
`
`SQLBindCol
`
`SQLCancel
`SQLExecute
`SQLExtendedFetch (extension)
`
`SQLFetch
`SQLGetCursorName
`SQLGetData (extension)
`SQLParamData (extension)
`
`Page 211 of 434
`
`RA v. AMS
`Ex. 1020
`
`
`
`SQLExecDirect (cid:9)
`
`297
`
`For information about
`
`Preparing a statement for execution
`Sending parameter data at execution time
`Setting a cursor name
`Setting a statement option
`Executing a commit or rollback operation
`
`See
`SQLPrepare
`SQLPutData (extension)
`SQLSetCursorName
`SQLSetStmtOption (extension)
`SQLTransact
`
`Page 212 of 434
`
`RA v. AMS
`Ex. 1020
`
`(cid:9)
`
`
`298 (cid:9)
`
`SQLExecute
`
`SQLExecute
`
`ODBC 1.0
`
`Core (cid:9)
`
`Syntax (cid:9)
`
`Returns (cid:9)
`
`Diagnostics (cid:9)
`
`SQLExecute executes a prepared statement, using the current values of the
`parameter marker variables if any parameter markers exist in the statement.
`
`RETCODE SQLExecute(hstmt)
`
`The SQLExecute statement accepts the following argument.
`
`Type (cid:9)
`
`HS TMT (cid:9)
`
`Argument (cid:9)
`
`hstmt (cid:9)
`
`Use (cid:9)
`
`Input (cid:9)
`
`Description
`
`Statement handle.
`
`SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_NEED_DATA,
`SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.
`
`When SQLExecute returns either SQL_ERROR or
`SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value may be obtained
`by calling SQLError. The following table lists the SQLSTATE values commonly
`returned by SQLExecute and explains each one in the context of this function;
`the notation "(DM)" precedes the descriptions of SQLSTATEs returned by the
`Driver Manager. The return code associated with each SQLSTATE value is
`SQL_ERROR, unless noted otherwise.
`
`SQLSTATE
`
`Error (cid:9)
`
`01000 (cid:9)
`
`01004 (cid:9)
`
`General warning (cid:9)
`
`Data truncated (cid:9)
`
`01006 (cid:9)
`
`Privilege not (cid:9)
`revoked (cid:9)
`
`Description
`Driver-specific informational message.
`(Function returns
`SQL_SUCCESS_WITH_INFO.)
`The prepared statement associated with the
`hstmt contained a character or binary
`parameter or literal and the value exceeded
`the maximum length of the associated table
`column.
`The prepared statement associated with the
`hstmt contained a numeric parameter or
`literal and the fractional part of the value
`was truncated.
`The prepared statement associated with the
`hstmt contained a date or time parameter or
`literal and a timestamp value was truncated.
`The prepared statement associated with the
`hstmt was REVOKE and the user did not
`have the specified privilege. (Function
`returns SQL_SUCCESS_WITH_INFO.)
`
`Page 213 of 434
`
`RA v. AMS
`Ex. 1020
`
`
`
`SQLSTATE (cid:9)
`
`Error (cid:9)
`
`Description
`
`SQLExecute (cid:9)
`
`299
`
`01S03 (cid:9)
`
`01SO4 (cid:9)
`
`07001 (cid:9)
`
`08S01 (cid:9)
`
`22003 (cid:9)
`
`22005 (cid:9)
`
`22008 (cid:9)
`
`22012 (cid:9)
`
`23000 (cid:9)
`
`More than one row (cid:9)
`updated or deleted (cid:9)
`
`Wrong number of (cid:9)
`parameters (cid:9)
`
`Communication (cid:9)
`link failure (cid:9)
`
`Numeric value out (cid:9)
`of range (cid:9)
`
`No rows updated or The prepared statement associated with the
`deleted (cid:9)
`hstmt was a positioned update or delete
`statement and no rows were updated or
`deleted. (Function returns
`SQL_SUCCESS_WITH_INFO.)
`The prepared statement associated with the
`hstmt was a positioned update or delete
`statement and more than one row was
`updated or deleted. (Function returns
`SQL_SUCCESS_WITH_INFO.)
`The number of parameters specified in
`SQLBindParameter was less than the
`number of parameters in the prepared
`statement associated with the hstmt.
`The communication link between the driver
`and the data source to which the driver was
`connected failed before the function
`completed processing.
`The prepared statement associated with the
`hstmt contained a numeric parameter and
`the parameter value caused the whole (as
`opposed to fractional) part of the number to
`be truncated when assigned to the
`associated table column.
`Error in assignment The prepared statement associated with the
`hstmt contained a parameter and the value
`was incompatible with the data type of the
`associated table column.
`The prepared statement associated with the
`hstmt contained a date, time, or timestamp
`parameter or literal and the value was,
`respectively, an invalid date, time, or
`timestamp.
`The prepared statement associated with the
`hstmt contained an arithmetic expression
`which caused division by zero.
`The prepared statement associated with the
`hstmt contained a parameter. The parameter
`value was NULL for a column defined as
`NOT NULL in the associated table column,
`a duplicate value was supplied for a column
`constrained to contain only unique values,
`or some other integrity constraint was
`violated.
`
`Datetime field (cid:9)
`overflow (cid:9)
`
`Division by zero (cid:9)
`
`Integrity constraint (cid:9)
`violation (cid:9)
`
`Page 214 of 434
`
`RA v. AMS
`Ex. 1020
`
`
`
`300 (cid:9)
`
`SQLExecute
`
`SQLSTATE (cid:9)
`
`Error (cid:9)
`
`Description
`
`24000 (cid:9)
`
`Invalid cursor state
`
`40001
`
`Serialization failure
`
`42000
`
`IN4001
`
`51000
`
`Syntax error or
`access violation
`
`Driver does not
`support this
`function
`General error
`
`51001
`
`Memory allocation
`failure
`
`51008
`
`Operation canceled
`
`(DM) A cursor was open on the hstmt and
`SQLFetch or SQLExtendedFetch had
`been called.
`A cursor was open on the hstmt but
`SQLFetch or SQLExtendedFetch had not
`been called.
`The prepared statement associated with the
`hstmt contained a positioned update or
`delete statement and the cursor was
`positioned before the start of the result set
`or after the end of the result set.
`The transaction to which the prepared
`statement associated with the hstmt
`belonged was terminated to prevent
`deadlock.
`The user did not have permission to execute
`the prepared statement associated with the
`hstmt.
`(DM) The driver associated with the hstmt
`does not support the function.
`
`An error occurred for which there was no
`specific SQLSTATE and for which no
`implementation-specific SQLSTATE was
`defined. The error message returned by
`SQLError in the argument szErrorMsg
`describes the error and its cause.
`The driver was unable to allocate memory
`required to support execution or completion
`of the function.
`Asynchronous processing was enabled for
`the hstmt. The function was called and
`before it completed execution, SQLCancel
`was called on the hstmt. Then the function
`was called again on the hstmt.
`The function was called and, before it
`completed execution, SQLCancel was
`called on the hstmt from a different thread
`in a multithreaded application.
`
`Page 215 of 434
`
`RA v. AMS
`Ex. 1020
`
`(cid:9)
`(cid:9)
`(cid:9)
`
`
`SQLSTATE (cid:9)
`
`Error (cid:9)
`
`Description
`
`SQLExecute (cid:9)
`
`301
`
`S1010 (cid:9)
`
`Function sequence (cid:9)
`error (cid:9)
`
`S1090 (cid:9)
`
`Invalid string or (cid:9)
`buffer length (cid:9)
`
`S1109 (cid:9)
`
`Invalid cursor (cid:9)
`position (cid:9)
`
`(DM) An asynchronously executing
`function (not this one) was called for the
`hstmt and was still executing when this
`function was called.
`(DM) SQLExecute, SQLExecDirect, or
`SQLSetPos was called for the hstmt and
`returned SQL_NEED_DATA. This
`function was called before data was sent for
`all data-at-execution parameters or
`columns.
`(DM) The hstmt was not prepared. Either
`the hstmt was not in an executed state, or a
`cursor was open on the hstmt and
`SQLFetch or SQLExtendedFetch had
`been called.
`The hstmt was not prepared. It was in an
`executed state and either no result set was
`associated with the hstmt or SQLFetch or
`SQLExtendedFetch had not been called.
`A parameter value, set with
`SQLBindParameter, was a null pointer
`and the parameter length value was not 0,
`SQL_NULL_DATA,
`SQL_DATA_AT_EXEC, or less than or
`equal to
`SQL_LEN_DATA_AT_EXEC_OFFSET.
`A parameter value, set with
`SQLBindParameter, was not a null
`pointer and the parameter length value was
`less than 0, but was not SQL_NTS,
`SQL_NULL_DATA, or
`SQL_DATA_AT_EXEC, or less than or
`equal to
`SQL_LEN_DATA_AT_EXEC_OFFSET.
`The prepared statement was a positioned
`update or delete statement and the cursor
`was positioned (by SQLSetPos or
`SQLExtendedFetch) on a row for which
`the value in the rgfRowStatus array in
`SQLExtendedFetch was
`SQL_ROW_DELETED or
`SQL_ROW_ERROR.
`
`Page 216 of 434
`
`RA v. AMS
`Ex. 1020
`
`
`
`302 (cid:9)
`
`SQLExecute
`
`SQLSTATE
`
`Error (cid:9)
`
`Description
`
`S 1C00 (cid:9)
`
`Driver not capable (cid:9)
`
`S 1T00 (cid:9)
`
`Timeout expired (cid:9)
`
`The combination of the current settings of
`the SQL_CONCURRENCY and
`SQL_CURSOR_TYPE statement options
`was not supported by the driver or data
`source.
`The timeout period expired before the data
`source returned the result set. The timeout
`period is set through SQLSetStmtOption,
`S QL_QUERY_TIMEOUT.
`
`SQLExecute can return any SQLSTATE that can be returned by SQLPrepare
`based on when the data source evaluates the SQL statement associated with the
`hstmt.
`
`Comments
`
`SQLExecute executes a statement prepared by SQLPrepare. Once the
`application processes or discards the results from a call to SQLExecute, the
`application can call SQLExecute again with new parameter values.
`
`To execute a SELECT statement more than once, the application must call
`SQLFreeStmt with the SQL_CLOSE parameter before reissuing the SELECT
`statement.
`
`If the data source is in manual-commit mode (requiring explicit transaction
`initiation), and a transaction has not already been initiated, the driver initiates a
`transaction before it sends the SQL statement.
`
`If an application uses SQLPrepare to prepare and SQLExecute to submit a
`COMMIT or ROLLBACK statement, it will not be interoperable between
`DBMS products. To commit or roll back a transaction, call SQLTransact.
`
`If SQLExecute encounters a data-at-execution parameter, it returns
`SQL_NEED_DATA. The application sends the data using SQLParamData and
`SQLPutData. See SQLBindParameter, SQLParamOptions, SQLParamData,
`and SQLPutData for more information.
`See SQLBindParameter, SQLParamOptions, SQLPutData, and SQLSetPos.
`
`Code Example (cid:9)
`
`Related Functions
`
`For information about (cid:9)
`
`Assigning storage for a column in a result (cid:9)
`set
`Canceling statement processing (cid:9)
`Executing an SQL statement (cid:9)
`Fetching a block of data or scrolling (cid:9)
`through a result set
`Fetching a row of data (cid:9)
`
`See
`
`SQLBindCol
`
`SQLCancel .
`SQLExecDirect
`SQLExtendedFetch (extension)
`
`SQLFetch
`
`Page 217 of 434
`
`RA v. AMS
`Ex. 1020
`
`
`
`SQLExecute (cid:9)
`
`303
`
`For information about
`
`Freeing a statement handle
`Returning a cursor name
`Fetching part or all of a column of data
`Returning the next parameter to send data
`for
`Preparing a statement for execution
`Sending parameter data at execution time
`Setting a cursor name
`Setting a statement option
`Executing a commit or rollback operation
`
`See
`SQLFreeStmt
`SQLGetCursorName
`SQLGetData (extension)
`SQLParamData (extension)
`
`SQLPrepare
`SQLPutData (extension)
`SQLSetCursorName
`SQLSetStmtOption (extension)
`SQLTransact
`
`Page 218 of 434
`
`RA v. AMS
`Ex. 1020
`
`(cid:9)
`
`
`304 (cid:9)
`
`SQLExtendedFetch
`
`SQLExtendedFetch
`
`ODBC
`
`Extension Level 2
`
`SQLExtendedFetch extends the functionality of SQLFetch in the following
`ways:
`
`• It returns rowset data (one or more rows), in the form of an array, for each
`bound column.
`• It scrolls through the result set according to the setting of a scroll-type
`argument.
`
`SQLExtendedFetch works in conjunction with SQLSetStmtOption.
`
`To fetch one row of data at a time in a forward direction, an application should
`call SQLFetch.
`
`For more information about scrolling through result sets, see "Using Block and
`Scrollable Cursors" in Chapter 7, "Retrieving Results."
`
`Syntax
`
`RETCODE SQLExtendedFetch(hstmt, fFetchType, irow, perow, rgfRowStatus)
`
`The SQLExtendedFetch function accepts the following arguments:
`
`Type (cid:9)
`HSTMT (cid:9)
`UWORD (cid:9)
`
`Argument (cid:9)
`hstmt (cid:9)
`fFetchType (cid:9)
`
`SDWORD (cid:9)
`
`irow (cid:9)
`
`UDWORD FAR *
`
`perow (cid:9)
`
`UWORD FAR * (cid:9)
`
`rgfRowStatus (cid:9)
`
`Use (cid:9)
`Input (cid:9)
`Input (cid:9)
`
`Input (cid:9)
`
`Description
`Statement handle.
`Type of fetch. For more
`information, see the
`"Comments" section.
`Number of the row to fetch. For
`more information, see the
`"Comments" section.
`Output Number of rows actually
`fetched.
`An array of status values. For
`more information, see the
`"Comments" section.
`
`Output (cid:9)
`
`Returns (cid:9)
`
`Diagnostics (cid:9)
`
`SQL SUCCESS, SQL SUCCESS_WITH_INFO, SQL_NO DATA_FOUND,
`
`—
`I SQL1STILL_EXECUT— NG, SQL_ERROR, or SQL_INVALID_HANDLE.
`
`
`When SQLExtendedFetch returns either SQL_ERROR or
`SQL SUCCESS_WITH_INFO, an associated SQLSTATE value may be obtained
`by calling SQLError. The following table lists the SQLSTATE values commonly
`returned by SQLExtendedFetch and explains each one in the context of this
`function; the notation "(DM)" precedes the descriptions of SQLSTATEs returned
`by the Driver Manager. The return code associated with each SQLSTATE value is
`SQL_ERROR, unless noted otherwise.
`
`Page 219 of 434
`
`RA v. AMS
`Ex. 1020
`
`
`
`SQLSTATE
`
`Erro