CCommsDbTableView Class Reference

class CCommsDbTableView : public CBase

The view on a specific table in the database.

Includes the necessary behaviour for navigating through the records in the view and reading and writing to columns within a record.

Uses a CCommsDatabase and has an RDbView to read from and write to database. Created via CCommsDatabase::OpenTableLC() (which opens a view of all the records in the table) or one of the OpenViewLC...() functions (which open a specific view of the table):

CCommsDatabase::OpenTableLC()

CCommsDatabase::OpenViewMatchingUintLC()

CCommsDatabase::OpenViewMatchingBoolLC()

CCommsDatabase::OpenViewMatchingTextLC()

CCommsDatabase::OpenViewLC()

Note that the above five functions have been withdrawn in CCommsDatabase and are now implemented in CCommsDatabaseBase.

Inherits from

Public Member Functions
CCommsDbTableView(CCommsDatabaseBase &, const TDesC &)
~CCommsDbTableView()
IMPORT_C voidCancelRecordChanges()
CCommsDatabaseBase *Database()
IMPORT_C TIntDeleteRecord()
voidGetTableName(TDes &)
IMPORT_C TIntGotoFirstRecord()
IMPORT_C TIntGotoNextRecord()
IMPORT_C TIntGotoPreviousRecord()
IMPORT_C TIntInsertCopyRecord(TUint32 &)
IMPORT_C TIntInsertRecord(TUint32 &)
CCommsDbTableView *NewL(CCommsDatabaseBase &, const TDesC &, const TDbQuery &, TBool)
CCommsDbTableView *NewL(CCommsDatabaseBase &, const TDesC &, const TDesC &, const TDesC8 &)
CCommsDbTableView *NewL(CCommsDatabaseBase &, const TDesC &, const TDesC &, const TDesC16 &)
CCommsDbTableView *NewL(CCommsDatabaseBase &, const TDesC &, const TDesC &, TUint32)
CCommsDbTableView *NewLC(const TDesC &, CCommsDatabaseBase &)
CCommsDbTableView *NewLC(CCommsDatabaseBase &, const TDesC &, TBool)
CCommsDbTableView *NewLC(CCommsDatabaseBase &, const TDesC &, const TDesC &, TBool)
CCommsDbTableView *NewLC(CCommsDatabaseBase &, TUint32, TCommDbConnectionDirection)
CCommsDbTableView *NewLC(CCommsDatabaseBase &, TUint32)
CCommsDbTableView *NewLC(CCommsDatabaseBase &, TUint32, const TDesC &)
voidOpenL(const TDbQuery &)
IMPORT_C TIntPutRecordChanges(TBool, TBool)
IMPORT_C voidReadBoolL(const TDesC &, TBool &)
IMPORT_C voidReadColumnLengthL(const TDesC &, TInt &)
IMPORT_C voidReadColumnMaxLengthL(const TDesC &, TInt &)
IMPORT_C HBufC *ReadLongTextLC(const TDesC &)
IMPORT_C voidReadTextL(const TDesC &, TDes8 &)
IMPORT_C voidReadTextL(const TDesC &, TDes16 &)
IMPORT_C voidReadTypeAttribL(const TDesC &, TDbColType &, TUint32 &)
IMPORT_C voidReadUintL(const TDesC &, TUint32 &)
IMPORT_C voidSetNullL(const TDesC &)
IMPORT_C TIntUpdateRecord()
IMPORT_C voidWriteBoolL(const TDesC &, const TBool &)
IMPORT_C voidWriteLongTextL(const TDesC &, const TDesC &)
IMPORT_C voidWriteTextL(const TDesC &, const TDesC8 &)
IMPORT_C voidWriteTextL(const TDesC &, const TDesC16 &)
IMPORT_C voidWriteUintL(const TDesC &, const TUint32 &)
Protected Member Functions
voidClose()
TDbColNo ColNumL(const TDesC &)
voidConstructL(const TDesC &, TBool, TBool)
voidConstructL(const TDbQuery &, TBool)
voidConstructL(const TDesC &, const TDesC &, const TDesC8 &)
voidConstructL(const TDesC &, const TDesC &, const TDesC16 &)
voidConstructL(const TDesC &, const TDesC &, TUint32)
voidConstructL(const TDesC &, const TDesC &, TBool)
voidConstructL(TUint32, TCommDbConnectionDirection)
voidConstructL(TUint32)
voidConstructL(TUint32, const TDesC &)
voidConstructL(const TDesC &)
RDbRowSet::TAccess GetL()
Private Member Functions
TInt DoInsertRecord(TBool, TUint32 &, TBool)
TInt DoPutRecordChanges(TBool, TBool, TBool)
TInt InsertTemplateRecord()
TBool TableWithTemplateRecord()
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Private Member Enumerations
enumTTableState { EClosed, EOpenIdle, EInsert, EUpdate }
Protected Attributes
CCommsDatabaseBase &iDb
CCommDbTableExtension *iTableExt
TBuf< KCommsDbSvrMaxColumnNameLength >iTableName
RDbView iTableView
Private Attributes
TUint32 iCurrentId
TUint32 iInsertedRecordIndex
TTableState iState
CCommsDbTemplateRecord *iTemplate
TBool iTsyNameChanged

