CSqlExample Class Reference

List of all members.

Public Member Functions

 ~CSqlExample ()
void CreateNonSecureDBL ()
void CreateAndOpenSecureDBL ()
void CopyDatabaseL ()
void AttachDatabasesL ()
void DataTypesQueryL ()
void ScalarFullSelectL ()
void ColumnBinaryStreamL ()
void DeleteL ()

Static Public Member Functions

static CSqlExampleNewLC ()

Detailed Description

Demonstrates some uses of the Symbian platform SQL component.

The class demonstrates how to

  • Create and open secure and non secure databases
  • Copy a database
  • Attach two databases together
  • Execute a simple query (RSqlDatabase::Exec)
  • Prepare and execute a query with parameters (RSqlStatement)
  • Prepare and execute a query with a large parameter, writing that parameter using streaming (RParamWriteStream)
  • Prepare and execute a query which returns data, and read that data
  • Prepare and execute a query which returns data, and read that data using streaming (RColumnReadStream)
  • Query for a single value (TSqlScalarFullSelectQuery)

Definition at line 40 of file sqlexample.h.


Constructor & Destructor Documentation

CSqlExample::~CSqlExample (  ) 

Destructor

Definition at line 86 of file sqlexample.cpp.


Member Function Documentation

CSqlExample * CSqlExample::NewLC (  )  [static]

Allocates and constructs a CSqlExample object and leaves it on the cleanup stack. Initialises all member data to their default values.

Definition at line 61 of file sqlexample.cpp.

void CSqlExample::CreateNonSecureDBL (  ) 

Creates a non secure database, which has a table with two integers, and closes it. It is deleted at a later point of time after the copy operation. KErrNotFound, KErrAbort, KErrPermissionDenied, KErrArgument, system-wide error codes.

Definition at line 100 of file sqlexample.cpp.

void CSqlExample::CreateAndOpenSecureDBL (  ) 

Creates a secure database with a table and a certain security policy. Inserts a record, opens it and closes the database. The database is reopened later and hence not deleted here. KErrNone, KErrNoMemory, KErrBadName, KErrNotReady, KErrInUse, KErrNotFound, KErrGeneral, KErrPermissionDenied, KErrNotSupported, ESqlDbError, system-wide error codes

Definition at line 127 of file sqlexample.cpp.

void CSqlExample::CopyDatabaseL (  ) 

Essentially a file copy to allow users to copy a database from one file to another. SQL provides a mechanism to copy secure databases, (which live in the SQL private datacage) as a user is not allowed to do that. The source database is then deleted after copying it to the destination. KErrAbort, KErrPermissionDenied, KErrArgument, system-wide error codes.

Definition at line 171 of file sqlexample.cpp.

void CSqlExample::AttachDatabasesL (  ) 

Opens a secure database and attaches a non secure database to it. Database has to be open before an attach can be executed. KErrNoMemory, KErrBadName, KErrNotReady, KErrInUse, KErrNotFound, KErrGeneral, KErrPermissionDenied, KErrNotSupported, ESqlDbError, system-wide error codes

Definition at line 217 of file sqlexample.cpp.

void CSqlExample::DataTypesQueryL (  ) 

Prepares and executes both a simple query and a query with parameters. KErrNoMemory, KErrBadName, KErrNotReady, KErrInUse, KErrNotFound, KErrGeneral, KErrPermissionDenied, KErrNotSupported, ESqlDbError, system-wide error codes.

Definition at line 257 of file sqlexample.cpp.

void CSqlExample::ScalarFullSelectL (  ) 

1) Prepares and executes a query with a large parameter, writing that parameter using streaming (RParamWriteStream) 2) Creates a database with a table containing integer, 64-bit integer, float, text and Blob fields. 3) Inserts two records. 4) Implements TSqlScalarFullSelectQuery functions for 64 bit integer and text fields and checks the returned value. KErrNoMemory, KErrBadName, KErrNotReady, KErrInUse, KErrNotFound, KErrGeneral, KErrPermissionDenied, KErrNotSupported, ESqlDbError, system-wide error codes

Definition at line 328 of file sqlexample.cpp.

void CSqlExample::ColumnBinaryStreamL (  ) 

Prepare and execute a query which returns data, and read that data using streaming (RColumnReadStream) KErrNoMemory, KErrBadName, KErrNotReady, KErrInUse, KErrNotFound, KErrGeneral, KErrPermissionDenied, KErrNotSupported, ESqlDbError, system-wide error codes.

Definition at line 447 of file sqlexample.cpp.


Generated by  doxygen 1.6.2