#include <d32dbms.h>
class RDbNamedDatabase : public RDbDatabase |
Public Member Enumerations | |
---|---|
enum | TAccess { EReadWrite, EReadOnly } |
Public Member Functions | |
---|---|
IMPORT_C TInt | Create(RDbs &, const TDesC &, const TDesC &) |
IMPORT_C TInt | Create(RFs &, const TDesC &, const TDesC &) |
IMPORT_C TInt | Open(RFs &, const TDesC &, const TDesC &, TAccess) |
IMPORT_C TInt | Open(RDbs &, const TDesC &, const TDesC &) |
IMPORT_C TInt | Replace(RFs &, const TDesC &, const TDesC &) |
Inherited Attributes | |
---|---|
RDbDatabase::iDatabase |
Generic database implementation
Creates a secure shared database. Max allowed database name length (with the extension) is KDbMaxName symbols.
In this "client-server" mode the database can be shared with the other clients.
For creating a non-secure database, see RDbNamedDatabase::Create(), which first argument is a RFs reference (or RDbNamedDatabase::Replace()).
See also: RDbNamedDatabase::Create(RFs& aFs, const TDesC& aSource, const TDesC& aFormat) RDbNamedDatabase::Replace(RFs& aFs, const TDesC& aSource, const TDesC& aFormat)
Parameter | Description |
---|---|
aDbs | A reference to DBMS session instance. |
aDatabase | Database name. The name format is: <drive>:<name>.<ext> |
aFormat | Database format string. The string format is: "SECURE[UID]", where UID is the database security policy UID. "SECURE" keyword is case insensitive. |
Returns: KErrNone if successful otherwise one of the system-wide error codes, including: KErrAlreadyExists - the database already exists; KErrNotSupported - invalid format string; KErrArgument - bad argument, including null/invaluid uids, the database name includes a path; KErrPermissionDenied - the caller has not enough rights to do the operation;
Creates a new non-secure database.
RFs fs; TInt err = fs.Connect(); <process the error> _LIT(KDatabaseName, _L("C:\\A.DB")); RDbNamedDatabase db; err = db.Create(fs, KDatabaseName); //Step 1 - create the database using the RFs object <process the error> db.Close(); //Step 2 - close the database RDbs dbs; err = dbs.Connect(); <process the error> err = db.Open(dbs, KDatabaseName); //Step 3 - reopen the database using the RDbs object <process the error> ...
Max allowed database name length (with the extension) is KDbMaxName symbols.
For creating a new secure shared database, see RDbNamedDatabase::Create(), which first argument is a RDbs reference.
See also: RDbNamedDatabase::Create(RDbs& aDbs, const TDesC& aDatabase, const TDesC& aFormat)
Parameter | Description |
---|---|
aFs | Handle to a file server session. |
aDatabase | Database file name. |
aFormat | Database format string. It can be omitted in which case the default parameter value (TPtrC()) will be used. |
Returns: KErrNone if successful otherwise one of the system-wide error codes, including: KErrAlreadyExists - the database already exists; KErrArgument - bad argument, including null/invaluid uids, the database name includes a null;
IMPORT_C TInt | Open | ( | RFs & | aFs, |
const TDesC & | aDatabase, | |||
const TDesC & | aFormat = TPtrC(), | |||
TAccess | aMode = EReadWrite | |||
) |
Opens an existing non-secure database.
In this "single client" mode, the database cannot be shared with the other clients. The database server is not involved in the operations with the database, the client side database library (edbms.dll) will be used.
For opening a new secure shared database, see RDbNamedDatabase::Open(), which first argument is a RDbs reference.
See also: RDbNamedDatabase::Open(RDbs& aDbs, const TDesC& aDatabase, const TDesC& aFormat)
Parameter | Description |
---|---|
aFs | Handle to a file server session. |
aDatabase | Database name. The name format is: <drive>:<path><name>.<ext> |
aFormat | Database format string. It can be omitted in which case the default parameter value (TPtrC()) will be used. |
aMode | The mode in which the database is to be accessed. The mode is defined by the TAccess type. |
Returns: KErrNone if successful otherwise one of the system-wide error codes, including: KErrNotFound - the database is not found; KErrPathNotFound - the path of database is not found KErrNotSupported - the format is not supported. KErrArgument - bad argument,including null/invaluid uids,the database name is null; KErrPermissionDenied - the caller has not enough rights to do the operation;
Opens an existing shared secure or non-secure database. Max allowed database name length (with the extension) is KDbMaxName symbols.
In this "client-server" mode the database can be shared with the other clients.
For opening a single, non-shareable connection to the database, see RDbNamedDatabase::Open(), which first argument is a RFs reference.
See also: RDbNamedDatabase::Open(RFs& aFs, const TDesC& aSource, const TDesC& aFormat, TAccess aMode).
Parameter | Description |
---|---|
aDbs | A reference to DBMS session instance. |
aDatabase | The name of the file that hosts the database. If this is a secure database, then the format of the name must be: <drive>:<database file name excluding the path>. If this is a non-secure database, then aDatabase has to be the full database file name. |
aFormat | Database format string. For shared secure databases the string format is: "SECURE[UID]", where UID is the database security policy UID. "SECURE" keyword is case insensitive. For shared non-secure databases, the default parameter value (TPtrC()) can be used. |
Returns: KErrNone if successful otherwise one of the system-wide error codes, including: KErrNotFound - the database is not found; KErrArgument - bad argument, including null/invaluid uids, the database name includes a path; KErrPermissionDenied - the caller has not enough rights to do the operation;
Creates a new non-secure database. If a database with the same file name exists, it will be replased.
RFs fs; TInt err = fs.Connect(); <process the error> _LIT(KDatabaseName, _L("C:\\A.DB")); RDbNamedDatabase db; err = db.Replace(fs, KDatabaseName); //Step 1 - create the database using the RFs object <process the error> db.Close(); //Step 2 - close the database RDbs dbs; err = dbs.Connect(); <process the error> err = db.Open(dbs, KDatabaseName); //Step 3 - reopen the database using the RDbs object <process the error> ...
Max allowed database name length (with the extension) is KDbMaxName symbols.
For creating a new secure shared database, see RDbNamedDatabase::Create(), which first argument is a RDbs reference.
See also: RDbNamedDatabase::Create(RDbs& aDbs, const TDesC& aDatabase, const TDesC& aFormat)
Parameter | Description |
---|---|
aFs | Handle to a file server session. |
aDatabase | Database name. The name format is: <drive>:<path><name>.<ext> |
aFormat | Database format string. It can be omitted in which case the default parameter value (TPtrC()) will be used. |
Returns: KErrNone if successful otherwise one of the system-wide error codes, including: KErrArgument - bad argument, including null/invaluid uids, the database name includes a null;