Constructor & Destructor Documentation

CCommsDbTableView(CCommsDatabaseBase &, const TDesC &)

CCommsDbTableView(CCommsDatabaseBase &aDb,
const TDesC &aTableName
)

Internal constructor.

Parameters

CCommsDatabaseBase & aDbReference to the instance of the Comms Database.
const TDesC & aTableNameThe name of the table to view.

~CCommsDbTableView()

IMPORT_C~CCommsDbTableView()[virtual]

Frees all resources owned by this object, prior to its destruction. Specifically, it closes the view.

Member Functions Documentation

CancelRecordChanges()

IMPORT_C voidCancelRecordChanges()

Abandons changes made to a record which were started by calls to either:InsertRecord() or UpdateRecord().

A call to one of either InsertRecord() or UpdateRecord() must have previously been made otherwise the function raises a CommsDbServer 5 panic.

Close()

voidClose()[protected]

Closes the rowset and releases any owned resources.

ColNumL(const TDesC &)

TDbColNo ColNumL(const TDesC &aColumn)const [protected]

Return the column number of the Column aColumn in the table

Coloumn concept doesn't exist in CommsDat Not supported from v9.1

Parameters

const TDesC & aColumnA reference to a descriptor containing the name of a column in the current record.

ConstructL(const TDesC &, TBool, TBool)

voidConstructL(const TDesC &aTableName,
TBoolaShowHidden,
TBoolaUseTemplate
)[protected]

Prepares and evaluates the table view

Parameters

const TDesC & aTableName
TBool aShowHidden
TBool aUseTemplateA boolean value whether to use template while creating the object or not

ConstructL(const TDbQuery &, TBool)

voidConstructL(const TDbQuery &aQuery,
TBoolaUseTemplate
)[protected]

Prepares and evaluates the table view using the SQL query aQuery

This method is deprecated from 9.1 and always returns/leaves with KErrNotSupported instead of describing past operation/parameters.

Parameters

const TDbQuery & aQueryA reference to TDbQuery which contains the query to perform
TBool aUseTemplateA boolean value whether to use template while creating the object or not

ConstructL(const TDesC &, const TDesC &, const TDesC8 &)

voidConstructL(const TDesC &aTableName,
const TDesC &aColumnToMatch,
const TDesC8 &aValueToMatch
)[protected]

Parameters

const TDesC & aTableName
const TDesC & aColumnToMatch
const TDesC8 & aValueToMatch

ConstructL(const TDesC &, const TDesC &, const TDesC16 &)

voidConstructL(const TDesC &aTableName,
const TDesC &aColumnToMatch,
const TDesC16 &aValueToMatch
)[protected]

Parameters

const TDesC & aTableName
const TDesC & aColumnToMatch
const TDesC16 & aValueToMatch

ConstructL(const TDesC &, const TDesC &, TUint32)

voidConstructL(const TDesC &aTableName,
const TDesC &aColumnToMatch,
TUint32aValueToMatch
)[protected]

Parameters

const TDesC & aTableName
const TDesC & aColumnToMatch
TUint32 aValueToMatch

ConstructL(const TDesC &, const TDesC &, TBool)

voidConstructL(const TDesC &aTableName,
const TDesC &aColumnToMatch,
TBoolaValueToMatch
)[protected]

Parameters

const TDesC & aTableName
const TDesC & aColumnToMatch
TBool aValueToMatch

ConstructL(TUint32, TCommDbConnectionDirection)

voidConstructL(TUint32aBearerSet,
TCommDbConnectionDirectionaDirection
)[protected]

Parameters

TUint32 aBearerSet
TCommDbConnectionDirection aDirection

ConstructL(TUint32)

voidConstructL(TUint32aNetworkId)[protected]

Parameters

TUint32 aNetworkId

ConstructL(TUint32, const TDesC &)

voidConstructL(TUint32aServiceId,
const TDesC &aServiceType
)[protected]

Parameters

TUint32 aServiceId
const TDesC & aServiceType

ConstructL(const TDesC &)

voidConstructL(const TDesC &aTableName)[protected]

Used only for template record creation

Parameters

const TDesC & aTableName

Database()

CCommsDatabaseBase *Database()const [inline]

DeleteRecord()

IMPORT_C TIntDeleteRecord()

Deletes the record in the table at the current cursor position.

This function raises a CommsDbServer 3 panic if a previous call to InsertRecord() or UpdateRecord() has been made.

capability
Dependent on table, see the guide page referenced below.

DoInsertRecord(TBool, TUint32 &, TBool)

TInt DoInsertRecord(TBoolaType,
TUint32 &aId,
TBoolaIsTemplate
)[private]

