SQLGetData 函数SQLGetData Function

符合性Conformance
版本引入了:ODBC 1.0 标准符合性:ISO 92Version Introduced: ODBC 1.0 Standards Compliance: ISO 92

摘要Summary
SQLGetData检索结果集中的单个列或之后的单个参数数据SQLParamData返回 SQL_PARAM_DATA_AVAILABLE。SQLGetData retrieves data for a single column in the result set or for a single parameter after SQLParamData returns SQL_PARAM_DATA_AVAILABLE. 它可以多次调用来检索部分中的可变长度数据。It can be called multiple times to retrieve variable-length data in parts.

语法Syntax

  
SQLRETURN SQLGetData(  
      SQLHSTMT       StatementHandle,  
      SQLUSMALLINT   Col_or_Param_Num,  
      SQLSMALLINT    TargetType,  
      SQLPOINTER     TargetValuePtr,  
      SQLLEN         BufferLength,  
      SQLLEN *       StrLen_or_IndPtr);  

参数Arguments

StatementHandleStatementHandle
[输入]语句句柄。[Input] Statement handle.

Col_or_Param_NumCol_or_Param_Num
[输入]对于检索列数据,它是列的要为其返回数据数。[Input] For retrieving column data, it is the number of the column for which to return data. 结果集列在不断增加的列顺序从 1 开始编号。Result set columns are numbered in increasing column order starting at 1. 书签列是列号为 0;这可以是仅在指定是否启用书签。The bookmark column is column number 0; this can be specified only if bookmarks are enabled.

用于检索参数数据,它是从 1 开始的参数的序号。For retrieving parameter data, it is the ordinal of the parameter, which starts at 1.

TargetTypeTargetType
[输入]C 数据类型的类型标识符 *TargetValuePtr缓冲区。[Input] The type identifier of the C data type of the *TargetValuePtr buffer. 有关有效的 C 数据类型和类型标识符的列表,请参阅C 数据类型附录 d: 中的部分数据类型。For a list of valid C data types and type identifiers, see the C Data Types section in Appendix D: Data Types.

如果TargetType是 SQL_ARD_TYPE,驱动程序使用 ARD SQL_DESC_CONCISE_TYPE 字段中指定的类型标识符。If TargetType is SQL_ARD_TYPE, the driver uses the type identifier specified in the SQL_DESC_CONCISE_TYPE field of the ARD. 如果TargetType是 SQL_APD_TYPE, SQLGetData将使用相同的 C 数据类型中指定SQLBindParameterIf TargetType is SQL_APD_TYPE, SQLGetData will use the same C data type that was specified in SQLBindParameter. C 数据类型中的指定,否则SQLGetData重写中指定的 C 数据类型SQLBindParameterOtherwise, the C data type specified in SQLGetData overrides the C data type specified in SQLBindParameter. 如果它为 SQL_C_DEFAULT,驱动程序将选择基于源的 SQL 数据类型的默认 C 数据类型。If it is SQL_C_DEFAULT, the driver selects the default C data type based on the SQL data type of the source.

此外可以指定扩展的 C 数据类型。You can also specify an extended C data type. 有关详细信息,请参阅ODBC 中的 C 数据类型For more information, see C Data Types in ODBC.

TargetValuePtrTargetValuePtr
[输出]指向用于返回数据缓冲区的指针。[Output] Pointer to the buffer in which to return the data.

TargetValuePtr不能为 NULL。TargetValuePtr cannot be NULL.

BufferLengthBufferLength
[输入]长度 *TargetValuePtr以字节为单位的缓冲区。[Input] Length of the *TargetValuePtr buffer in bytes.

驱动程序使用BufferLength以免超出末尾的编写* TargetValuePtr缓冲时返回可变长度数据,如字符或二进制数据。The driver uses BufferLength to avoid writing past the end of the *TargetValuePtr buffer when returning variable-length data, such as character or binary data. 请注意,驱动程序将 null 终止字符,返回字符数据时记* TargetValuePtrNote that the driver counts the null-termination character when returning character data to *TargetValuePtr.\ **TargetValuePtr*因此必须包含 null 终止字符的空间或驱动程序将截断数据。\ *TargetValuePtr must therefore contain space for the null-termination character, or the driver will truncate the data.

当驱动程序返回固定长度的数据,如整数或日期结构时,驱动程序会忽略BufferLength并假定缓冲区足够大以保存数据。When the driver returns fixed-length data, such as an integer or a date structure, the driver ignores BufferLength and assumes the buffer is large enough to hold the data. 因此对于应用程序为固定长度的数据分配足够大的缓冲区或驱动程序将写入缓冲区的结束。It is therefore important for the application to allocate a large enough buffer for fixed-length data or the driver will write past the end of the buffer.

SQLGetData返回 SQLSTATE HY090 (字符串或缓冲区长度无效) 时BufferLength是小于 0,但不是在时BufferLength为 0。SQLGetData returns SQLSTATE HY090 (Invalid string or buffer length) when BufferLength is less than 0 but not when BufferLength is 0.

StrLen_or_IndPtrStrLen_or_IndPtr
[输出]要返回的长度或指示器值在其中的缓冲区的指针。[Output] Pointer to the buffer in which to return the length or indicator value. 如果这是 null 指针,则返回没有长度或指示器的值。If this is a null pointer, no length or indicator value is returned. 这将返回错误时要提取的数据为 NULL。This returns an error when the data being fetched is NULL.

SQLGetData可以返回的长度/指示器缓冲区中的以下值:SQLGetData can return the following values in the length/indicator buffer:

  • 可用于返回的数据的长度The length of the data available to return

  • SQL_NO_TOTALSQL_NO_TOTAL

  • SQL_NULL_DATASQL_NULL_DATA

有关详细信息,请参阅使用长度/指示器值和本主题中的"注释"。For more information, see Using Length/Indicator Values and "Comments" in this topic.

返回Returns

SQL_SUCCESS、 SQL_SUCCESS_WITH_INFO、 SQL_NO_DATA、 SQL_STILL_EXECUTING、 SQL_ERROR 或 SQL_INVALID_HANDLE。SQL_SUCCESS, SQL_SUCCESS_WITH_INFO, SQL_NO_DATA, SQL_STILL_EXECUTING, SQL_ERROR, or SQL_INVALID_HANDLE.

诊断Diagnostics

