Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: DAMDBMS.H
Link against: damodl.lib

This item is not part of the S60 3rd Edition SDK for Symbian OS, Feature Pack 2.

Class CDaModel

class CDaModel : public CBase;

Description

Database application engine.

The class:

Derivation

Members

Defined in CDaModel:
AlterTable(), AtRow(), Attach(), BuildViewL(), BuildViewL(), BuildViewSyncL(), BuildViewSyncL(), CloseDatabase(), CloseView(), ColSet(), CreateDatabaseL(), CreateDatabaseL(), CreateIndex(), CurrentRow(), Database(), DbRecordCount(), DbStreamId(), DefaultIndexName(), DeleteRowL(), EAtRow, ENotAtRow, ETriedBeforeFirst, ETriedBeyondLast, ExternalizeL(), FirstL(), GetL(), GoToBookmarkL(), HandleFirstFindL(), HasOpenDatabase(), HasRDbView(), HowManySteps(), InternalizeL(), IsValid(), LastL(), MoveToRowL(), NewDatabaseL(), NewL(), NewL(), NextL(), Observer(), OpenDatabaseL(), OpenDatabaseL(), Panic(), PreviousL(), PutL(), RecordStatsWin(), RowPosState(), RowPosState(), RowSetCount(), SetCurrentRow(), SetDbColNo(), SetDbRecordCountL(), SetRecordStatsWin(), SetRowSetCountL(), SetYesNoArray(), SqlParams(), TState, TableDef(), UndoDeleteRowL(), UndoStack(), UpdateAllViewsL(), UserDbDesc(), View(), View(), ViewHasRows(), YesNoArray(), iDebugWin

Inherited from CBase:
Delete(), Extension_(), operator new()


Construction and destruction


NewL()

static IMPORT_C CDaModel *NewL();

Description

Allocates and constructs a new database application engine.

Return value

CDaModel *

New database application engine


NewL()

static IMPORT_C CDaModel *NewL(CFileStore &fileStore);

Description

Allocates and constructs a new database application engine, initialising it from a store holding a store database.

The store database is found in the specified store, and opened.

Parameters

CFileStore &fileStore

Store holding a store database

Return value

CDaModel *

New database application engine

[Top]


Member functions


Attach()

inline void Attach(MDaObserver *aObserver);

Description

Sets a database application engine observer.

Parameters

MDaObserver *aObserver

Database application engine observer


CloseDatabase()

IMPORT_C void CloseDatabase();

Description

Closes the object's store database if one is open.


NewDatabaseL()

IMPORT_C void NewDatabaseL(CStreamStore &aStore);

Description

Creates and opens a new store database for the object.

The existing user column set is set for the new database.

Parameters

CStreamStore &aStore

Store in which to write the new store database


ExternalizeL()

IMPORT_C void ExternalizeL(RWriteStream &aStream) const;

Description

Externalises the engine setttings to a stream.

Parameters

RWriteStream &aStream

Stream to which to write


InternalizeL()

IMPORT_C void InternalizeL(RReadStream &source);

Description

Internalises the engine setttings from a stream.

Parameters

RReadStream &source

Stream from which to read


OpenDatabaseL()

IMPORT_C void OpenDatabaseL(CStreamStore &aStore);

Description

Opens an existing store database.

If a database is already open, it is closed.

Parameters

CStreamStore &aStore

Store holding a store database


OpenDatabaseL()

IMPORT_C void OpenDatabaseL(RDbStoreDatabase &aDatabase, CStreamStore &aStore);

Description

Opens and returns an existing store database.

If a database is already open, it is closed.

Parameters

RDbStoreDatabase &aDatabase

On return, the opened database

CStreamStore &aStore

Store holding a store database


CloseView()

IMPORT_C void CloseView();

Description

Closes the open database view and destroys the associated column set.


FirstL()

IMPORT_C void FirstL();

Description

Moves to the first row in the view.


LastL()

IMPORT_C void LastL();

Description

Moves to the last row in the view.


NextL()

IMPORT_C void NextL();

Description

Moves to the next row in the view.

If the position is already on the last row, it remains there.


PreviousL()

IMPORT_C void PreviousL();

Description

Moves to the previous row in the view.

If the position is already on the first row, it remains there.


MoveToRowL()

IMPORT_C void MoveToRowL(TInt aRow);

Description