Parameters

TBool aType
TUint32 & aId
TBool aIsTemplate

DoPutRecordChanges(TBool, TBool, TBool)

TInt DoPutRecordChanges(TBoolaHidden = EFalse,
TBoolaReadOnly = EFalse,
TBoolaIsTemplateCall = EFalse
)[private]

Confirms changes made to a record, which were started by calls to one of InsertRecord() or UpdateRecord().

The record can be marked as hidden by passing ETrue as a parameter. By default, records are not hidden.

A call to one of either InsertRecord() or UpdateRecord() must have previously been made otherwise the function raises a CommsDbServer 4 panic.

capability
Dependent on table, see the guide page referenced below.

Parameters

TBool aHidden = EFalseDefines whether or not the record is to be marked as hidden. A true value means that the record is to be hidden. If not explicitly specified, EFalse is taken as default.
TBool aReadOnly = EFalseDefines whether or not the record is to be stored as read-only. Read-only storage prevents the record from being altered at a later time.
TBool aIsTemplateCall = EFalse

GetL()

RDbRowSet::TAccess GetL()[protected]

Gets the operations that can be performed on the current view

GetTableName(TDes &)

voidGetTableName(TDes &aTableName)const [inline]

Gets the name of the table associated with this view and copies it into the descriptor supplied by the caller.

Parameters

TDes & aTableNameA reference to a descriptor passed by the caller. On return from this function it contains the name of the table.

GotoFirstRecord()

IMPORT_C TIntGotoFirstRecord()

Sets the first record in the view as the current record; i.e. set the view's cursor to point to the first record.

The CommsDbServer 6 panic is also raised if this function is called after the view has been closed.

This function must not be called if any of the operations involved in inserting or updating a record are still outstanding, otherwise the function raises a CommsDbServer 6 panic. For example, the panic is raised if this function is called between calls to UpdateRecord() and PutRecordChanges().

capability
Dependent on table, see the guide page referenced below.

GotoNextRecord()

IMPORT_C TIntGotoNextRecord()

Sets the next record in the view as the current record; i.e. set the view's cursor to point to the next record.

This function must not be called if any of the operations involved in inserting or updating a record are still outstanding, otherwise the function raises a CommsDbServer 7 panic. For example, the panic is raised if this function is called between calls to UpdateRecord() and PutRecordChanges().

The CommsDbServer 7 panic is also raised if this function is called after the view has been closed.

capability
Dependent on table, see the guide page referenced below.

GotoPreviousRecord()

IMPORT_C TIntGotoPreviousRecord()

Sets the previous record in the view as the current record; i.e. set the view's cursor to point to the previous record.

This function must not be called if any of the operations involved in inserting or updating a record are still outstanding, otherwise the function raises a CommsDbServer 8 panic. For example, the panic is raised if this function is called between calls to UpdateRecord() and PutRecordChanges().

The CommsDbServer 8 panic is also raised if this function is called after the view has been closed.

capability
Dependent on table, see the guide page referenced below.

InsertCopyRecord(TUint32 &)

IMPORT_C TIntInsertCopyRecord(TUint32 &aId)

Add a new record to this table. Filling all empty fields with values copied from record currently pointed at. The record number is returned. `PutRecordChanges()` is called to complete the transaction

Inserts a row into the the table and writes the {incremented) id to aId Filling all empty fields with values copied from record currently pointed at. The record number is returned.

capability
Dependent on table, see the guide page referenced below.

Parameters

TUint32 & aIdOn return contains the unique Id associated with this new record.

InsertRecord(TUint32 &)

IMPORT_C TIntInsertRecord(TUint32 &aId)

Prepares database to insert a new record and returns a unique ID for the record to be added.

PutRecordChanges() must be called to add the new entry.

This function sets the CCommsDbTableView onto the new record.

Once all changes to the new record are complete, a call must be made to either PutRecordChanges() or CancelRecordChanges() as appropriate.

This function raises a CommsDbServer 1 panic if a previous call to InsertRecord() or UpdateRecord() has already been made.

This function must be called before any attempt is made to write to a new column, otherwise subsequent write operations raise a CommsDbServer 12 panic.

Once this function has completed successfully, no attempt can be made to read from a column until either PutRecordChanges() or CancelRecordChanges() has been called to complete the record insertion operation, otherwise the read operations raise a CommsDbServer 10 panic.

Parameters

TUint32 & aIdOn successful return, contains the unique Id associated with the new record.

InsertTemplateRecord()

TInt InsertTemplateRecord()[private]

Inserts a row into the the table as template record

NewL(CCommsDatabaseBase &, const TDesC &, const TDbQuery &, TBool)

CCommsDbTableView *NewL(CCommsDatabaseBase &aDb,
const TDesC &aTableName,
const TDbQuery &aQuery,
TBoolaUseTemplate = ETrue
)[static]

Internal low level view creation.

Not in use after shim is introduced

