diff -r 48780e181b38 -r 578be2adaf3e Symbian3/PDK/Source/GUID-C474376E-1766-5781-B5BF-3786C5B4D72E.dita --- a/Symbian3/PDK/Source/GUID-C474376E-1766-5781-B5BF-3786C5B4D72E.dita Tue Jul 20 12:00:49 2010 +0100 +++ b/Symbian3/PDK/Source/GUID-C474376E-1766-5781-B5BF-3786C5B4D72E.dita Fri Aug 13 16:47:46 2010 +0100 @@ -1,43 +1,43 @@ - - - - - -Performing -Scalar QueriesThis tutorial describes the way in which you can execute scalar -queries. -
Introduction

A -scalar query is a SELECT statement which refers to several -data fields and returns a single result, for example, a COUNT query -on a database column. This gives the number of records in the database. Symbian -platform provides a class TSqlScalarFullSelectQuery, for -making scalar queries. This is more efficient than the RSqlStatement class.

-
Basic procedure

The -high level steps to perform scalar queries are shown here:

    -
  1. Declare the necessary -variables.

  2. -
  3. Execute the query string.

  4. -
-
Detailed steps

To -make a scalar query, do the following:

Declare -the necessary variables

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

    RSqlDatabase myDatabase;
  2. -
  3. Declare a literal to -hold the query string

    _LIT(kQueryString,"SELECT COUNT (*) FROM myTable");
  4. -
  5. Instantiate an object -of the TSqlScalarFullSelectQuery class. This class has -a peculiar feature of instantiating an instance of it with a parameter that -refers to the database to be queried. The class supplies a number of functions -taking SELECT statements as parameters.

    TSqlScalarFullSelectQuery myFullSelectQuery(myDatabase);
  6. -

Execute -the query

Execute the query

TInt recCount = myFullSelectQuery.SelectIntL(kQueryString));
-
See also

Querying a Database

Inserting a Row into a Table

Deleting Rows from a Table

Reading to a Buffer

Reading to Memory

Reading to a Data Stream

Writing to a Data Stream

Performing -Scalar Queries - This document

+ + + + + +Performing +Scalar QueriesThis tutorial describes the way in which you can execute scalar +queries. +
Introduction

A +scalar query is a SELECT statement which refers to several +data fields and returns a single result, for example, a COUNT query +on a database column. This gives the number of records in the database. Symbian +platform provides a class TSqlScalarFullSelectQuery, for +making scalar queries. This is more efficient than the RSqlStatement class.

+
Basic procedure

The +high level steps to perform scalar queries are shown here:

    +
  1. Declare the necessary +variables.

  2. +
  3. Execute the query string.

  4. +
+
Detailed steps

To +make a scalar query, do the following:

Declare +the necessary variables

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

    RSqlDatabase myDatabase;
  2. +
  3. Declare a literal to +hold the query string

    _LIT(kQueryString,"SELECT COUNT (*) FROM myTable");
  4. +
  5. Instantiate an object +of the TSqlScalarFullSelectQuery class. This class has +a peculiar feature of instantiating an instance of it with a parameter that +refers to the database to be queried. The class supplies a number of functions +taking SELECT statements as parameters.

    TSqlScalarFullSelectQuery myFullSelectQuery(myDatabase);
  6. +

Execute +the query

Execute the query

TInt recCount = myFullSelectQuery.SelectIntL(kQueryString));
+
See also

Querying a Database

Inserting a Row into a Table

Deleting Rows from a Table

Reading to a Buffer

Reading to Memory

Reading to a Data Stream

Writing to a Data Stream

Performing +Scalar Queries - This document

\ No newline at end of file