SQLGetData返回 SQL_ERROR 或 SQL_SUCCESS_WITH_INFO,可以通过调用获取关联的 SQLSTATE 值SQLGetDiagRecHandleType的SQL_HANDLE_STMT 和一个处理StatementHandleWhen SQLGetData returns either SQL_ERROR or SQL_SUCCESS_WITH_INFO, an associated SQLSTATE value can be obtained by calling SQLGetDiagRec with a HandleType of SQL_HANDLE_STMT and a Handle of StatementHandle. 下表列出了通常返回的 SQLSTATE 值SQLGetData ,并解释了此函数; 每个上下文中的表示法"(数据挖掘)"之前 SQLSTATEs 返回由驱动程序管理器的说明。The following table lists the SQLSTATE values commonly returned by SQLGetData and explains each one in the context of this function; the notation "(DM)" precedes the descriptions of SQLSTATEs returned by the Driver Manager. 与每个 SQLSTATE 值关联的返回代码是 SQL_ERROR,除非另有说明。The return code associated with each SQLSTATE value is SQL_ERROR, unless noted otherwise.

SQLSTATESQLSTATE ErrorError 描述Description
0100001000 常规警告General warning 特定于驱动程序的信息性消息。Driver-specific informational message. (函数返回 SQL_SUCCESS_WITH_INFO。)(Function returns SQL_SUCCESS_WITH_INFO.)
0100401004 字符串数据,右截断String data, right truncated 并非所有指定列的数据Col_or_Param_Num,可以在对函数的单个调用中检索。Not all of the data for the specified column, Col_or_Param_Num, could be retrieved in a single call to the function. SQL_NO_TOTAL 或保留在之前的当前调用的指定列中的数据的长度SQLGetData中返回* StrLen_or_IndPtrSQL_NO_TOTAL or the length of the data remaining in the specified column prior to the current call to SQLGetData is returned in *StrLen_or_IndPtr. (函数返回 SQL_SUCCESS_WITH_INFO。)(Function returns SQL_SUCCESS_WITH_INFO.)

有关详细信息进行多次调用SQLGetData单个列,请参阅"注释"。For more information on using multiple calls to SQLGetData for a single column, see "Comments."
01S0701S07 截断小数部分Fractional truncation 返回一个或多个列的数据已被截断。The data returned for one or more columns was truncated. 对于数值数据类型,数字的小数部分被截断。For numeric data types, the fractional part of the number was truncated. 对于时间、 时间戳和 interval 数据类型包含时间部分,时间的小数部分被截断。For time, timestamp, and interval data types containing a time component, the fractional portion of the time was truncated.

(函数返回 SQL_SUCCESS_WITH_INFO。)(Function returns SQL_SUCCESS_WITH_INFO.)
0700607006 受限制的数据类型属性冲突Restricted data type attribute violation 在结果集中的列的数据值不能转换为参数指定的 C 数据类型TargetTypeThe data value of a column in the result set cannot be converted to the C data type specified by the argument TargetType.
0700907009 描述符索引无效Invalid descriptor index 为参数指定的值Col_or_Param_Num为 0,并将 SQL_ATTR_USE_BOOKMARKS 语句属性设置为 SQL_UB_OFF。The value specified for the argument Col_or_Param_Num was 0, and the SQL_ATTR_USE_BOOKMARKS statement attribute was set to SQL_UB_OFF.

为参数指定的值Col_or_Param_Num大于结果集中的列数。The value specified for the argument Col_or_Param_Num was greater than the number of columns in the result set.

Col_or_Param_Num值不是等于提供的参数的序号。The Col_or_Param_Num value was not equal to the ordinal of the parameter that is available.

(DM) 指定的列被绑定。(DM) The specified column was bound. 此说明不适用于返回 SQL_GD_BOUND 位掩码中的 SQL_GETDATA_EXTENSIONS 选项的驱动程序SQLGetInfoThis description does not apply to drivers that return the SQL_GD_BOUND bitmask for the SQL_GETDATA_EXTENSIONS option in SQLGetInfo.

(DM) 指定的列数为小于或等于最大的绑定列数。(DM) The number of the specified column was less than or equal to the number of the highest bound column. 此说明不适用于返回 SQL_GD_ANY_COLUMN 位掩码中的 SQL_GETDATA_EXTENSIONS 选项的驱动程序SQLGetInfoThis description does not apply to drivers that return the SQL_GD_ANY_COLUMN bitmask for the SQL_GETDATA_EXTENSIONS option in SQLGetInfo.

(DM) 已调用应用程序SQLGetData当前行; 在当前调用中指定的列数已在前面的调用; 中指定的列数小于和驱动程序不会返回 SQL_GD_ANY_ORDER SQL_GETDATA_EXTENSIONS 选项中的位掩码SQLGetInfo(DM) The application has already called SQLGetData for the current row; the number of the column specified in the current call was less than the number of the column specified in the preceding call; and the driver does not return the SQL_GD_ANY_ORDER bitmask for the SQL_GETDATA_EXTENSIONS option in SQLGetInfo.

(数据挖掘) TargetType参数为 SQL_ARD_TYPE,并Col_or_Param_Num ARD 中的描述符记录未通过一致性检查。(DM) The TargetType argument was SQL_ARD_TYPE, and the Col_or_Param_Num descriptor record in the ARD failed the consistency check.

(数据挖掘) TargetType参数为 SQL_ARD_TYPE,和 ARD SQL_DESC_COUNT 字段中的值是小于Col_or_Param_Num参数。(DM) The TargetType argument was SQL_ARD_TYPE, and the value in the SQL_DESC_COUNT field of the ARD was less than the Col_or_Param_Num argument.
08S0108S01 通讯链接失败Communication link failure 该驱动程序和驱动程序已连接到数据源之间的通信链接失败之前函数已完成处理。The communication link between the driver and the data source to which the driver was connected failed before the function completed processing.
2200222002 需要指示器变量,但未提供Indicator variable required but not supplied StrLen_or_IndPtr是空指针,而 NULL 的数据检索。StrLen_or_IndPtr was a null pointer and NULL data was retrieved.
2200322003 数值超出范围Numeric value out of range 为列 (为数字或字符串) 返回的数字值将导致要截断的数字的整个 (而不是小数) 部分。Returning the numeric value (as numeric or string) for the column would have caused the whole (as opposed to fractional) part of the number to be truncated.