Use if CCommsDatabase::OpenTableLC() or CCommsDatabase::OpenViewLC...() are not sufficient.

Note that OpenTableLC() and OpenViewLC...() have been withdrawn in CCommsDatabase and are now implemented in CCommsDatabaseBase.

This method is deprecated from 9.1 and always returns/leaves with KErrNotSupported instead of describing past operation/parameters.

Parameters

CCommsDatabaseBase & aDbReference to the instance of the Comms Database to use.
const TDesC & aTableNameName of the table of view.
const TDbQuery & aQueryQuery to perform.
TBool aUseTemplate = ETrueUse the template values from the database - defaults to ETrue.

NewL(CCommsDatabaseBase &, const TDesC &, const TDesC &, const TDesC8 &)

CCommsDbTableView *NewL(CCommsDatabaseBase &aDb,
const TDesC &aTableName,
const TDesC &aColumnToMatch,
const TDesC8 &aValueToMatch
)[static]

Internal low level view creation.

Use if CCommsDatabase::OpenTableLC() or CCommsDatabase::OpenViewLC...() are not sufficient.

Note that OpenTableLC() and OpenViewLC...() have been withdrawn in CCommsDatabase and are now implemented in CCommsDatabaseBase.

Parameters

CCommsDatabaseBase & aDbReference to the instance of the Comms Database to use.
const TDesC & aTableNameName of the table of view.
const TDesC & aColumnToMatch
const TDesC8 & aValueToMatch

NewL(CCommsDatabaseBase &, const TDesC &, const TDesC &, const TDesC16 &)

CCommsDbTableView *NewL(CCommsDatabaseBase &aDb,
const TDesC &aTableName,
const TDesC &aColumnToMatch,
const TDesC16 &aValueToMatch
)[static]

Internal low level view creation.

Use if CCommsDatabase::OpenTableLC() or CCommsDatabase::OpenViewLC...() are not sufficient.

Note that OpenTableLC() and OpenViewLC...() have been withdrawn in CCommsDatabase and are now implemented in CCommsDatabaseBase.

Parameters

CCommsDatabaseBase & aDbReference to the instance of the Comms Database to use.
const TDesC & aTableNameName of the table of view.
const TDesC & aColumnToMatch
const TDesC16 & aValueToMatch

NewL(CCommsDatabaseBase &, const TDesC &, const TDesC &, TUint32)

CCommsDbTableView *NewL(CCommsDatabaseBase &aDb,
const TDesC &aTableName,
const TDesC &aColumnToMatch,
TUint32aValueToMatch
)[static]

Internal low level view creation.

Use if CCommsDatabase::OpenTableLC() or CCommsDatabase::OpenViewLC...() are not sufficient.

Note that OpenTableLC() and OpenViewLC...() have been withdrawn in CCommsDatabase and are now implemented in CCommsDatabaseBase.

Parameters

CCommsDatabaseBase & aDbReference to the instance of the Comms Database to use.
const TDesC & aTableNameName of the table of view.
const TDesC & aColumnToMatch
TUint32 aValueToMatch

NewLC(const TDesC &, CCommsDatabaseBase &)

CCommsDbTableView *NewLC(const TDesC &aTableName,
CCommsDatabaseBase &aDb
)[static]

Internal low level view creation.

Used only if is called from TemplateRecord class

Parameters

const TDesC & aTableNameName of the table of view.
CCommsDatabaseBase & aDbReference to the instance of the Comms Database to use.

NewLC(CCommsDatabaseBase &, const TDesC &, TBool)

CCommsDbTableView *NewLC(CCommsDatabaseBase &aDb,
const TDesC &aTableName,
TBoolaUseTamplate = ETrue
)[static]

Internal low level view creation.

Internal use as replacement for SQL queries. Introduced with commdb shim

Parameters

CCommsDatabaseBase & aDbReference to the instance of the Comms Database to use.
const TDesC & aTableNameName of the table of view.
TBool aUseTamplate = ETrue

NewLC(CCommsDatabaseBase &, const TDesC &, const TDesC &, TBool)

CCommsDbTableView *NewLC(CCommsDatabaseBase &aDb,
const TDesC &aTableName,
const TDesC &aColumnToMatch,
TBoolaValueToMatch
)[static]

Internal low level view creation.

Use if CCommsDatabase::OpenTableLC() or CCommsDatabase::OpenViewLC...() are not sufficient.

Note that OpenTableLC() and OpenViewLC...() have been withdrawn in CCommsDatabase and are now implemented in CCommsDatabaseBase.

Parameters

CCommsDatabaseBase & aDbReference to the instance of the Comms Database to use.
const TDesC & aTableNameName of the table of view.
const TDesC & aColumnToMatch
TBool aValueToMatch

NewLC(CCommsDatabaseBase &, TUint32, TCommDbConnectionDirection)

CCommsDbTableView *NewLC(CCommsDatabaseBase &aDb,
TUint32aBearerSet,
TCommDbConnectionDirectionaDirection
)[static]

