DB2®Clob.GetChars Method
Reads a stream of characters from the specified column offset into the buffer as an array, starting at the given buffer offset.
- Namespace:
IBM.Data.DB2- Assembly:
IBM.Data.DB2(inIBM.Data.DB2.dll)
Syntax
[Visual Basic]
Public Function GetChars( _
ByVal dataIndex As Long, _
ByVal buffer() As Char, _
ByVal bufferIndex As Integer, _
ByVal length As Integer _
) As Long
[C#]
public long GetChars(
long dataIndex,
char[] buffer,
int bufferIndex,
int length
);
[C++]
public: __int64 GetChars(
__int64 dataIndex,
__wchar_t buffer __gc[],
int bufferIndex,
int length
);
[JScript]
public function GetChars(
dataIndex : long,
buffer : Char[],
bufferIndex : int,
length : int
) : long;
Parameters
- dataIndex
- The index within the row where the read operation is to begin.
- buffer
- The buffer into which to copy data.
- bufferIndex
- The index where buffer is to begin the write operation.
- length
- The number of characters to read.
Return value
The actual number of characters read.
Exceptions
| Exception type | Condition |
|---|---|
| DB2Exception | Invalid conversion. |
| InvalidOperationException | There is no more data to return. |
Remarks
GetChars returns the number of available characters in the field. In most cases this is the exact length of the field. However, the number returned may be less than the true length of the field if GetChars has already been used to obtain characters from the field. This may be the case, for example, if the DB2Clob is reading a CLOB into a buffer. For more information, see the SequentialAccess setting of System.Data.CommandBehavior in the Microsoft(R) .NET Framework SDK documentation.
If you pass a buffer that is a null value. GetChars returns the length of the field in characters.
false, applications can only retrieve the complete
set of data from a DB2Clob instance once. Any additional attempts
at retrieving data will result in an InvalidOperationException.
The specific implications of this are: - This method can only be used to retrieve the complete set of data from a DB2Clob instance once.
- If you use this method to retrieve data from a DB2Clob instance, you cannot use the Value property or the ToString method to do the same.
- If you have already used the Value property or the ToString method to retrieve data from a DB2Clob instance, you cannot use this method to do the same.
true,
data can be read from the DB2Clob structure, using
any of the access methods.