有关详细信息,请参阅附录 d:数据类型For more information, see Appendix D: Data Types.
2200722007 日期时间格式无效Invalid datetime format 在结果集中的字符列已绑定到 C 日期、 时间或时间戳结构和列中的值分别是无效的日期、 时间戳。The character column in the result set was bound to a C date, time, or timestamp structure, and the value in the column was an invalid date, time, or timestamp, respectively. 有关详细信息,请参阅附录 d:数据类型For more information, see Appendix D: Data Types.
2201222012 被零除Division by zero 返回导致被零除的算术表达式中的值。A value from an arithmetic expression that resulted in division by zero was returned.
2201522015 间隔字段溢出Interval field overflow 将分配从精确数字或时间间隔 SQL 类型到 C 间隔类型前导字段中时导致重要数字丢失。Assigning from an exact numeric or interval SQL type to an interval C type caused a loss of significant digits in the leading field.

当数据返回到 C 间隔类型,时没有 C 间隔类型中的 SQL 类型的值的表示形式。When returning data to an interval C type, there was no representation of the value of the SQL type in the interval C type.
2201822018 转换指定的字符值无效Invalid character value for cast specification 结果集中的字符列已返回到 C 字符缓冲区,并且该列包含出现没有缓冲区的字符集中的表示形式的字符。A character column in the result set was returned to a character C buffer, and the column contained a character for which there was no representation in the character set of the buffer.

C 类型为精确或近似数值、 日期时间或间隔数据类型;列的 SQL 类型是字符数据类型;和列中的值不是有效的绑定 C 类型的文本。The C type was an exact or approximate numeric, a datetime, or an interval data type; the SQL type of the column was a character data type; and the value in the column was not a valid literal of the bound C type.
2400024000 游标状态无效Invalid cursor state (DM) 而无需第一个调用调用函数SQLFetchSQLFetchScroll若要将光标放在所需的数据行。(DM) The function was called without first calling SQLFetch or SQLFetchScroll to position the cursor on the row of data required.

(数据挖掘) StatementHandle处于执行状态,但无结果集与关联StatementHandle(DM) The StatementHandle was in an executed state, but no result set was associated with the StatementHandle.

在打开游标的StatementHandleSQLFetchSQLFetchScroll已调用一样,但该游标所处的结果集或之后在开始之前结果集的末尾。A cursor was open on the StatementHandle and SQLFetch or SQLFetchScroll had been called, but the cursor was positioned before the start of the result set or after the end of the result set.
HY000HY000 常规错误General error 有关其中没有任何特定的 SQLSTATE 和为其定义任何特定于实现的 SQLSTATE 出错。An error occurred for which there was no specific SQLSTATE and for which no implementation-specific SQLSTATE was defined. 返回的错误消息SQLGetDiagRecMessageText缓冲区描述错误以及其原因。The error message returned by SQLGetDiagRec in the MessageText buffer describes the error and its cause.
HY001HY001 内存分配错误Memory allocation error 该驱动程序无法分配支持执行或完成该函数所需的内存。The driver was unable to allocate memory required to support execution or completion of the function.
HY003HY003 超出范围的程序类型Program type out of range (DM) 参数TargetType不是有效的数据类型、 SQL_C_DEFAULT、 SQL_ARD_TYPE (发生时检索列数据) 或 SQL_APD_TYPE (发生时检索参数数据)。(DM) The argument TargetType was not a valid data type, SQL_C_DEFAULT, SQL_ARD_TYPE (in case of retrieving column data), or SQL_APD_TYPE (in case of retrieving parameter data).

(DM) 参数Col_or_Param_Num是 0,并且该参数TargetType未 SQL_C_BOOKMARK 定长书签或 SQL_C_VARBOOKMARK 长度可变的书签。(DM) The argument Col_or_Param_Num was 0, and the argument TargetType was not SQL_C_BOOKMARK for a fixed-length bookmark or SQL_C_VARBOOKMARK for a variable-length bookmark.
HY008HY008 操作已取消Operation canceled 异步处理的已启用StatementHandleAsynchronous processing was enabled for the StatementHandle. 调用该函数,和之前执行完毕SQLCancelSQLCancelHandle上调用了StatementHandle,然后调用该函数是在上再次StatementHandleThe function was called, and before it completed execution, SQLCancel or SQLCancelHandle was called on the StatementHandle, and then the function was called again on the StatementHandle.

调用该函数,和之前执行完毕SQLCancelSQLCancelHandle上调用了StatementHandle来自不同线程中多线程应用程序,然后在函数上调用了再次StatementHandleThe function was called, and before it completed execution, SQLCancel or SQLCancelHandle was called on the StatementHandle from a different thread in a multithread application, and then the function was called again on the StatementHandle.
HY009HY009 使用空指针无效Invalid use of null pointer (DM) 参数TargetValuePtr是空指针。(DM) The argument TargetValuePtr was a null pointer.
HY010HY010 函数序列错误Function sequence error (DM) 指定StatementHandle当时不处于执行状态。(DM) The specified StatementHandle was not in an executed state. 调用函数时没有首先调用SQLExecDirectSQLExecute或目录函数。The function was called without first calling SQLExecDirect, SQLExecute or a catalog function.

(DM) 为与之关联的连接句柄调用以异步方式执行的函数StatementHandle(DM) An asynchronously executing function was called for the connection handle that is associated with the StatementHandle. 此异步函数仍在执行时SQLGetData调用函数。This asynchronous function was still executing when the SQLGetData function was called.

(DM) 的调用以异步方式执行的函数 (不是此类似) StatementHandle和仍在执行时调用此函数。(DM) An asynchronously executing function (not this one) was called for the StatementHandle and was still executing when this function was called.

(数据挖掘) SQLExecuteSQLExecDirectSQLBulkOperations,或者SQLSetPos曾为StatementHandle和返回 SQL_NEED_DATA。(DM) SQLExecute, SQLExecDirect, SQLBulkOperations, or SQLSetPos was called for the StatementHandle and returned SQL_NEED_DATA. 数据已发送的所有执行时数据参数或列之前调用此函数。This function was called before data was sent for all data-at-execution parameters or columns.

(数据挖掘) StatementHandle处于执行状态,但无结果集与关联StatementHandle(DM) The StatementHandle was in an executed state, but no result set was associated with the StatementHandle.

调用SQLExeceuteSQLExecDirect,或SQLMoreResults返回 SQL_PARAM_DATA_AVAILABLE,但SQLGetData调用而不是SQLParamDataA call to SQLExeceute, SQLExecDirect, or SQLMoreResults returned SQL_PARAM_DATA_AVAILABLE, but SQLGetData was called, instead of SQLParamData.
HY013HY013 内存管理错误Memory management error 无法处理函数调用,因为基础内存对象无法访问,可能是由于内存不足的情况。The function call could not be processed because the underlying memory objects could not be accessed, possibly because of low memory conditions.
HY090HY090 字符串或缓冲区长度无效Invalid string or buffer length (DM) 为参数指定的值BufferLength小于 0。(DM) The value specified for argument BufferLength was less than 0.