Internal low level view creation.

Use if CCommsDatabase::OpenTableLC() or CCommsDatabase::OpenViewLC...() are not sufficient.

Note that OpenTableLC() and OpenViewLC...() have been withdrawn in CCommsDatabase and are now implemented in CCommsDatabaseBase.

Parameters

CCommsDatabaseBase & aDbReference to the instance of the Comms Database to use.
TUint32 aBearerSet
TCommDbConnectionDirection aDirection

NewLC(CCommsDatabaseBase &, TUint32)

CCommsDbTableView *NewLC(CCommsDatabaseBase &aDb,
TUint32aNetworkId
)[static]

Internal low level view creation.

Use if CCommsDatabase::OpenTableLC() or CCommsDatabase::OpenViewLC...() are not sufficient.

Note that OpenTableLC() and OpenViewLC...() have been withdrawn in CCommsDatabase and are now implemented in CCommsDatabaseBase.

Parameters

CCommsDatabaseBase & aDbReference to the instance of the Comms Database to use.
TUint32 aNetworkId

NewLC(CCommsDatabaseBase &, TUint32, const TDesC &)

CCommsDbTableView *NewLC(CCommsDatabaseBase &aDb,
TUint32aServiceId,
const TDesC &aServiceType
)[static]

Internal low level view creation.

Use if CCommsDatabase::OpenTableLC() or CCommsDatabase::OpenViewLC...() are not sufficient.

Note that OpenTableLC() and OpenViewLC...() have been withdrawn in CCommsDatabase and are now implemented in CCommsDatabaseBase.

Parameters

CCommsDatabaseBase & aDbReference to the instance of the Comms Database to use.
TUint32 aServiceId
const TDesC & aServiceType

OpenL(const TDbQuery &)

voidOpenL(const TDbQuery &aQuery)

This method is deprecated from 9.1 and always returns/leaves with KErrNotSupported instead of describing past operation/parameters.

Parameters

const TDbQuery & aQueryA reference to TDbQuery which contains the query to perform

PutRecordChanges(TBool, TBool)

IMPORT_C TIntPutRecordChanges(TBoolaHidden = EFalse,
TBoolaReadOnly = EFalse
)

Confirms changes made to a record, which were started by calls to one of InsertRecord() or UpdateRecord().

The record can be marked as hidden by passing ETrue as a parameter. By default, records are not hidden.

A call to one of either InsertRecord() or UpdateRecord() must have previously been made otherwise the function raises a CommsDbServer 4 panic.

capability
Dependent on table, see the guide page referenced below.

Parameters

TBool aHidden = EFalseDefines whether or not the record is to be marked as hidden. A true value means that the record is to be hidden. If not explicitly specified, EFalse is taken as default.
TBool aReadOnly = EFalseDefines whether or not the record is to be stored as read-only. Read-only storage prevents the record from being altered at a later time.

ReadBoolL(const TDesC &, TBool &)

IMPORT_C voidReadBoolL(const TDesC &aColumn,
TBool &aValue
)

Reads a boolean value located in a specific column within the current record and copies it into a specified value. The column is identified by the name supplied in the descriptor aColumn.

If the column in the current record has a NULL value and the table has a template record, then the value located in the corresponding column in that template record is read and copied into aValue.

If the column in the current record has a NULL value and the table does not have a template record, then the function leaves.

This read operation must not occur if any of the operations involved in inserting or updating a record are still outstanding, otherwise the function raises a CommsDbServer 10 panic. For example, the panic is raised if this function is called between calls to UpdateRecord() and PutRecordChanges().

This panic is also raised if this function is called after the view has been closed.

leave
KErrUnknown if the specified column is null; KErrNotFound if the specified column does not exist in the table.
capability
Dependent on table, see the guide page referenced below.

Parameters

const TDesC & aColumnA reference to a descriptor containing the name of the column in the current record whose (boolean) value is to be read.
TBool & aValueA reference to a TBool passed by the caller.

ReadColumnLengthL(const TDesC &, TInt &)

IMPORT_C voidReadColumnLengthL(const TDesC &aColumn,
TInt &aLength
)

Gets the length of a specific column within the current record and copies it into a reference to an integer. The column is identified by the name supplied in the descriptor aColumn.

If the length of the column is zero and the table has a template record, then the length of the corresponding column in that template record is copied into aValue.

Null columns return 0; integers and bools return 1; strings return their length in characters.

This read operation must not occur if any of the operations involved in inserting or updating a record are still outstanding, otherwise the function raises a CommsDbServer 10 panic. For example, the panic is raised if this function is called between calls to UpdateRecord() and PutRecordChanges().

This panic is also raised if this function is called after the view has been closed.

leave
KErrNotFound Specified column does not exist in the table.
capability
Dependent on table, see the guide page referenced below.

Parameters

