从指定列偏移位置开始读取字符流,并从给定缓冲区偏移位置开始将其以数组形式写入缓冲区。
[Visual Basic]
Public Function GetChars( _
ByVal i As Integer, _
ByVal dataIndex As Long, _
ByVal buffer() As Char, _
ByVal bufferIndex As Integer, _
ByVal length As Integer _
) As Long
[C#]
public long GetChars(
int i,
long dataIndex,
char[] buffer,
int bufferIndex,
int length
);
[C++]
public: __int64 GetChars(
int i,
__int64 dataIndex,
__wchar_t buffer __gc[],
int bufferIndex,
int length
);
[JScript]
public function GetChars(
i : int,
dataIndex : long,
buffer : Char[],
bufferIndex : int,
length : int
) : long;
读取的实际字符数。
| 异常类型 | 条件 |
|---|---|
| DB2Exception | 转换无效。 |
GetChars 返回字段中的可用字符数。大多数情况下,这是该字段的准确长度。但是,如果已使用 GetChars 来获取字段中的字符数,那么返回的数字可能小于该字段的真实长度。例如,如果 DB2®DataReader 正在将 CLOB 读入缓冲区中,那么可能存在这种情况。有关更多信息,请参阅 Microsoft(R) .NET Framework SDK 文档中 System.Data.CommandBehavior 的 SequentialAccess 设置。
如果传递的 buffer 为空值,那么 GetChars 返回字段的长度(以字符计)。
| DB2Type 数据类型 | DB2 数据类型 | Informix® 数据类型 |
|---|---|---|
| Char | CHAR | CHAR |
| VarChar | VARCHAR | VARCHAR |
| LongVarChar | LONG VARCHAR | LVARCHAR |
| Clob | CLOB | CLOB 和 TEXT |
| Graphic | GRAPHIC | |
| VarGraphic | VARGRAPHIC | |
| LongVarGraphic | LONG VARGRAPHIC | |
| DbClob | DBCLOB |