为参数指定的值BufferLength为小于 4, Col_or_Param_Num参数设置为 0,并且司机的 ODBC 2 .x驱动程序。The value specified for argument BufferLength was less than 4, the Col_or_Param_Num argument was set to 0, and the driver was an ODBC 2 .x driver.
HY109HY109 无效的游标位置Invalid cursor position 游标被置于 (通过SQLSetPosSQLFetchSQLFetchScroll,或者SQLBulkOperations) 已删除的行无法提取或。The cursor was positioned (by SQLSetPos, SQLFetch, SQLFetchScroll, or SQLBulkOperations) on a row that had been deleted or could not be fetched.

游标的只进游标,并且行集大小大于 1。The cursor was a forward-only cursor, and the rowset size was greater than one.
HY117HY117 由于未知的事务状态而挂起连接。Connection is suspended due to unknown transaction state. 仅断开连接,并允许使用只读的函数。Only disconnect and read-only functions are allowed. (DM) 有关挂起状态的详细信息,请参阅SQLEndTran 函数(DM) For more information about suspended state, see SQLEndTran Function.
HYC00HYC00 未实现的可选功能Optional feature not implemented 驱动程序或数据源不支持使用SQLGetData与中的多个行SQLFetchScrollThe driver or data source does not support use of SQLGetData with multiple rows in SQLFetchScroll. 此说明不适用于返回 SQL_GD_BLOCK 位掩码中的 SQL_GETDATA_EXTENSIONS 选项的驱动程序SQLGetInfoThis description does not apply to drivers that return the SQL_GD_BLOCK bitmask for the SQL_GETDATA_EXTENSIONS option in SQLGetInfo.

驱动程序或数据源不支持指定的组合来转换TargetType参数和相应的列的 SQL 数据类型。The driver or data source does not support the conversion specified by the combination of the TargetType argument and the SQL data type of the corresponding column. 此错误仅适用于 SQL 数据类型的列映射到特定于驱动程序的 SQL 数据类型。This error applies only when the SQL data type of the column was mapped to a driver-specific SQL data type.

该驱动程序支持 ODBC 2 仅 .x,并将参数TargetType是以下之一:The driver supports only ODBC 2 .x, and the argument TargetType was one of the following:

SQL_C_NUMERIC SQL_C_SBIGINT SQL_C_UBIGINTSQL_C_NUMERIC SQL_C_SBIGINT SQL_C_UBIGINT

和中列出的 C 间隔数据类型的任何C 数据类型中附录 d:数据类型。and any of the interval C data types listed in C Data Types in Appendix D: Data Types.

该驱动程序仅支持之前需 3.50 和参数的 ODBC 版本TargetType已 SQL_C_GUID。The driver only supports ODBC versions prior to 3.50, and the argument TargetType was SQL_C_GUID.
HYT01HYT01 连接超时时间已到Connection timeout expired 连接超时期限过期之前的数据源响应此请求。The connection timeout period expired before the data source responded to the request. 通过设置连接超时期SQLSetConnectAttr,SQL_ATTR_CONNECTION_TIMEOUT。The connection timeout period is set through SQLSetConnectAttr, SQL_ATTR_CONNECTION_TIMEOUT.
IM001IM001 驱动程序不支持此函数Driver does not support this function (DM) 对应的驱动程序StatementHandle不支持该函数。(DM) The driver corresponding to the StatementHandle does not support the function.
IM017IM017 轮询异步通知模式中禁用Polling is disabled in asynchronous notification mode 只要使用通知模型,将禁用轮询。Whenever the notification model is used, polling is disabled.
IM018IM018 SQLCompleteAsync尚未调用以完成此句柄上以前的异步操作。SQLCompleteAsync has not been called to complete the previous asynchronous operation on this handle. 如果句柄上的上一个函数调用返回 SQL_STILL_EXECUTING,如果启用通知模式,则SQLCompleteAsync必须要对其进行后期处理并完成该操作的句柄上调用。If the previous function call on the handle returns SQL_STILL_EXECUTING and if notification mode is enabled, SQLCompleteAsync must be called on the handle to do post-processing and complete the operation.

注释Comments

SQLGetData为指定列中返回的数据。SQLGetData returns the data in a specified column. SQLGetData仅在已提取从结果集的一个或多个行后,可以调用SQLFetchSQLFetchScroll,或SQLExtendedFetchSQLGetData can be called only after one or more rows have been fetched from the result set by SQLFetch, SQLFetchScroll, or SQLExtendedFetch. 如果长度可变的数据太大,无法对单个调用中返回SQLGetData (由于应用程序中的限制), SQLGetData可以检索它的部分。If variable-length data is too large to be returned in a single call to SQLGetData (due to a limitation in the application), SQLGetData can retrieve it in parts. 可以将绑定中的行和调用的某些列SQLGetData对于其他操作系统,尽管这会受到某些限制。It is possible to bind some columns in a row and call SQLGetData for others, although this is subject to some restrictions. 有关详细信息,请参阅获取长整型数据For more information, see Getting Long Data.

有关使用信息SQLGetData使用流式处理的输出参数,请参阅使用 SQLGetData 检索输出参数For information about using SQLGetData with streamed output parameters, see Retrieving Output Parameters Using SQLGetData.

使用 SQLGetDataUsing SQLGetData

如果该驱动程序不支持的扩展SQLGetData,该函数可以返回仅对具有大量未绑定列的数据大于最后一个绑定列。If the driver does not support extensions to SQLGetData, the function can return data only for unbound columns with a number greater than that of the last bound column. 此外中某行的数据的值, Col_or_Param_Num每次调用中的参数SQLGetData必须是大于或等于的值Col_or_Param_Num中的上一个调用;也就是说,数字列按升序排列必须检索数据。Furthermore, within a row of data, the value of the Col_or_Param_Num argument in each call to SQLGetData must be greater than or equal to the value of Col_or_Param_Num in the previous call; that is, data must be retrieved in increasing column number order. 最后,如果没有扩展支持,则SQLGetData如果行集大小大于 1 不能调用。Finally, if no extensions are supported, SQLGetData cannot be called if the rowset size is greater than 1.