const TDesC & aColumnA reference to a descriptor containing the name of a column in the current record.
TInt & aLengthA reference to an integer passed by the caller. On successful return from this function, contains a copy of the length of the column.

ReadColumnMaxLengthL(const TDesC &, TInt &)

IMPORT_C voidReadColumnMaxLengthL(const TDesC &aColumn,
TInt &aLength
)

Reads the MAXIMUM length of the contents of aColumn from the current record into aLength

capability
Dependent on table, see the guide page referenced below.

Parameters

const TDesC & aColumnA reference to a descriptor containing the name of a column in the current record.
TInt & aLengthA reference to an integer passed by the caller. On successful return from this function, contains a copy of the length of the column.

ReadLongTextLC(const TDesC &)

IMPORT_C HBufC *ReadLongTextLC(const TDesC &aColumn)

Reads the long text located in a specific column within the current record and copies this text to a heap descriptor. The heap descriptor is allocated and its pointer returned by this function. The column is identified by the name supplied in the descriptor aColumn.

If the column in the current record has a NULL value and the table has a template record, then the long text located in the corresponding column in that template record is read and copied.

If the column in the current record has a NULL value and the table does not have a template record, then the length of the returned heap descriptor is zero and the descriptor contains no text.

While the text in columns retrieved by the ReadTextL() functions is limited in length, there is no restriction on the length of long text.

The HBufC* returned is left on the cleanup stack. The caller is responsible for calling CleanupStack::PopAndDestroy().

This read operation must not occur if any of the operations involved in inserting or updating a record are still outstanding, otherwise the function raises a CommsDbServer 10 panic. For example, the panic is raised if this function is called between calls to UpdateRecord() and PutRecordChanges().

This panic is also raised if this function is called after the view has been closed.

leave
KErrNotFound if the specified column does not exist in the table; KErrNoMemory if out of memory.
capability
Dependent on table, see the guide page referenced below.

Parameters

const TDesC & aColumnA reference to a descriptor containing the name of a column in the current record.

ReadTextL(const TDesC &, TDes8 &)

IMPORT_C voidReadTextL(const TDesC &aColumn,
TDes8 &aValue
)

Reads narrow (ASCII) text located in a specific column within the current record and copies it into an 8 bit modifiable descriptor. The column is identified by the name supplied in the descriptor aColumn.

If the column in the current record has a NULL value and the table has a template record, then the text located in the corresponding column in that template record is read and copied into aValue.

If the column in the current record has a NULL value and the table does not have a template record, then the length of the descriptor aValue is set to zero and the descriptor contains no text.

The maximum length of text expected by this function is the value of the constant KCommsDbSvrMaxColumnNameLength. The maximum length of aValue supplied by the caller can, therefore, be the same.

This read operation must not occur if any of the operations involved in inserting or updating a record are still outstanding, otherwise the function raises a CommsDbServer 10 panic. For example, the panic is raised if this function is called between calls to UpdateRecord() and PutRecordChanges().

This panic is also raised if this function is called after the view has been closed.

Note:

If the column to be read is encrypted then the function decrypts it.

leave
KErrNotFound Specified column does not exist in the table.
capability
Dependent on table, see the guide page referenced below.

Parameters

const TDesC & aColumnA reference to a descriptor containing the name of the column in the current record whose (narrow text) value is to be read.
TDes8 & aValueA reference to an 8 bit descriptor passed by the caller.

ReadTextL(const TDesC &, TDes16 &)

IMPORT_C voidReadTextL(const TDesC &aColumn,
TDes16 &aValue
)

Reads wide (Unicode) text located in a specific column within the current record and copies it into a 16 bit modifiable descriptor. The column is identified by the name supplied in the descriptor aColumn.

If the column in the current record has a NULL value and the table has a template record, then the text located in the corresponding column in that template record is read and copied into aValue.

If the column in the current record has a NULL value and the table does not have a template record, then the length of the descriptor aValue is set to zero and the descriptor contains no text.

The maximum length of text expected by this function is the value of the constant KCommsDbSvrMaxColumnNameLength. The maximum length of aValue supplied by the caller can, therefore, be the same.

This read operation must not occur if any of the operations involved in inserting or updating a record are still outstanding, otherwise the function raises a CommsDbServer 10 panic. For example, the panic is raised if this function is called between calls to UpdateRecord() and PutRecordChanges().

This panic is also raised if this function is called after the view has been closed.

Note:

If the column to be read is encrypted then the function decrypts it.

leave
KErrNotFound Specified column does not exist in the table
capability
Dependent on table, see the guide page referenced below.

Parameters

const TDesC & aColumnA reference to a descriptor containing the name of the column in the current record whose (wide text) value is to be read.
TDes16 & aValueA reference to a 16 bit descriptor passed by the caller.

ReadTypeAttribL(const TDesC &, TDbColType &, TUint32 &)

IMPORT_C voidReadTypeAttribL(const TDesC &aColumn,
TDbColType &aColType,
TUint32 &aAttrib
)

