This tutorial describes how to write data from a data stream to a database.
This is useful when populating your database with the results of some other operation.
The high level steps to write from a data stream to a database table are shown here:
The process of writing data from a data stream into a table can be explained as follows:
Instantiate the necessary objects
Instantiate an object
of the RSqlStatement
and RSqlParamWriteStream
class.
Also declare the variables as shown.
RSqlStatement myStatement; TInt err; TInt myParameterIndex; RSqlParamWriteStream myStream; RBuf buf;
Clean up the stack.
CleanupClosePushL(myStream);
Write data into the table
Obtain access to the data as a stream of characters.
User::LeaveIfErrormyStream.BindTextL(myStatement,myParameterIndex));
Write the buffer.
myStream.WriteL(buf);
Commit the stream
Commit the stream. This ensures that the streamed data is written into the table and cannot be rolled back.
myStream.CommitL();
Writing from a Data Stream - This document