Writing from a Data Stream

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.

Basic procedure

The high level steps to write from a data stream to a database table are shown here:

  1. Instantiate the necessary objects.

  2. Write data into the table.

  3. Commit the stream.

Writing from a data stream into a table

The process of writing data from a data stream into a table can be explained as follows:

Instantiate the necessary objects

  1. 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;
  2. Clean up the stack.


Write data into the table

  1. Obtain access to the data as a stream of characters.

  2. Write the buffer.


Commit the stream

Commit the stream. This ensures that the streamed data is written into the table and cannot be rolled back.