Gets the type and the attributes of a specific column within the current record and puts them into a TDbColType object and a reference to an unsigned integer respectively. The column is identified by the name supplied in the descriptor aColumn.

The column attributes are one or more of the values TDbCol::ENotNull and TDbCol::EAutoIncrement.

From v9.1 COMMDB_ID doesn't exist. Bacause of BC it is neccessary to return expected values

This function must not be called if any of the operations involved in inserting or updating a record are still outstanding, otherwise the function raises a CommsDbServer 10 panic. For example, the panic is raised if this function is called between calls to UpdateRecord() and PutRecordChanges().

This panic is also raised if this function is called after the view has been closed.

leave
KErrNotFound Specified column does not exist in the table
capability
Dependent on table, see the guide page referenced below.

Parameters

const TDesC & aColumnA reference to a descriptor containing the name of the column in the current record whose type and attributes are to be fetched.
TDbColType & aColTypeA reference to a TDbColType object passed by the caller. On successful return from this function, contains a copy of the column type.
TUint32 & aAttribA reference to an unsigned integer passed by the caller. On successful return from this function, contains a copy of the column attributes.

ReadUintL(const TDesC &, TUint32 &)

IMPORT_C voidReadUintL(const TDesC &aColumn,
TUint32 &aValue
)

Reads an unsigned integer value located in a specific column within the current record and copies it into a reference to an unsigned integer. The column is identified by the name supplied in the descriptor aColumn.

If the column in the current record has a NULL value and the table has a template record, then the unsigned integer value located in the corresponding column in that template record is read and copied into aValue.

If the column in the current record has a NULL value and the table does not have a template record, then the function leaves.

This read operation must not occur if any of the operations involved in inserting or updating a record are still outstanding, otherwise the function raises a CommsDbServer 10 panic. For example, the panic is raised if this function is called between calls to UpdateRecord() and PutRecordChanges().

This panic is also raised if this function is called after the view has been closed.

leave
KErrUnknown if the specified column is null; KErrNotFound if the specified column does not exist in the table.
capability
Dependent on table, see the guide page referenced below.

Parameters

const TDesC & aColumnA reference to a descriptor containing the name of the column in the current record whose (unsigned integer) value is to be read.
TUint32 & aValueA reference to an unsigned integer passed by the caller.

SetNullL(const TDesC &)

IMPORT_C voidSetNullL(const TDesC &aColumn)

Sets a specific column within the current record to NULL. For text type columns, this is the same as setting the column to an empty string. The column is identified by the name supplied in the descriptor aColumn.

An earlier call to either UpdateRecord() or InsertRecord() must have been made before calling this function otherwise the function raises a CommsDbServer 12 panic. This panic is also raised if this function is called after the view has been closed.

PutRecordChanges() must be called to store the changes.

Parameters

const TDesC & aColumnA reference to a descriptor containing the name of a column in the current record.

TableWithTemplateRecord()

TBool TableWithTemplateRecord()const [private]

Is the table one with template record - all except global settings, IAPs and Proxies.

UpdateRecord()

IMPORT_C TIntUpdateRecord()

Modify the current record of this view. `PutRecordChanges()` is called to complete the transaction

Prepares to update the current record PutRecordChanges() must be called before editing any existing column.

Once all changes to the new record are complete, a call must be made to either PutRecordChanges() or CancelRecordChanges() as appropriate.

This function raises a CommsDbServer 2 panic if a previous call to InsertRecord() or UpdateRecord() has already been made.

This function must be called before any attempt is made before editing any existing column otherwise subsequent write operations raise a CommsDbServer 12 panic.

Once this function has completed successfully, no attempt can be made to read from a column until either PutRecordChanges() or CancelRecordChanges() has been called to complete the record insertion operation, otherwise the read operations raise a CommsDbServer 10 panic.

WriteBoolL(const TDesC &, const TBool &)

IMPORT_C voidWriteBoolL(const TDesC &aColumn,
const TBool &aValue
)

Writes a Boolean value to a specific column within the current record. The column is identified by the name supplied in the descriptor aColumn.

An earlier call to either UpdateRecord() or InsertRecord() must have been made before calling this function otherwise the function raises a CommsDbServer 12 panic. If the column identified is the COMMDB_ID field, than this function raises a CommsDbServer 13 panic. This panic is also raised if this function is called after the view has been closed.

PutRecordChanges() must be called to store the changes.

leave
KErrNotFound The column name does not exist.
capability
Dependent on table, see the guide page referenced below.

Parameters

const TDesC & aColumnA reference to a descriptor containing the name of a column in the current record.
const TBool & aValueA reference to TBool containing the value to be written into the column.

WriteLongTextL(const TDesC &, const TDesC &)

IMPORT_C voidWriteLongTextL(const TDesC &aColumn,
const TDesC &aValue
)

Writes the long text from a descriptor to a specific column within the current record. The column is identified by the name supplied in the descriptor aColumn.