驱动程序可以放松任何这些限制。Drivers can relax any of these restrictions. 若要确定驱动程序放松了什么限制,应用程序调用SQLGetInfo具有任一以下 SQL_GETDATA_EXTENSIONS 选项:To determine what restrictions a driver relaxes, an application calls SQLGetInfo with any of the following SQL_GETDATA_EXTENSIONS options:

  • SQL_GD_OUTPUT_PARAMS = SQLGetData可以调用以返回输出参数值。SQL_GD_OUTPUT_PARAMS = SQLGetData can be called to return output parameter values. 有关详细信息,请参阅使用 SQLGetData 检索输出参数For more information, see Retrieving Output Parameters Using SQLGetData.

  • SQL_GD_ANY_COLUMN。SQL_GD_ANY_COLUMN. 如果返回此选项,则SQLGetData可以为任何未绑定列,包括那些在最后一个绑定列之前调用。If this option is returned, SQLGetData can be called for any unbound column, including those before the last bound column.

  • SQL_GD_ANY_ORDER。SQL_GD_ANY_ORDER. 如果返回此选项,则SQLGetData可以为未绑定列按任何顺序调用。If this option is returned, SQLGetData can be called for unbound columns in any order.

  • SQL_GD_BLOCK。SQL_GD_BLOCK. 如果返回此选项,那么SQLGetInfo SQL_GETDATA_EXTENSIONS 信息类型,该驱动程序支持对调用SQLGetData当行集大小是大于 1 时,应用程序可以调用SQLSetPos SQL_POSITION 选项将游标定位在正确的行,然后才能调用SQLGetData。If this option is returned by SQLGetInfo for the SQL_GETDATA_EXTENSIONS InfoType, the driver supports calls to SQLGetData when the rowset size is greater than 1 and the application can call SQLSetPos with the SQL_POSITION option to position the cursor on the correct row before calling SQLGetData.

  • SQL_GD_BOUND。SQL_GD_BOUND. 如果返回此选项,则SQLGetData可以调用对于绑定列,以及未绑定列。If this option is returned, SQLGetData can be called for bound columns as well as unbound columns.

有两种例外情况这些限制和放宽了它们的驱动程序的能力。There are two exceptions to these restrictions and a driver's ability to relax them. 首先, SQLGetData时,应永远不会调用对于只进游标行集大小大于 1。First, SQLGetData should never be called for a forward-only cursor when the rowset size is greater than 1. 其次,如果驱动程序支持书签,它必须始终支持调用的能力SQLGetData列 0,即使它不允许应用程序可以调用SQLGetData对于最后一个之前的其他列绑定的列。Second, if a driver supports bookmarks, it must always support the ability to call SQLGetData for column 0, even if it does not allow applications to call SQLGetData for other columns before the last bound column. (应用程序使用 ODBC 2 .x驱动程序, SQLGetData成功返回时调用的书签Col_or_Param_Num等于 0 后调用SQLFetch,因为SQLFetch ODBC 3 映射 .x到驱动程序管理器SQLExtendedFetchFetchOrientation的 SQL_FETCH_NEXT,并SQLGetDataCol_or_Param_Num 0 的映射由 ODBC 3 .x到驱动程序管理器SQLGetStmtOptionfOption的 SQL_GET_BOOKMARK。)(When an application is working with an ODBC 2 .x driver, SQLGetData will successfully return a bookmark when called with Col_or_Param_Num equal to 0 after a call to SQLFetch, because SQLFetch is mapped by the ODBC 3 .x Driver Manager to SQLExtendedFetch with a FetchOrientation of SQL_FETCH_NEXT, and SQLGetData with a Col_or_Param_Num of 0 is mapped by the ODBC 3 .x Driver Manager to SQLGetStmtOption with an fOption of SQL_GET_BOOKMARK.)

SQLGetData不能用于检索通过调用刚插入的行的书签将变为SQLBulkOperations带有 SQL_ADD 选项,因为该游标未定位在该行上。SQLGetData cannot be used to retrieve the bookmark for a row just inserted by calling SQLBulkOperations with the SQL_ADD option, because the cursor is not positioned on the row. 应用程序可以通过绑定第 0 列之前调用检索这样的行的书签将变为SQLBulkOperations SQL_ADD,这种情况下使用SQLBulkOperations返回绑定的缓冲区中的书签。An application can retrieve the bookmark for such a row by binding column 0 before calling SQLBulkOperations with SQL_ADD, in which case SQLBulkOperations returns the bookmark in the bound buffer. SQLFetchScroll然后可以使用 SQL_FETCH_BOOKMARK 重新光标定位在该行上调用。SQLFetchScroll can then be called with SQL_FETCH_BOOKMARK to reposition the cursor on that row.

如果TargetType参数中的 SQL_DESC_DATETIME_INTERVAL_PRECISION 和 SQL_DESC_PRECISION 字段设置为间隔数据类型,默认时间间隔的前导精度 (2) 和默认时间间隔的秒精度 (6),ARD,分别用于数据。If the TargetType argument is an interval data type, the default interval leading precision (2) and the default interval seconds precision (6), as set in the SQL_DESC_DATETIME_INTERVAL_PRECISION and SQL_DESC_PRECISION fields of the ARD, respectively, are used for the data. 如果TargetType参数为 SQL_C_NUMERIC 数据类型,默认的精度 (驱动程序定义) 和 ARD 的 SQL_DESC_PRECISION 和 SQL_DESC_SCALE 字段中设置默认小数位数 (0),用于数据。If the TargetType argument is an SQL_C_NUMERIC data type, the default precision (driver-defined) and default scale (0), as set in the SQL_DESC_PRECISION and SQL_DESC_SCALE fields of the ARD, are used for the data. 如果任何默认精度或小数位数不适当,应用程序显式应通过调用设置适当的描述符字段SQLSetDescFieldSQLSetDescRecIf any default precision or scale is not appropriate, the application should explicitly set the appropriate descriptor field by a call to SQLSetDescField or SQLSetDescRec. 它可以将 SQL_DESC_CONCISE_TYPE 字段设置为 SQL_C_NUMERIC 并调用SQLGetDataTargetType SQL_ARD_TYPE,这将导致在描述符字段的精度和小数位数的值的参数若要使用。It can set the SQL_DESC_CONCISE_TYPE field to SQL_C_NUMERIC and call SQLGetData with a TargetType argument of SQL_ARD_TYPE, which will cause the precision and scale values in the descriptor fields to be used.

备注

