»
Symbian OS v6.1 Edition for C++ »
API Reference »
DBMS Databases Interface »
RDbStoreDatabase
Location:
d32dbms.h
Link against: edbms.lib
RDbStoreDatabase
Support
Supported from 5.0
Description
Provides the implementation for the DBMS API, creating and using a
stream network within a store to represent the database.
No special considerations need be made when deriving from this
class.
Derivation
RDbDatabase | Abstract class providing the functionality of a database |
RDbStoreDatabase | Provides the implementation for the DBMS API, creating and using a stream network within a store to represent the database |
|
Defined in RDbStoreDatabase
:
CompressL()
, CreateL()
, DecompressL()
, OpenL()
Inherited from RDbDatabase
:
AlterTable()
,
Begin()
,
ChangeSecurity()
,
Close()
,
ColSetL()
,
Commit()
,
Compact()
,
CreateIndex()
,
CreateTable()
,
Destroy()
,
DropIndex()
,
DropTable()
,
Execute()
,
InTransaction()
,
IndexNamesL()
,
IsDamaged()
,
KeyL()
,
Recover()
,
Rollback()
,
Size()
,
TSize
,
TableNamesL()
,
UpdateStats()
Creating a new database
TStreamId CreateL(CStreamStore* aStore);
Description
Creates a new database in a store, and opens the database
object.
The user program should save the returned stream id elsewhere
in the store (for example as the root) to enable the database to be opened
again, and should then commit the store — the store will not have
been committed at the completion of this function. This ensures that the
database streams are not orphaned in the store should the user program fail to
save the stream id.
Parameters
CStreamStore* aStore |
The store in which to create the database stream network. The
database retains a reference to the store object, which should be maintained by
the caller until the database is closed. |
|
Return value
TStreamId |
The stream id of the head of the database stream
network. |
|
Leave codes
|
This function leaves if it cannot construct its initial
stream structure in the store. It then returns one of the system-wide error
codes. |
|
TStreamId CreateL(CStreamStore* aStore,CSecurityEncryptBase* aKey);
Description
Creates a new secure database in a store, and opens the database
object.
The user program should save the returned stream id elsewhere in
the store (for example as the root) to enable the database to be opened again,
and should then commit the store — the store will not have been committed
at the completion of this function.
This ensures that the database streams are not orphaned in the
store should the user program fail to save the stream id.
Parameters
CStreamStore* aStore |
The store in which to create the database stream network. The
database retains a reference to the store object, which should be maintained by
the caller until the database is closed. |
CSecurityEncryptBase* aKey |
A pointer to an encryption key (as returned , for example, from a
call to CSecurityBase::NewEncryptL() ); this is used to create
authentication data in the database. This key object is destroyed before the
function returns or leaves. |
|
Return value
TStreamId |
The stream id of the head of the database stream network. |
|
void OpenL(CStreamStore* aStore,TStreamId anId);
Description
Opens a previously created Store database.
Parameters
CStreamStore* aStore |
The store which contains the database stream network. The database
retains a reference to the store object, which should be maintained by the
caller until the database is closed. |
TStreamId anId |
The stream id of the head of the database. This should have been
previously returned by a call to CreateL() . |
|
Leave codes
|
This function can leave with KErrArgument if the
stream id passed to the database does not identify a database stream. It may
also return one of the system-wide error codes. |
|
void OpenL(CStreamStore* aStore,TStreamId anId,CSecurityDecryptBase* aKey);
Description
Opens a previously created secure Store database.
The supplied decryption key is authenticated before the database is
opened.
Parameters
CStreamStore* aStore |
The store which contains the database stream network. The database
retains a reference to the store object, which should be maintained by the
caller until the database is closed. |
TStreamId anId |
The stream id of the head of the database. This should have been
previously returned by a call to CreateL() . |
CSecurityDecryptBase* aKey |
A pointer to a decryption key which should match the database
encryption key. The encryption key is either the key used to create the
database or the key used in the last security change. This key object is
destroyed before the function returns or leaves. |
|
Leave codes
|
This function can leave with KErrArgument , if the
stream id passed to the database does not identify a database stream or the
database is not encrypted. The function can leave with KErrGeneral
, if the key fails to access the database. The function can leave with
KErrNotSupported, if the database is encrypted using an unknown algorithm. The
function can also leave with one of the other system-wide error codes. |
|
Compressing/decompressing a database
static void CompressL(CStreamStore& aStore,TStreamId aId);
Description
Converts a Store database from the standard form to the compressed
form.
The function operates synchronously and can take an extended time to
complete.
On return from this function, the database is not open; after
successful compression, the store file needs to be compacted and
committed.
After compression, the database is read-only.
Parameters
CStreamStore& aStore |
The store containing the database stream network. |
TStreamId aId |
The stream id of the head of the database |
|
Leave codes
|
If the compression fails, the database remains in the same state as
it was before attempting the operation. |
|
static void DecompressL(CStreamStore& aStore,TStreamId aId);
Description
Converts a Store database from the compressed form to the standard
form.
The function operates synchronously and can take an extended time to
complete.
On return from this function, the database is not open; after successful
decompression, the store file needs to be compacted and
committed.
Parameters
CStreamStore& aStore |
The store containing the database stream network. |
TStreamId aId |
The stream id of the head of the database |
|
Leave codes
|
If the decompression fails, the database remains in the same state as
it was before attempting the operation. |
|