RDbNamedDatabase Class Reference

class RDbNamedDatabase : public RDbDatabase

Generic database implementation

Inherits from

  • RDbNamedDatabase
Public Member Functions
IMPORT_C TInt Create ( RDbs &, 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 Functions
RDbDatabase::AlterTable(const TDesC &,const CDbColSet &)
RDbDatabase::Begin()
RDbDatabase::Close()
RDbDatabase::ColSetL(const TDesC &)const
RDbDatabase::Commit()
RDbDatabase::Compact()
RDbDatabase::CreateIndex(const TDesC &,const TDesC &,const CDbKey &)
RDbDatabase::CreateTable(const TDesC &,const CDbColSet &)
RDbDatabase::CreateTable(const TDesC &,const CDbColSet &,const CDbKey &)
RDbDatabase::Destroy()
RDbDatabase::DropIndex(const TDesC &,const TDesC &)
RDbDatabase::DropTable(const TDesC &)
RDbDatabase::Execute(const TDesC &,TDbTextComparison)
RDbDatabase::InTransaction()const
RDbDatabase::IndexNamesL(const TDesC &)const
RDbDatabase::IsDamaged()const
RDbDatabase::KeyL(const TDesC &,const TDesC &)const
RDbDatabase::Recover()
RDbDatabase::Rollback()
RDbDatabase::Size()const
RDbDatabase::TableNamesL()const
RDbDatabase::UpdateStats()
Public Member Enumerations
enum TAccess { EReadWrite , EReadOnly }
Inherited Attributes
RDbDatabase::iDatabase

Member Functions Documentation

Create(RDbs &, const TDesC &, const TDesC &)

IMPORT_C TInt Create ( RDbs & aDbs,
const TDesC & aDatabase,
const TDesC & aFormat
)

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() ).

capability
Note For a secure shared database, the caller must satisfy the schema access policy for the database.
RDbNamedDatabase::Create(RFs& aFs, const TDesC& aSource, const TDesC& aFormat) RDbNamedDatabase::Replace(RFs& aFs, const TDesC& aSource, const TDesC& aFormat)

Parameters

RDbs & aDbs A reference to DBMS session instance.
const TDesC & aDatabase Database name. The name format is: <drive>:<name>.<ext>
const TDesC & aFormat Database format string. The string format is: "SECURE[UID]", where UID is the database security policy UID. "SECURE" keyword is case insensitive.

Open(RFs &, const TDesC &, const TDesC &, TAccess)

IMPORT_C TInt Open ( RFs & aFs,
const TDesC & aDatabase,
const TDesC & aFormat =  TPtrC (),
TAccess aMode = EReadWrite
)

Parameters

RFs & aFs
const TDesC & aDatabase
const TDesC & aFormat =  TPtrC ()
TAccess aMode = EReadWrite

Open(RDbs &, const TDesC &, const TDesC &)

IMPORT_C TInt Open ( RDbs & aDbs,
const TDesC & aDatabase,
const TDesC & aFormat =  TPtrC ()
)

Parameters

RDbs & aDbs
const TDesC & aDatabase
const TDesC & aFormat =  TPtrC ()

Replace(RFs &, const TDesC &, const TDesC &)

IMPORT_C TInt Replace ( RFs & aFs,
const TDesC & aDatabase,
const TDesC & aFormat =  TPtrC ()
)

Creates a new non-secure database. If a database with the same file name exists, it will be replased.

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. If the database has to be shared, the following example shows how this may be accomplished:
         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.

RDbNamedDatabase::Create(RDbs& aDbs, const TDesC& aDatabase, const TDesC& aFormat)

Parameters

RFs & aFs Handle to a file server session.
const TDesC & aDatabase Database name. The name format is: <drive>:<path><name>.<ext>
const TDesC & aFormat =  TPtrC () Database format string. It can be omitted in which case the default parameter value (TPtrC()) will be used.

Member Enumerations Documentation

Enum TAccess

Specifies which operations can be performed on a rowset.

Enumerators

EReadWrite
EReadOnly

Row navigation and reading are permitted.