diff -r 51a74ef9ed63 -r ae94777fff8f Symbian3/SDK/Source/GUID-72511204-FC90-54AA-9E2E-833318020318.dita --- a/Symbian3/SDK/Source/GUID-72511204-FC90-54AA-9E2E-833318020318.dita Wed Mar 31 11:11:55 2010 +0100 +++ b/Symbian3/SDK/Source/GUID-72511204-FC90-54AA-9E2E-833318020318.dita Fri Jun 11 12:39:03 2010 +0100 @@ -1,49 +1,53 @@ - - - - - -Reading -to a Buffer -

This tutorial describes how to read the data from the table into a buffer.

-
Introduction

This query allows you to retrieve -the data in a field. You can retrieve one entry or multiple entries in the -same column by executing the query in a loop.

-
Basic procedure

The high level steps to read the -data into the buffer are shown here:

    -
  1. Configure the SQL statement.

  2. -
  3. Allocate memory and -copy data.

  4. -
  5. Deallocate memory.

  6. -
-
Detailed steps

The steps to read data to a buffer -are as follows:

Configure -the SQL statement

Instantiate an RSqlStatement object -and declare the variables as required.

RSqlStatement myStatement; -TInt err;

Allocate -memory and copy data

To retrieve all the entries, use a loop. -The steps to be performed within the loop are as described below:

    -
  1. Instantiate an object -of the RBuf class.

    while((err = myStatement.Next()) == KSqlAtRow) - { - RBuf myBuffer;
  2. -
  3. Allocate enough memory -to hold the column data using the CreateL() function as shown -below.

    err = myBuffer.CreateL(myStatement.ColumnSize(columnIndex));
  4. -
  5. Copy the data from the -table into the buffer using ColumnBinary() function.

    err = myStatement.ColumnBinary(myColumnIndex,myBuffer); - ... - // process data
  6. -

Deallocate -memory

Deallocate the memory assigned to the RBuf object.

myBuffer.Close(); - }
-
See also

Querying -a Database

Deleting -Rows from a Table

Reading to a buffer - This document

Reading to Memory

Reading to a Data Stream

Writing to a Data Stream

Performing Scalar Queries

+ + + + + +Reading +to a Buffer +

This tutorial describes how to read the data from the table into a buffer.

+
Introduction

This +query allows you to retrieve the data in a field. You can retrieve one entry +or multiple entries in the same column by executing the query in a loop.

+
Basic procedure

The +high level steps to read the data into the buffer are shown here:

    +
  1. Configure the SQL statement.

  2. +
  3. Allocate memory and +copy data.

  4. +
  5. Deallocate memory.

  6. +
+
Detailed steps

The +steps to read data to a buffer are as follows:

Configure +the SQL statement

Instantiate an RSqlStatement object +and declare the variables as required.

RSqlStatement myStatement; +TInt err;

Allocate +memory and copy data

To retrieve all the entries, use a loop. +The steps to be performed within the loop are as described below:

    +
  1. Instantiate an object +of the RBuf class.

    while((err = myStatement.Next()) == KSqlAtRow) + { + RBuf myBuffer;
  2. +
  3. Allocate enough memory +to hold the column data using the CreateL() function as shown +below.

    err = myBuffer.CreateL(myStatement.ColumnSize(columnIndex));
  4. +
  5. Copy the data from the +table into the buffer using RSqlStatement::ColumnBinary(TInt,TDes8 +&)const function.

    err = myStatement.ColumnBinary(myColumnIndex,myBuffer); + ... + // process data
  6. +

Deallocate +memory

Deallocate the memory assigned to the RBuf object.

myBuffer.Close(); + }
+
See also

Querying a Database

Deleting Rows from a Table

Reading +to a buffer - This document

Reading +to Memory

Reading +to a Data Stream

Writing +to a Data Stream

Performing +Scalar Queries

\ No newline at end of file