class CSqlDatabaseImpl : public CBase |
CSqlDatabaseImpl implements RSqlDatabase .
establishing a connection with the database;
attaching/detaching a database to/from the existing connection;
executing SQL statements or a set of SQL statements, separated with ";";
deleting databases;
retrieving last error messages;
setting the isolation level;
returning the database security policy;
Public Member Functions | |
---|---|
~CSqlDatabaseImpl () | |
TInt | Attach (const TDesC &, const TDesC &) |
CSqlSecurityPolicy * | CloneSecurityPolicyL () |
TInt | Compact ( TInt , const TDesC &) |
void | Compact ( TInt , const TDesC &, TRequestStatus &) |
TInt | Copy (const TDesC &, const TDesC &) |
TInt | Delete (const TDesC &) |
TInt | Detach (const TDesC &) |
TInt | Exec (const TDesC16 &) |
TInt | Exec (const TDesC8 &) |
void | Exec (const TDesC16 &, TRequestStatus &) |
void | Exec (const TDesC8 &, TRequestStatus &) |
TInt | ExecScalarFullSelectL (const TDesC16 &, TSqlColumnType , TDes8 &) |
TInt | ExecScalarFullSelectL (const TDesC8 &, TSqlColumnType , TDes8 &) |
TBool | InTransaction () |
TPtrC | LastErrorMessage () |
TInt64 | LastInsertedRowId () |
CSqlDatabaseImpl * | NewL ( TSqlSrvFunction , const TDesC &, const CSqlSecurityPolicy *, const TDesC8 *) |
RSqlDbSession & | Session () |
TInt | SetIsolationLevel ( RSqlDatabase::TIsolationLevel ) |
TInt | Size () |
TInt | Size ( RSqlDatabase::TSize &, const TDesC &) |
Private Member Functions | |
---|---|
CSqlDatabaseImpl () | |
void | ConstructL ( TSqlSrvFunction , const TDesC &, const CSqlSecurityPolicy *, const TDesC8 *) |
Private Attributes | |
---|---|
RSqlDbSession | iDbSession |
~CSqlDatabaseImpl | ( | ) | [virtual] |
Frees the allocated by CSqlDatabaseImpl instance memory and other resources.
TInt | Attach | ( | const TDesC & | aDbFileName, |
const TDesC & | aDbName | |||
) | [inline] |
Attaches a secure or non-secure database.
Implements RSqlDatabase::Attach() .
const TDesC & aDbFileName | The name of the file that hosts the database. If this is a secure database, then the format of the name must be: <drive>:<[SID]database file name excluding the path>. If this is a private or shared non-secure database, then aDbFileName has to be the full database file name. "[SID]" refers to SID of the application which created the attached database. |
const TDesC & aDbName | Logical database name. It must be unique (per database connection). This is the name which can be used for accessing tables in the attached database. The syntax is "database-name.table-name". |
CSqlSecurityPolicy * | CloneSecurityPolicyL | ( | ) |
Creates and returns a copy of the database security policies object. The caller is responsible for destroying the returned CSqlSecurityPolicy instance.
Implements RSqlDatabase::GetSecurityPolicyL() .
TInt | Compact | ( | TInt | aSize, |
const TDesC & | aDbName | |||
) |
Implements RSqlDatabase::Compact() .
Usage of the IPC call arguments: Arg 0: [out] How much space in bytes should be compacted, all free pages should be removed if the parameter value is RSqlDatabase::EMaxCompaction . Arg 1: [out] The database name length in characters Arg 2: [out] The attached database name or KNullDesC for the main database
TInt aSize | Can be one of: RSqlDatabase::EMaxCompaction - requests a full database compaction. All free pages (if any exists) will be removed; Positive integer value - the server will attempt to compact the database removing at most aSize bytes from the database file, rounded up to the nearest page count, e.g. request for removing 1 byte will remove one free page from the database; |
const TDesC & aDbName | The attached database name or KNullDesC for the main database |
void | Compact | ( | TInt | aSize, |
const TDesC & | aDbName, | |||
TRequestStatus & | aStatus | |||
) |
Usage of the IPC call arguments: Arg 0: [out] How much space in bytes should be compacted, all free pages should be removed if the parameter value is RSqlDatabase::EMaxCompaction . Arg 1: [out] The database name length in characters Arg 2: [out] The attached database name or KNullDesC for the main database
TInt aSize | |
const TDesC & aDbName | |
TRequestStatus & aStatus |
void | ConstructL | ( | TSqlSrvFunction | aFunction, |
const TDesC & | aDbFileName, | |||
const CSqlSecurityPolicy * | aSecurityPolicy = NULL, | |||
const TDesC8 * | aConfig = NULL | |||
) | [private] |
Initializes the created CSqlDatabaseImpl instance.
TSqlSrvFunction aFunction | It may have one of the following values: ESqlSrvDbCreate - Create a shared non-secure or private secure database; ESqlSrvDbCreateSecure - Create a shared secure database; ESqlSrvDbOpen - Open a shared non-secure, shared secure or private secure database; |
const TDesC & aDbFileName | The name of the file that is to host the database. If it is a secure database, then the format of the name is <drive>:<[SID]database file name excluding the path>. "[SID]" refers to the application SID. If it is a non-secure database then aDbFileName should contain the full path name of the file that is to host the database. |
const CSqlSecurityPolicy * aSecurityPolicy = NULL | The container for the security policies. aSecurityPolicy is NULL if aDbFileName refers to a non-secure database. |
const TDesC8 * aConfig = NULL | the configuration string "PARAM=VALUE;...." |
TInt | Copy | ( | const TDesC & | aSrcDbFileName, |
const TDesC & | aDestDbFileName | |||
) | [static, inline] |
Copies a database file to the specified location.
Implements RSqlDatabase::Copy() .
secure to secure database. Only the application created the database is allowed to copy it.
non-secure to non-secure database. No restrictions apply to this operation.
const TDesC & aSrcDbFileName | Source database file name. If this is a secure database, then the format of the name must be: <drive>:<[SID]database file name excluding the path>. If this is a non-secure database, then aDbFileName has to be the full database file name. "[SID]" refers to SID of the application which created the database. |
const TDesC & aDestDbFileName | Destination database file name. If this is a secure database, then the format of the name must be: <drive>:<[SID]database file name excluding the path>. If this is a non-secure database, then aDbFileName has to be the full database file name. "[SID]" refers to SID of the application which performs the copying operation. |
TInt | Delete | ( | const TDesC & | aDbFileName | ) | [static, inline] |
Deletes the specified database file.
Implements RSqlDatabase::Delete() .
const TDesC & aDbFileName | The name of the database file. If this is a secure database, then the format of the name must be: <drive>:<[SID]database file name excluding the path>. If this is a private or shared non-secure database, then aDbFileName has to be the full database file name. "[SID]" refers to SID of the application which created the database. |
TInt | Detach | ( | const TDesC & | aDbName | ) | [inline] |
Detaches previously attached database.
Implements RSqlDatabase::Detach() .
const TDesC & aDbName | Logical database name. The logical name of the database to be detached. |
TInt | Exec | ( | const TDesC16 & | aSqlStmt | ) | [inline] |
Executes one or more 16-bit DDL/DML SQL statements.
Implements RSqlDatabase::Exec() .
const TDesC16 & aSqlStmt | A string of 16-bit wide characters containing one or more DDL/DML SQL statements; each statement is separated by a ';' character. |
TInt | Exec | ( | const TDesC8 & | aSqlStmt | ) | [inline] |
Executes one or more 8-bit DDL/DML SQL statements.
Implements RSqlDatabase::Exec() .
const TDesC8 & aSqlStmt | A string of 8-bit wide characters containing one or more DDL/DML SQL statements; each statement is separated by a ';' character. |
void | Exec | ( | const TDesC16 & | aSqlStmt, |
TRequestStatus & | aStatus | |||
) | [inline] |
Executes one or more 16-bit DDL/DML SQL statements asynchronously.
Implements RSqlDatabase::Exec() .
const TDesC16 & aSqlStmt | A string of 16-bit wide characters containing one or more DDL/DML SQL statements; each statement is separated by a ';' character. |
TRequestStatus & aStatus | Completion status of asynchronous request, one of the following: - >=0, The operation has completed successfully. The number of database rows that were changed/inserted/deleted by the most recently completed DDL/DML sql statement. Exception: If the executed statement is "DELETE FROM <table>", then the function returns 0 if the operation has completed successfully (disregarding the number of the deleted rows); - KErrNoMemory, an out of memory condition has occured; - KSqlErrGeneral, a syntax error has occurred - text describing the problem can be obtained by calling RSqlDatabase::LastErrorMessage(); - KErrPermissionDenied, the caller does not satisfy the relevant database security policies; Note that aStatus may be set with database specific errors categorised as ESqlDbError, and other system-wide error codes. |
void | Exec | ( | const TDesC8 & | aSqlStmt, |
TRequestStatus & | aStatus | |||
) | [inline] |
Executes one or more 8-bit DDL/DML SQL statements asynchronously.
Implements RSqlDatabase::Exec() .
const TDesC8 & aSqlStmt | A string of 8-bit wide characters containing one or more DDL/DML SQL statements; each statement is separated by a ';' character. |
TRequestStatus & aStatus | Completion status of asynchronous request, one of the following: - >=0, The operation has completed successfully. The number of database rows that were changed/inserted/deleted by the most recently completed DDL/DML sql statement. Exception: If the executed statement is "DELETE FROM <table>", then the function returns 0 if the operation has completed successfully (disregarding the number of the deleted rows); - KErrNoMemory, an out of memory condition has occured; - KSqlErrGeneral, a syntax error has occurred - text describing the problem can be obtained by calling RSqlDatabase::LastErrorMessage(); - KErrPermissionDenied, the caller does not satisfy the relevant database security policies; Note that aStatus may be set with database specific errors categorised as ESqlDbError, and other system-wide error codes. |
TInt | ExecScalarFullSelectL | ( | const TDesC16 & | aSqlStmt, |
TSqlColumnType | aType, | |||
TDes8 & | aRes | |||
) | [inline] |
Sends a command to the server to Execute a SELECT query which is expected to return a single row consisting of a single column value and copies that value to the place refered by aRes parameter.
TInt | ExecScalarFullSelectL | ( | const TDesC8 & | aSqlStmt, |
TSqlColumnType | aType, | |||
TDes8 & | aRes | |||
) | [inline] |
Sends a command to the server to Execute a SELECT query which is expected to return a single row consisting of a single column value and copies that value to the place refered by aRes parameter.
TPtrC | LastErrorMessage | ( | ) | [inline] |
Retrieves a reference to the textual description of the error returned by the most recent call.
Implements RSqlDatabase::LastErrorMessage() .
TInt64 | LastInsertedRowId | ( | ) | [inline] |
Returns the ROWID of the most recent successful INSERT into the database from this database connection.
Implements RSqlDatabase::LastInsertedRowId() .
CSqlDatabaseImpl * | NewL | ( | TSqlSrvFunction | aFunction, |
const TDesC & | aDbFileName, | |||
const CSqlSecurityPolicy * | aSecurityPolicy, | |||
const TDesC8 * | aConfig = NULL | |||
) | [static] |
Creates a new CSqlDatabaseImpl instance.
CSqlDatabaseImpl implements RSqlDatabase , which means that CSqlDatabaseImpl instance will be created from RSqlDatabase functions doing RSqlDatabase instance initialization - Create() and Open().
TSqlSrvFunction aFunction | It may have one of the following values: ESqlSrvDbCreate - Create a shared non-secure or private secure database; ESqlSrvDbCreateSecure - Create a shared secure database; ESqlSrvDbOpen - Open a shared non-secure, shared secure or private secure database; |
const TDesC & aDbFileName | The name of the file that is to host the database. If it is a secure database, then the format of the name is <drive>:<[SID]database file name excluding the path>. "[SID]" refers to the application SID. If it is a non-secure database then aDbFileName should contain the full path name of the file that is to host the database. |
const CSqlSecurityPolicy * aSecurityPolicy | The container for the security policies. aSecurityPolicy is NULL if aDbFileName refers to a non-secure database. |
const TDesC8 * aConfig = NULL | the configuration string "PARAM=VALUE;...." |
TInt | SetIsolationLevel | ( | RSqlDatabase::TIsolationLevel | aIsolationLevel | ) | [inline] |
Sets the transaction isolation level for the database.
Implements RSqlDatabase::SetIsolationLevel() .
RSqlDatabase::TIsolationLevel aIsolationLevel | The isolation level to be set. Allowed isolation level values are:RSqlDatabase::EReadUncommitted;RSqlDatabase::ESerializable; |
TInt | Size | ( | RSqlDatabase::TSize & | aSize, |
const TDesC & | aDbName | |||
) | [inline] |
Returns the database file size and free space, in bytes.
Usage of the IPC call arguments: Arg 0: [in/out] Points to a RSqldatabase::TSize object, where the database size and free space values will be copied. Arg 1: [out] The database name length in characters Arg 2: [out] The attached database name or KNullDesC for the main database
RSqlDatabase::TSize & aSize | An output parameter. If the call was successfull the aSize object will contain information about the database size and database free space. |
const TDesC & aDbName | The attached database name or KNullDesC for the main database |
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.