class RSqlColumnReadStream : public RReadStream |
The read stream interface.
The class is used for reading the content of a column containing either binary data or text data.
The class derives from RReadStream , which means that all RReadStream public member functions and predefined stream operators >> can be used to deal with column data.
If the blob or text data is over 2Mb in size then it is recommended that the RSqlBlobReadStream or TSqlBlob class is used instead. These classes provide a more RAM-efficient way of reading large amounts of blob or text data from a database.
The following two cases are typical:
CASE 1 - processing large binary column data.
RSqlDatabase db; <open/create "db" object>; RSqlStatement stmt; <prepare "stmt" object>; TInt rc = stmt.Next(); if(rc == KSqlAtRow) { RSqlColumnReadStream colStream; CleanupClosePushL(colStream); User::LeaveIfError(colStream.ColumnBinary(stmt, <column_number>)); TInt size = stmt.ColumnSize(<column_number>); //read the column data in a buffer ("buf" variable). //(or the column data can be retrieved in a smaller portions) colStream.ReadL(buf, size); //Close the stream CleanupStack::PopAndDestroy(&colStream); } else { ... }
CASE 2 - processing large text column data.
RSqlDatabase db; <open/create "db" object>; RSqlStatement stmt; <prepare "stmt" object>; TInt rc = stmt.Next(); if(rc == KSqlAtRow) { RSqlColumnReadStream colStream; CleanupClosePushL(colStream); User::LeaveIfError(colStream.ColumnText(stmt, <column_number>)); TInt size = stmt.ColumnSize(<column_number>); //read the column data in a buffer ("buf" variable). //(or the column data can be retrieved in a smaller portions) colStream.ReadL(buf, size); //Close the stream CleanupStack::PopAndDestroy(&colStream); } else { ... }
Public Member Functions | |
---|---|
IMPORT_C void | ColumnBinaryL ( RSqlStatement &, TInt ) |
IMPORT_C TInt | ColumnText ( RSqlStatement &, TInt ) |
IMPORT_C void | ColumnTextL ( RSqlStatement &, TInt ) |
IMPORT_C void | ColumnBinaryL | ( | RSqlStatement & | aStmt, |
TInt | aColumnIndex | |||
) |
RSqlStatement & aStmt | |
TInt aColumnIndex |
IMPORT_C TInt | ColumnText | ( | RSqlStatement & | aStmt, |
TInt | aColumnIndex | |||
) |
Gives access to column data as a read-only stream of characters,
The function can only be used for text and binary column types.
RSqlStatement & aStmt | The RSqlStatement object to which the referred column belongs. |
TInt aColumnIndex | The index value identifying the column; this is 0 for the first column. |
IMPORT_C void | ColumnTextL | ( | RSqlStatement & | aStmt, |
TInt | aColumnIndex | |||
) |
Gives access to column data as a read-only stream of characters,
The function can only be used for text and binary column types.
RSqlStatement & aStmt | The RSqlStatement object to which the referred column belongs. |
TInt aColumnIndex | The index value identifying the column; this is 0 for the first column. |
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.