This tutorial describes how to copy data from the table to a memory location.
You can avoid making a local copy of the data by directly writing the retrieved data into a memory location. This can be achieved by copying to an object of the TPtrC class. For more details on copying data to a buffer see Reading to a Buffer.
The high level steps to copy the data retrieved from a table to a memory location are shown below:
Configure your SQL statement
Instantiate
an object of the RSqlStatement
class and declare the required
variables as shown.
RSqlStatement myStatement; TInt err;
Copy to memory
To retrieve all the entries, use a loop.
1. Instantiate an object of the TPtrc class. This object may be used to reference constant strings or data.
... while((err = myStatement.Next()) == KSqlAtRow) { TPtrC myData; TInt err;
2 Read the data into the specified memory location..
err = myStatement.ColumnBinary(myColumnIndex,myData); // process data }
Reading to memory - This document