This tutorial describes how to copy data from a database into a data stream.
You can read data from the table into a data stream in one chunk or in bits as desired.
To read the data into a data stream, do the following:
Configure your SQL statement and data stream
As a first step instantiate an object of the RSqlStatement and RSqlColumnReadStream class. Also declare the variables as required.
RSqlStatement myStatement; TInt err; TInt myColumnIndex; RSqlColumnReadStream myStream;
Clean up the stack.
CleanupClosePushL(myStream);
Read data to a stream
Open the stream for read and associate the data with it.
User::LeaveIfError(myStream.ColumnBinary(myStatement,myColumnIndex));
Determine the column size.
TInt size = myStatement.ColumnSize(myColumnIndex);
Instantiate an object of the RBuf class. Create a buffer of the size of the column. Then read the data into the buffer.
RBuf buf; buf.CreateL(size); CleanupClosePushL(buf); myStream.ReadL(buf,size);
Close the buffer.
CleanupStack::PopAndDestroy();
Clean up
Close the stream.
CleanupStack::PopAndDestroy();
Reading to a Data Stream - This document