在 ODBC 2 .x,应用程序设置TargetType SQL_C_DATE、 SQL_C_TIME,或指示 SQL_C_TIMESTAMP * TargetValuePtr是日期、 time、 或时间戳结构。In ODBC 2 .x, applications set TargetType to SQL_C_DATE, SQL_C_TIME, or SQL_C_TIMESTAMP to indicate that *TargetValuePtr is a date, time, or timestamp structure. 在 ODBC 3 .x,应用程序设置TargetType SQL_C_TYPE_DATE、 SQL_C_TYPE_TIME,或 SQL_C_TYPE_TIMESTAMP。In ODBC 3 .x, applications set TargetType to SQL_C_TYPE_DATE, SQL_C_TYPE_TIME, or SQL_C_TYPE_TIMESTAMP. 驱动程序管理器,可相应映射必要时,基于上的应用程序和驱动程序版本。The Driver Manager makes appropriate mappings if necessary, based on the application and driver version.

检索在部件中的可变长度数据Retrieving Variable-Length Data in Parts

SQLGetData可用于从 SQL 数据类型的列的标识符是 SQL_CHAR、 SQL_VARCHAR、 SQL_LONGVARCHAR、 SQL_WCHAR、 SQL_WVARCHAR、 SQL_ 时,即包含部分的长度可变的数据的列中检索数据WLONGVARCHAR、 SQL_BINARY、 SQL_VARBINARY、 SQL_LONGVARBINARY 或可变长度类型的特定于驱动程序的标识符。SQLGetData can be used to retrieve data from a column that contains variable-length data in parts - that is, when the identifier of the SQL data type of the column is SQL_CHAR, SQL_VARCHAR, SQL_LONGVARCHAR, SQL_WCHAR, SQL_WVARCHAR, SQL_WLONGVARCHAR, SQL_BINARY, SQL_VARBINARY, SQL_LONGVARBINARY, or a driver-specific identifier for a variable-length type.

若要从部件中的列检索数据,应用程序调用SQLGetData中同一列连续多次。To retrieve data from a column in parts, the application calls SQLGetData multiple times in succession for the same column. 在每次调用SQLGetData返回数据的下一步的一部分。On each call, SQLGetData returns the next part of the data. 它是由应用程序以重新组装的部分,注意,要移除的字符数据的中间部分的 null 终止字符。It is up to the application to reassemble the parts, taking care to remove the null-termination character from intermediate parts of character data. 如果没有更多数据,以返回或不为终止字符分配足够的缓冲区SQLGetData返回 SQL_SUCCESS_WITH_INFO 和 SQLSTATE 01004 (数据被截断)。If there is more data to return or not enough buffer was allocated for the terminating character, SQLGetData returns SQL_SUCCESS_WITH_INFO and SQLSTATE 01004 (Data truncated). 当它返回的最后一部分数据, SQLGetData返回 SQL_SUCCESS。When it returns the last part of the data, SQLGetData returns SQL_SUCCESS. 因为应用程序然后会有没有办法知道多少应用程序缓冲区中的数据有效,可从某一列,检索数据的最后一个有效调用上返回 SQL_NO_TOTAL 既不为零。Neither SQL_NO_TOTAL nor zero can be returned on the last valid call to retrieve data from a column, because the application would then have no way of knowing how much of the data in the application buffer is valid. 如果SQLGetData调用在此之后,其返回 sql_no_data 为止。If SQLGetData is called after this, it returns SQL_NO_DATA. 有关详细信息,请参阅下一部分中,"使用 SQLGetData 检索数据"。For more information, see the next section, "Retrieving Data with SQLGetData."

可以在部件中返回长度可变的书签SQLGetDataVariable-length bookmarks can be returned in parts by SQLGetData. 与调用的其他数据一样SQLGetData返回中部分的长度可变的书签将返回 SQLSTATE 01004 (字符串数据,右端被截断) 和 SQL_SUCCESS_WITH_INFO 时要返回的更多数据。As with other data, a call to SQLGetData to return variable-length bookmarks in parts will return SQLSTATE 01004 (String data, right truncated) and SQL_SUCCESS_WITH_INFO when there is more data to be returned. 通过调用截断长度可变的书签时,这一点不同于用例SQLFetchSQLFetchScroll,这会返回 SQL_ERROR 并且 SQLSTATE 22001 (字符串数据,右端被截断)。This is different than the case when a variable-length bookmark is truncated by a call to SQLFetch or SQLFetchScroll, which returns SQL_ERROR and SQLSTATE 22001 (String data, right truncated).

SQLGetData不能用于返回部分中的固定长度的数据。SQLGetData cannot be used to return fixed-length data in parts. 如果SQLGetData是为一列以包含固定长度的数据行中调用不止一次,其返回 sql_no_data 为止的所有调用后第一个。If SQLGetData is called more than one time in a row for a column containing fixed-length data, it returns SQL_NO_DATA for all calls after the first.

检索流的输出参数Retrieving Streamed Output Parameters

如果驱动程序支持流的输出参数,应用程序可以调用SQLGetData使用一个较小缓冲区多次来检索大型参数值。If a driver supports streamed output parameters, an application can call SQLGetData with a small buffer many times to retrieve a large parameter value. 有关流式处理的输出参数的详细信息,请参阅使用 SQLGetData 检索输出参数For more information about streamed output parameter, see Retrieving Output Parameters Using SQLGetData.

使用 SQLGetData 检索数据Retrieving Data with SQLGetData

