发行说明


41.8 Chapter 5. DB2 CLI Functions

41.8.1 SQLBindFileToParam - Bind LOB File Reference to LOB Parameter

SQLBindFileToParam() CLI 函数中的最后一个参数 IndicatorValue 当前被描述为“output (deferred)”。它应为“input (deferred)”。

|41.8.2 SQLColAttribute -- Return a Column Attribute

| | |

|SQL_DESC_AUTO_UNIQUE_VALUE 和 SQL_DESC_UPDATABLE 自变量的“Description”列增加了下列更新: |

|SQL_DESC_AUTO_UNIQUE_VALUE
|SQL_FALSE is returned in NumericAttributePtr |for all DB2 SQL data types. Currently DB2 CLI is not able to determine if |a column is an identity column, therefore SQL_FALSE is always returned. This |limitation does not fully conform to the ODBC specifications. Future versions |of DB2 CLI for Unix and Windows servers will provide auto-unique support.

|SQL_DESC_UPDATABLE
|Indicates if the column data type is an updateable data type: | |

|41.8.3 SQLGetData - Get Data From a Column

|

|以下文本替换 SQLGetData 的 SQLSTATE 表中的 SQLSTATE 22007 的 Explanation 列中的当前语句:

|Conversion from a string to a datetime format was indicated, but an invalid |string representation or value was specified, or the value was an invalid |date.

|41.8.4 SQLGetInfo - Get General Information

| |

|下列内容更正了“Information Returned by SQLGetInfo”下面的“Usage”一节中的信息: |

|41.8.5 SQLGetLength - Retrieve Length of A String Value

| |

|下列内容更正了“Table 113. SQLGetLength Arguments”中的脚注:

|Note: a This is in characters for DBCLOB data.

41.8.6 SQLNextResult - Associate Next Result Set with Another Statement Handle

应将以下文本添加至第 5 章“DB2 CLI Functions”:

41.8.6.1 Purpose

Specification: DB2 CLI 7.x

41.8.6.2 Syntax

SQLRETURN   SQLNextResult	(SQLHSTMT	StatementHandle1
			 	                         SQLHSTMT	StatementHandle2);

41.8.6.3 Function Arguments


表 14. SQLNextResult Arguments

Data Type Argument Use Description
SQLHSTMT StatementHandle input Statement handle.
SQLHSTMT StatementHandle input Statement handle.

41.8.6.4 Usage

A stored procedure returns multiple result sets by leaving one or more cursors open after exiting. The first result set is always accessed by using the statement handle that called the stored procedure. If multiple result sets are returned, either SQLMoreResults() or SQLNextResult() can be used to describe and fetch the result set.

SQLMoreResults() is used to close the cursor for the first result set and allow the next result set to be processed, whereas SQLNextResult() moves the next result set to StatementHandle2, without closing the cursor on StatementHandle1. Both functions return SQL_NO_DATA_FOUND if there are no result sets to be fetched.

Using SQLNextResult() allows result sets to be processed in any order once they have been transferred to other statement handles. Mixed calls to SQLMoreResults() and SQLNextResult() are allowed until there are no more cursors (open result sets) on StatementHandle1.

When SQLNextResult() returns SQL_SUCCESS, the next result set is no longer associated with StatementHandle1. Instead, the next result set is associated with StatementHandle2, as if a call to SQLExecDirect() had just successfully executed a query on StatementHandle2. The cursor, therefore, can be described using SQLNumResultSets(), SQLDescribeCol(), or SQLColAttribute().

After SQLNextResult() has been called, the result set now associated with StatementHandle2 is removed from the chain of remaining result sets and cannot be used again in either SQLNextResult() or SQLMoreResults(). This means that for 'n' result sets, SQLNextResult() can be called successfully at most 'n-1' times.

If SQLFreeStmt() is called with the SQL_CLOSE option, or SQLFreeHandle() is called with HandleType set to SQL_HANDLE_STMT, all pending result sets on this statement handle are discarded.

SQLNextResult() returns SQL_ERROR if StatementHandle2 has an open cursor or StatementHandle1 and StatementHandle2 are not on the same connection. If any errors or warnings are returned, SQLError() must always be called on StatementHandle1.

注意:
SQLMoreResults() also works with a parameterized query with an array of input parameter values specified with SQLParamOptions() and SQLBindParameter(). SQLNextResult(), however, does not support this.

41.8.6.5 Return Codes

41.8.6.6 Diagnostics


表 15. SQLNextResult SQLSTATE

SQLSTATE Description Explanation
40003 08S01 Communication Link failure. The communication link between the application and data source failed before the function completed.
58004 Unexpected system failure. Unrecoverable system error.
HY001 Memory allocation failure. DB2 CLI is unable to allocate the memory required to support execution or completion of the function.
HY010 Function sequence error.

The function was called while in a data-at-execute (SQLParamData(), SQLPutData()) operation.

StatementHandle2 has an open cursor associated with it.

The function was called while within a BEGIN COMPOUND and END COMPOUND SQL operation.

HY013 Unexpected memory handling error. DB2 CLI was unable to access the memory required to support execution or completion of the function.
HYT00 Time-out expired. The time-out period expired before the data source returned the result set. Time-outs are only supported on non-multitasking systems such as Windows 3.1 and Macintosh System 7. The time-out period can be set using the SQL_ATTR_QUERY_TIMEOUT attribute for SQLSetConnectAttr().

41.8.6.7 Restrictions

Only SQLMoreResults() can be used for parameterized queries.

41.8.6.8 References

|41.8.7 SQLSetEnvAttr - Set Environment Attribute

|

|以下是“Usage”的“Environment Attributes”一节中的附加环境属性: |

|SQL_ATTR_KEEPCTX
|A 32-bit integer value that specifies whether the context should be |kept when the environment handle is freed. This attribute should be set at |the environment level. It can be used by mutli-threaded applications to manage |contexts associated with each thread's connections, database resources, and |data transmission. The possible values are: |

|

|注意:
This is an IBM extension. |
|

|41.8.8 SQLSetStmtAttr — 设置与语句相关的选项

| |

|下列内容将替换语句属性 SQL_ATTR_QUERY_TIMEOUT 的现有信息: |

|SQL_ATTR_QUERY_TIMEOUT (DB2 CLI v2)
|A 32-bit integer value that is the number of seconds to wait for an |SQL statement to execute between returning to the application. This option |can be set and used to terminate long running queries. The value of 0 means there is no time out. DB2 CLI supports non-zero values for all |platforms that support multithreading. |


[ 页的顶部 | 上一页 | 下一页 | 目录 | 索引 ]