|
|
|
Location:
commdb.h
Link against: commdb.lib
class CCommsDbTableView : public CBase;
Supported from 5.0
The view on a specific table.
It includes the necessary behaviour for navigating through the records in the view as well containing member functions for reading and writing to columns within a record.
Implements actions on tables and records in the database. Uses a
CCommsDatabase and has an RDbView to read from and write to database.
Created via the CCommsDatabase::OpenTableLC() (to open a view of
all the records in the table) or one of the OpenViewLC...() functions
(to open a specific view of the table).
|
Defined in CCommsDbTableView:
CCommsDbTableView(), CancelRecordChanges(), CancelRecordChanges(), DeleteRecord(), GetTableName(), GotoFirstRecord(), GotoNextRecord(), GotoPreviousRecord(), InsertRecord(), NewL(), PutRecordChanges(), PutRecordChanges(), ReadBoolL(), ReadColumnLengthL(), ReadLongTextLC(), ReadTextL(), ReadTextL(), ReadTypeAttribL(), ReadUintL(), SetNullL(), UpdateRecord(), WriteBoolL(), WriteLongTextL(), WriteTextL(), WriteTextL(), WriteUintL(), ~CCommsDbTableView()
Inherited from CBase:
operator new()
static CCommsDbTableView* NewL(CCommsDatabaseBase& aDb, const TDesC& aTableName, const TDbQuery& aQuery, TBool aUseTemplate=ETrue);
Low level view creation. Use if CCommsDatabase::OpenTableLC() or CCommsDatabase::OpenViewLC...() are not sufficient.
|
|
CCommsDbTableView(CCommsDatabaseBase& aDb, const TDesC& aTableName);
Constructor.
|
~CCommsDbTableView();
Frees all resources owned by this object, prior to its destruction. Specifically, it closes the view.
TInt GotoFirstRecord();
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.
|
TInt GotoNextRecord();
Sets the next record in the view as the current record; i.e. set the view's cursor to point to the next record.
|
TInt GotoPreviousRecord();
Sets the previous record in the view as the current record; i.e. set the view's cursor to point to the previous record.
|
TInt InsertRecord(TUint32& aId);
Prepares database to insert a new record — must
be called to ad 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.
The function puts the unique Id associated with this new record
in aId.
|
|
|
InsertRecord() or TInt UpdateRecord();
Prepares to update the current record — 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.
|
UpdateRecord() has already
been made.TInt DeleteRecord();
Deletes the record at the current cursor position.
|
TInt PutRecordChanges(TBool aHidden=EFalse, TBool aReadOnly =EFalse);
Supported from 6.0
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.
|
|
TInt PutRecordChanges(TBool aHidden=EFalse);
Withdrawn in 6.0
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.
|
|
InsertRecord() or
UpdateRecord() must have previously been made otherwise the
function raises a CommsDbServer 4 panic.void CancelRecordChanges();
Supported from 6.0
Abandons changes made to a record which were started by calls
to either:InsertRecord() or UpdateRecord().
InsertRecord() or
UpdateRecord() must have previously been made otherwise the
function raises a CommsDbServer 5 panic.TInt CancelRecordChanges();
Withdrawn in 6.0
Abandons changes made to a record which were started by calls
to either: InsertRecord() or UpdateRecord().
|
InsertRecord() or
UpdateRecord() must have previously been made otherwise the
function raises a CommsDbServer 5 panic.void ReadTypeAttrib(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.
|
|
void ReadUintL(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.
|
|
void ReadBoolL(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.
|
|
void ReadTextL(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.
|
|
void ReadTextL(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.
|
|
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().
|
|
|
void ReadColumnLengthL(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.
|
|
void WriteUintL(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.
|
|
void WriteBoolL(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.
|
|
void WriteTextL(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.
|
|
void WriteTextL(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.
|
|
void WriteLongTextL(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.
While the text written by WriteTextL() functions
is limited in length, there is no restriction on the length of long text.
|
|
void SetNullL(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.
|
void GetTableName(TDes& aTableName) const;
Gets the name of the table associated with this view and copies it into the descriptor supplied by the caller.
|