返回指定列的数据SQLGetData执行以下步骤序列:To return data for the specified column, SQLGetData performs the following sequence of steps:

  1. 如果它已返回所有列的数据,则返回 sql_no_data 为止。Returns SQL_NO_DATA if it has already returned all of the data for the column.

  2. 集* StrLen_or_IndPtr为 SQL_NULL_DATA,如果数据为 NULL。Sets *StrLen_or_IndPtr to SQL_NULL_DATA if the data is NULL. 如果数据为 NULL 并且StrLen_or_IndPtr是空指针SQLGetData返回 SQLSTATE 22002 (指示器变量,但未提供)。If the data is NULL and StrLen_or_IndPtr was a null pointer, SQLGetData returns SQLSTATE 22002 (Indicator variable required but not supplied).

    如果列的数据不为 NULL, SQLGetData转到步骤 3。If the data for the column is not NULL, SQLGetData proceeds to step 3.

  3. 如果 SQL_ATTR_MAX_LENGTH 语句属性设置为非零值,如果列包含字符或二进制数据,并且如果SQLGetData以前尚未调用的列数据被截断为 SQL_ATTR_MAX_LENGTH字节数。If the SQL_ATTR_MAX_LENGTH statement attribute is set to a nonzero value, if the column contains character or binary data, and if SQLGetData has not previously been called for the column, the data is truncated to SQL_ATTR_MAX_LENGTH bytes.

    备注

    SQL_ATTR_MAX_LENGTH 语句属性旨在减少网络流量。The SQL_ATTR_MAX_LENGTH statement attribute is intended to reduce network traffic. 它通常被实现数据源,返回之前对其通过网络将截断数据。It is generally implemented by the data source, which truncates the data before returning it across the network. 驱动程序和数据源不需要支持它。Drivers and data sources are not required to support it. 因此,若要确保数据将被截断为特定大小,应用程序应分配该大小的缓冲区,并指定的大小以BufferLength参数。Therefore, to guarantee that data is truncated to a particular size, an application should allocate a buffer of that size and specify the size in the BufferLength argument.

  4. 将数据转换中指定的类型为TargetTypeConverts the data to the type specified in TargetType. 数据是为该数据类型提供的默认精度和小数位数。The data is given the default precision and scale for that data type. 如果TargetType是 SQL_ARD_TYPE,数据使用的 ARD SQL_DESC_CONCISE_TYPE 字段中的类型。If TargetType is SQL_ARD_TYPE, the data type in the SQL_DESC_CONCISE_TYPE field of the ARD is used. 如果TargetType是 SQL_ARD_TYPE、 数据中提供了精度和小数位数 SQL_DESC_DATETIME_INTERVAL_PRECISION,SQL_DESC_PRECISION,和 ARD,具体取决于数据的 SQL_DESC_SCALE 字段键入 SQL_DESC_CONCISE类型 (_t) 字段。If TargetType is SQL_ARD_TYPE, the data is given the precision and scale in the SQL_DESC_DATETIME_INTERVAL_PRECISION, SQL_DESC_PRECISION, and SQL_DESC_SCALE fields of the ARD, depending on the data type in the SQL_DESC_CONCISE_TYPE field. 如果任何默认精度或小数位数不适当,应用程序显式应通过调用设置适当的描述符字段SQLSetDescFieldSQLSetDescRecIf any default precision or scale is not appropriate, the application should explicitly set the appropriate descriptor field by a call to SQLSetDescField or SQLSetDescRec.

  5. 如果数据已转换为可变长度数据类型,如字符或二进制文件中, SQLGetData检查数据的长度是否超过BufferLengthIf the data was converted to a variable-length data type, such as character or binary, SQLGetData checks whether the length of the data exceeds BufferLength. 如果字符数据 (包括 null 终止字符) 的长度超过BufferLengthSQLGetData截断到数据BufferLength长度小于null 终止字符。If the length of character data (including the null-termination character) exceeds BufferLength, SQLGetData truncates the data to BufferLength less the length of a null-termination character. 它然后则以 null 终止的数据。It then null-terminates the data. 如果二进制数据的长度超过了数据缓冲区的长度SQLGetData将它截断到BufferLength字节。If the length of binary data exceeds the length of the data buffer, SQLGetData truncates it to BufferLength bytes.

    如果提供的数据缓冲区太小,无法保留 null 终止字符SQLGetData返回 SQL_SUCCESS_WITH_INFO 和 SQLSTATE 01004。If the data buffer supplied is too small to hold the null-termination character, SQLGetData returns SQL_SUCCESS_WITH_INFO and SQLSTATE 01004.

    SQLGetData永远不会截断数据转换为固定长度的数据类型; 它始终假定的长度 *TargetValuePtr是数据类型的大小。SQLGetData never truncates data converted to fixed-length data types; it always assumes that the length of *TargetValuePtr is the size of the data type.

  6. 将中的已转换 (和可能被截断) 数据放* TargetValuePtrPlaces the converted (and possibly truncated) data in *TargetValuePtr. 请注意, SQLGetData不能返回行外的数据。Note that SQLGetData cannot return data out of line.

  7. 将放置在数据的长度* StrLen_or_IndPtrPlaces the length of the data in *StrLen_or_IndPtr. 如果StrLen_or_IndPtr是空指针SQLGetData不返回长度。If StrLen_or_IndPtr was a null pointer, SQLGetData does not return the length.

    • 对于字符或二进制数据,这是数据的长度转换之后和之前由于截断BufferLengthFor character or binary data, this is the length of the data after conversion and before truncation due to BufferLength. 如果驱动程序无法转换后,确定数据的长度,因为有时是带有长数据的用例,它将返回 SQL_SUCCESS_WITH_INFO 和长度设置为 SQL_NO_TOTAL。If the driver cannot determine the length of the data after conversion, as is sometimes the case with long data, it returns SQL_SUCCESS_WITH_INFO and sets the length to SQL_NO_TOTAL. (上次调用SQLGetData必须始终返回数据、 不为零或 SQL_NO_TOTAL 的长度。)如果由于 SQL_ATTR_MAX_LENGTH 语句属性情况下,数据已被截断,而不是实际的长度-此特性的值将放入* StrLen_or_IndPtr(The last call to SQLGetData must always return the length of the data, not zero or SQL_NO_TOTAL.) If data was truncated due to the SQL_ATTR_MAX_LENGTH statement attribute, the value of this attribute - as opposed to the actual length - is placed in *StrLen_or_IndPtr. 这是因为此属性设计使该驱动程序不有任何办法来找出实际长度截断的转换之前, 在服务器上的数据。This is because this attribute is designed to truncate data on the server before conversion, so the driver has no way of figuring out what the actual length is. SQLGetData是连续的多次调用同一列中,这是当前的调用开始处的可用数据的长度; 也就是说,长度还减少了每个后续调用。When SQLGetData is called multiple times in succession for the same column, this is the length of the data available at the start of the current call; that is, the length decreases with each subsequent call.

    • 对于所有其他数据类型,这是数据的长度后转换,则也就是说,它是类型的到转换数据的大小。For all other data types, this is the length of the data after conversion; that is, it is the size of the type to which the data was converted.

  8. 如果在转换期间截断而不会丢失基数的倍数的数据 (例如,实际 1.234 截断数字转换为整数 1) 或由于BufferLength太小 (例如,字符串"abcdef"放置4 字节缓冲区) 中SQLGetData返回 SQLSTATE 01004 (数据被截断) 和 SQL_SUCCESS_WITH_INFO。If the data is truncated without loss of significance during conversion (for example, the real number 1.234 is truncated when converted to the integer 1) or because BufferLength is too small (for example, the string "abcdef" is placed in a 4-byte buffer), SQLGetData returns SQLSTATE 01004 (Data truncated) and SQL_SUCCESS_WITH_INFO. 如果数据被截断而不会丢失基数的倍数 SQL_ATTR_MAX_LENGTH 语句属性,由于SQLGetData返回 SQL_SUCCESS,且不返回 SQLSTATE 01004 (数据被截断)。If data is truncated without loss of significance due to the SQL_ATTR_MAX_LENGTH statement attribute, SQLGetData returns SQL_SUCCESS and does not return SQLSTATE 01004 (Data truncated).