Moves to a specified row in the view.

If the requested row is greater than the last row, the position is set to the last row. If the requested row in less than the first row, the position is set to the first row.

Parameters

TInt aRow

Row to move to


IsValid()

inline TBool IsValid() const;

Description

Tests if a valid position in a valid view is set.

Return value

TBool

True if a valid view and position is set, otherwise false


DefaultIndexName()

inline const TPtrC &DefaultIndexName() const;

Description

Gets the default index name.

Return value

const TPtrC &

Default index name


AtRow()

inline TInt AtRow();

Description

Gets the current row in the view.

Return value

TInt

Current row


HasRDbView()

inline TBool HasRDbView() const;

Description

Tests if a valid view is set.

Return value

TBool

True if a valid view is set, otherwise false


ViewHasRows()

inline TBool ViewHasRows() const;

Description

Tests if the view has any rows (i.e. is not empty).

Return value

TBool

True if the view has any rows, otherwise false


HasOpenDatabase()

inline TBool HasOpenDatabase() const;

Description

Tests if the object has an open database.

Return value

TBool

True if the object has an open database


DbRecordCount()

inline TInt DbRecordCount() const;

Description

Gets the stored record count variable (settable with SetDbRecordCountL()).

Return value

TInt

Record count


RowSetCount()

inline TInt RowSetCount() const;

Description

Gets the stored row set count variable (settable with SetRowSetCountL()).

Return value

TInt

Row set count


ColSet()

inline CDbColSet *ColSet() const;

Description

Gets the column definition set for the view.

Return value

CDbColSet *

Column definition set


UserDbDesc()

inline CDaUserDbDesc *UserDbDesc() const;

Description

Gets the object's database application helper object.

Return value

CDaUserDbDesc *

Database application helper object


CurrentRow()

inline TInt CurrentRow() const;

Description

Gets the stored current row variable (settable with SetCurrentRow()).

Return value

TInt

Current row


Database()

inline RDbDatabase &Database();

Description

Gets the current database.

Return value

RDbDatabase &

Database


DbStreamId()

inline TStreamId DbStreamId() const;

Description

Gets the ID of the stream in the store holding the database.

Return value

TStreamId

Stream ID


RowPosState()

inline TState RowPosState() const;

Description

Gets the result of the last row traversal operation.

Return value

TState

Result of the last row traversal operation


SqlParams()

inline CDaSqlParams *SqlParams() const;

Description

Gets the SQL parameters object.

Return value

CDaSqlParams *

SQL parameters object


TableDef()

inline CDbColSet *TableDef() const;

Description

Gets the column definition set for the database table.

Return value

CDbColSet *

Column definition set


RecordStatsWin()

inline MDaObserver *RecordStatsWin();

Description

Gets the database observer set through SetRecordStatsWin().

Return value

MDaObserver *

Database observer


View()

inline RDbView &View();

Description

Gets the database view.

Return value

RDbView &

Database view


View()

inline const RDbView &View() const;

Description

Gets the database view (const overload).

Return value

const RDbView &

Database view


Observer()

inline MDaObserver *Observer() const;

Description

Gets the database observer set through Attach().

Return value

MDaObserver *

Database observer


UndoStack()

inline const CDaUndoStack &UndoStack() const;

Description

Gets the object's undo stack.

Return value

const CDaUndoStack &

Undo stack


YesNoArray()

inline const CDesCArray *YesNoArray() const;

Description

Gets the string array set by SetYesNoArray().

The array is not used by the engine.

Return value

const CDesCArray *

String array


SetDbColNo()

inline void SetDbColNo();

Description

Sets the column number fields.


SetCurrentRow()

inline void SetCurrentRow(TInt aCurrentRow);

Description

Sets the stored current row variable.

Parameters

TInt aCurrentRow

Current row


RowPosState()

inline void RowPosState(TState aState);

Description

Sets the result of the last row traversal operation.

Parameters

TState aState

Result of the last row traversal operation


SetDbRecordCountL()

inline void SetDbRecordCountL();

Description

Sets the database record count variable to the number of rows in the current view.


SetRowSetCountL()

inline void SetRowSetCountL();

Description

Sets the database row set count variable to the number of rows in the current view.


SetRecordStatsWin()

inline void SetRecordStatsWin(MDaObserver *anObserver);

Description

Sets the statistics window database engine observer.