An earlier call to either UpdateRecord() or InsertRecord() must have been made before calling this function otherwise the function raises a CommsDbServer 12 panic. If the column identified is the COMMDB_ID field, than this function raises a CommsDbServer 13 panic. This panic is also raised if this function is called after the view has been closed.

PutRecordChanges() must be called to store the changes.

While the text written by WriteTextL() functions is limited in length, there is no restriction on the length of long text.

leave
KErrNotFound The column name does not exist.
capability
Dependent on table, see the guide page referenced below.

Parameters

const TDesC & aColumnA reference to a descriptor containing the name of a column in the current record.
const TDesC & aValueA reference to a descriptor containing the long text to be written into the column.

WriteTextL(const TDesC &, const TDesC8 &)

IMPORT_C voidWriteTextL(const TDesC &aColumn,
const TDesC8 &aValue
)

Writes the narrow (ASCII) text from an 8 bit descriptor to a specific column within the current record. The column is identified by the name supplied in the descriptor aColumn. The length of the text cannot be greater than the value of the constant KCommsDbSvrMaxColumnNameLength, otherwise the function leaves.

An earlier call to either UpdateRecord() or InsertRecord() must have been made before calling this function otherwise the function raises a CommsDbServer 12 panic. If the column identified is the COMMDB_ID field, than this function raises a CommsDbServer 13 panic.

PutRecordChanges() must be called to store the changes.

Note:

If the column to be read is encrypted then the function decrypts it.

leave
KErrOverflow The function can leave for reasons defined by DBMS but it also leaves with KErrOverflow if the length of the text is greater than the maximum permitted.
leave
KErrNotFound The column name does not exist.
capability
Dependent on table, see the guide page referenced below.

Parameters

const TDesC & aColumnA reference to a descriptor containing the name of a column in the current record.
const TDesC8 & aValueA reference to an 8 bit descriptor containing the narrow text to be written into the column.

WriteTextL(const TDesC &, const TDesC16 &)

IMPORT_C voidWriteTextL(const TDesC &aColumn,
const TDesC16 &aValue
)

Writes the wide (UNICODE) text from a 16 bit descriptor to a specific column within the current record. The column is identified by the name supplied in the descriptor aColumn. The length of the text cannot be greater than the value of the constant KCommsDbSvrMaxColumnNameLength, otherwise the function leaves.

An earlier call to either UpdateRecord() or InsertRecord() must have been made before calling this function otherwise the function raises a CommsDbServer 12 panic. If the column identified is the COMMDB_ID field, than this function raises a CommsDbServer 13 panic. This panic is also raised if this function is called after the view has been closed.

PutRecordChanges() must be called to store the changes.

Note:

If the column to be read is encrypted then the function decrypts it.

leave
The function can leave for reasons defined by DBMS but also leaves with KErrOverflow if the length of the text is greater than the maximum permitted or KErrNotFound if the column name does not exist.
capability
Dependent on table, see the guide page referenced below.

Parameters

const TDesC & aColumnA reference to a descriptor containing the name of a column in the current record.
const TDesC16 & aValueA reference to a 16 bit descriptor containing the wide text to be written into the column.

WriteUintL(const TDesC &, const TUint32 &)

IMPORT_C voidWriteUintL(const TDesC &aColumn,
const TUint32 &aValue
)

Writes an unsigned integer value to a specific column within the current record. The column is identified by the name supplied in the descriptor aColumn.

An earlier call to either UpdateRecord() or InsertRecord() must have been made before calling this function otherwise the function raises a CommsDbServer 12 panic. If the column identified is the COMMDB_ID field, than this function raises a CommsDbServer 13 panic. This panic is also raised if this function is called after the view has been closed.

PutRecordChanges() must be called to store the changes.

leave
KErrNotFound The column name does not exist.
capability
Dependent on table, see the guide page referenced below.

Parameters

const TDesC & aColumnA reference to a descriptor containing the name of a column in the current record.
const TUint32 & aValueA reference to an unsigned integer containing the value to be written into the column.

Member Enumerations Documentation

Enum TTableState

Enumerators

EClosed
EOpenIdle
EInsert
EUpdate

Member Data Documentation

TUint32 iCurrentId

TUint32 iCurrentId[private]

CCommsDatabaseBase & iDb

CCommsDatabaseBase &iDb[protected]

TUint32 iInsertedRecordIndex

TUint32 iInsertedRecordIndex[private]

TTableState iState

TTableState iState[private]

CCommDbTableExtension * iTableExt

CCommDbTableExtension *iTableExt[protected]

TBuf< KCommsDbSvrMaxColumnNameLength > iTableName

TBuf< KCommsDbSvrMaxColumnNameLength >iTableName[protected]

RDbView iTableView

RDbView iTableView[protected]

CCommsDbTemplateRecord * iTemplate

CCommsDbTemplateRecord *iTemplate[private]

TBool iTsyNameChanged

TBool iTsyNameChanged[private]