diff -r 000000000000 -r 89d6a7a84779 Symbian3/SDK/Source/GUID-3CCA6503-54DA-5558-85DC-93A22A81F565.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-3CCA6503-54DA-5558-85DC-93A22A81F565.dita Thu Jan 21 18:18:20 2010 +0000 @@ -0,0 +1,44 @@ + + + + + +Reading +to Memory +

This tutorial describes how to copy data from the table to a memory location.

+
Introduction

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.

+
Basic procedure

The high level steps to copy the +data retrieved from a table to a memory location are shown below:

    +
  1. Configure your SQL statement.

  2. +
  3. Copy to memory.

  4. +
+
Detailed steps

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 + }
+
See also

Querying +a Database

Inserting +a Row into a Table

Deleting +Rows from a Table

Reading +to a Buffer

Reading to memory - This document

Reading to a Data Stream

Writing to a Data Stream

Performing Scalar Queries

+
\ No newline at end of file