The observer is called for every Put() operation.

Parameters

MDaObserver *anObserver

Database engine observer


SetYesNoArray()

inline void SetYesNoArray(const CDesCArray &aYesNoArray);

Description

Sets the yes/no string array.

This is not used by the engine.

Parameters

const CDesCArray &aYesNoArray

String array


AlterTable()

IMPORT_C TInt AlterTable(CDaUserColSet *aNewUserColSet);

Description

Changes the structure of a specified table in the database to the specified column set.

! for now

Parameters

CDaUserColSet *aNewUserColSet

Column set to change to

Return value

TInt

KErrNone

See also:


CreateDatabaseL()

IMPORT_C void CreateDatabaseL(CDaUserColSet *aUserColSet);

Description

Creates a new database with a specified column set.

An already open database is closed.

Parameters

CDaUserColSet *aUserColSet

Column set


CreateDatabaseL()

IMPORT_C void CreateDatabaseL(CStreamStore *aStore, CDaUserColSet *aUserColSet);

Description

Creates and opens a new database with a specified column set.

Parameters

CStreamStore *aStore

Store in which to store the database

CDaUserColSet *aUserColSet

Column set


CreateIndex()

IMPORT_C TInt CreateIndex(const TDesC &anIndexName, CDbKey *aCDbKey);

Description

Creates a new index with the specified key.

Parameters

const TDesC &anIndexName

The name of the index to create

CDbKey *aCDbKey

The key for the new index

Return value

TInt

KErrNone if successful, or a system-wide or DBMS error code

See also:


HowManySteps()

IMPORT_C TInt HowManySteps(RDbIncremental &anAlterTable, CDaUserColSet *aNewUserColSet);

Description

Initiates an incremental table alteration operation on a database.

Parameters

RDbIncremental &anAlterTable

Database to alter

CDaUserColSet *aNewUserColSet

Column set to change to

Return value

TInt

The initial step count for the incremental operation. This value should be passed in to subsequent calls to RDbIncremental::NextL().


BuildViewL()

IMPORT_C void BuildViewL(const TDesC &aFindString);

Description

Builds a database view asynchronously from the specified search string.

Parameters

const TDesC &aFindString

Search string


BuildViewL()

IMPORT_C void BuildViewL();

Description

Builds a database view asynchronously from the last requested find string.


BuildViewSyncL()

IMPORT_C void BuildViewSyncL();

Description

Builds a database view synchronously from the last requested find string.


BuildViewSyncL()

IMPORT_C void BuildViewSyncL(const TDesC &aFindString);

Description

Builds a database view synchronously from the specified search string.

Parameters

const TDesC &aFindString

Search string


HandleFirstFindL()

IMPORT_C void HandleFirstFindL();

Description

Called by the SQL statement evaluator on finding the first result.


DeleteRowL()

IMPORT_C void DeleteRowL();

Description

Deletes the current row.

The delete operation is put on the undo stack.

It then moves to the next (or last) row in the view.

!! -1 if now rows in view


UndoDeleteRowL()

IMPORT_C void UndoDeleteRowL();

Description

Undoes the last delete operation.


GetL()

inline void GetL();

Description

Gets the current row data for access using the view's column extractor functions.

See also:


PutL()

IMPORT_C void PutL();

Description

Completes the insertion of a row.

See also:


UpdateAllViewsL()

IMPORT_C void UpdateAllViewsL(MDaObserver::TNotification=MDaObserver::EDefaultNotification);

Description

Sends a specified event to the database engine observer.

!late

Parameters

MDaObserver::TNotification

Event to send


GoToBookmarkL()

IMPORT_C void GoToBookmarkL(const TDbBookmark &aBookmark);

Description

! Only one view is active at any one time

Moves to the specified database bookmark.

Parameters

const TDbBookmark &aBookmark

Database bookmark


Panic()

static IMPORT_C void Panic(TInt aReason);

Description

Produces a "DaModel" category panic.

Parameters

TInt aReason

Panic code

[Top]


Member enumerations


Enum TState

TState

Description

Row traversal states.

ETriedBeyondLast

Tried to move beyond last row.

ETriedBeforeFirst

Tried to move before first row.

EAtRow

Moved to the specified row.

ENotAtRow

Did not move to any row.

[Top]


Member data


iDebugWin

MDaObserver * iDebugWin;

Description