绑定的数据缓冲区的内容 (如果SQLGetData绑定列调用) 的长度/指示器缓冲区是不确定,如果SQLGetData不会返回 SQL_SUCCESS 或 SQL_SUCCESS_WITH_INFO。The contents of the bound data buffer (if SQLGetData is called on a bound column) and the length/indicator buffer are undefined if SQLGetData does not return SQL_SUCCESS or SQL_SUCCESS_WITH_INFO.

后续调用SQLGetData将从所请求的最后一列中检索数据; 而在以前的偏移量会无效。Successive calls to SQLGetData will retrieve data from the last column requested; prior offsets become invalid. 例如,执行以下顺序执行:For example, when the following sequence is performed:

SQLGetData(icol=n), SQLGetData(icol=m), SQLGetData(icol=n)  

SQLGetData(icol=n) 第二次调用开始处的 n 列检索数据。the second call to SQLGetData(icol=n) retrieves data from the start of the n column. 任何数据,因为早期调用中的偏移量SQLGetData的列将不再有效。Any offset in the data due to earlier calls to SQLGetData for the column is no longer valid.

描述符和 SQLGetDataDescriptors and SQLGetData

SQLGetData不与任何描述符字段的直接交互。SQLGetData does not interact directly with any descriptor fields.

如果TargetType是 SQL_ARD_TYPE,数据使用的 ARD SQL_DESC_CONCISE_TYPE 字段中的类型。If TargetType is SQL_ARD_TYPE, the data type in the SQL_DESC_CONCISE_TYPE field of the ARD is used. 如果TargetType SQL_ARD_TYPE 或 SQL_C_DEFAULT,数据中提供了精度和小数位数 SQL_DESC_DATETIME_INTERVAL_PRECISION,SQL_DESC_PRECISION,然后键入 SQL_DESC_SCALE ARD,具体取决于数据字段中的 SQL_DESC_CONCISE_TYPE 字段中。If TargetType is either SQL_ARD_TYPE or SQL_C_DEFAULT, the data is given the precision and scale in the SQL_DESC_DATETIME_INTERVAL_PRECISION, SQL_DESC_PRECISION, and SQL_DESC_SCALE fields of the ARD, depending on the data type in the SQL_DESC_CONCISE_TYPE field.

代码示例Code Example

在以下示例中,应用程序执行选择语句返回结果集的客户 Id、 名称和电话号码按名称、 ID 和电话号码。In the following example, an application executes a SELECT statement to return a result set of the customer IDs, names, and phone numbers sorted by name, ID, and phone number. 对于每个数据行,它调用SQLFetch来定位光标移到下一行。For each row of data, it calls SQLFetch to position the cursor to the next row. 它将调用SQLGetData检索提取的数据; 数据和返回的字节数的缓冲区中指定调用SQLGetDataIt calls SQLGetData to retrieve the fetched data; the buffers for the data and the returned number of bytes are specified in the call to SQLGetData. 最后,会输出每个雇员的名称、 ID 和电话号码。Finally, it prints each employee's name, ID, and phone number.

#define NAME_LEN 50  
#define PHONE_LEN 50  
  
SQLCHAR      szName[NAME_LEN], szPhone[PHONE_LEN];  
SQLINTEGER   sCustID, cbName, cbAge, cbBirthday;  
SQLRETURN    retcode;  
SQLHSTMT     hstmt;  
  
retcode = SQLExecDirect(hstmt,  
   "SELECT CUSTID, NAME, PHONE FROM CUSTOMERS ORDER BY 2, 1, 3",  
   SQL_NTS);  
  
if (retcode == SQL_SUCCESS) {  
   while (TRUE) {  
      retcode = SQLFetch(hstmt);  
      if (retcode == SQL_ERROR || retcode == SQL_SUCCESS_WITH_INFO) {  
         show_error();  
      }  
      if (retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO){  
  
         /* Get data for columns 1, 2, and 3 */  
  
         SQLGetData(hstmt, 1, SQL_C_ULONG, &sCustID, 0, &cbCustID);  
         SQLGetData(hstmt, 2, SQL_C_CHAR, szName, NAME_LEN, &cbName);  
         SQLGetData(hstmt, 3, SQL_C_CHAR, szPhone, PHONE_LEN,  
            &cbPhone);  
  
         /* Print the row of data */  
  
         fprintf(out, "%-5d %-*s %*s", sCustID, NAME_LEN-1, szName,   
            PHONE_LEN-1, szPhone);  
      } else {  
         break;  
      }  
   }  
}  
有关信息For information about 请参阅See
分配结果集中的列的存储Assigning storage for a column in a result set SQLBindColSQLBindCol
执行块的光标位置不相关的大容量操作Performing bulk operations that do not relate to the block cursor position SQLBulkOperationsSQLBulkOperations
取消语句处理Canceling statement processing SQLCancelSQLCancel
执行 SQL 语句Executing an SQL statement SQLExecDirectSQLExecDirect
执行已准备的 SQL 语句Executing a prepared SQL statement SQLExecuteSQLExecute
提取的数据块或滚动浏览结果集Fetching a block of data or scrolling through a result set SQLFetchScrollSQLFetchScroll
正在提取单行数据或仅向前方向中的数据块Fetching a single row of data or a block of data in a forward-only direction SQLFetchSQLFetch
在执行时发送参数数据Sending parameter data at execution time SQLPutDataSQLPutData
定位光标,刷新的行集中的数据或更新或删除行集中的数据Positioning the cursor, refreshing data in the rowset, or updating or deleting data in the rowset SQLSetPosSQLSetPos

请参阅See Also

ODBC API 参考 ODBC API Reference
ODBC 头文件 ODBC Header Files
使用 SQLGetData 检索输出参数Retrieving Output Parameters Using SQLGetData