sl@0: // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0: // All rights reserved.
sl@0: // This component and the accompanying materials are made available
sl@0: // under the terms of "Eclipse Public License v1.0"
sl@0: // which accompanies this distribution, and is available
sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0: //
sl@0: // Initial Contributors:
sl@0: // Nokia Corporation - initial contribution.
sl@0: //
sl@0: // Contributors:
sl@0: //
sl@0: // Description:
sl@0: //
sl@0: 
sl@0: #include "UD_STD.H"
sl@0: 
sl@0: // Class RDbDatabase
sl@0: 
sl@0: /**
sl@0: Closes a database. Commits any pending transaction. Frees the allocated resources.
sl@0: */
sl@0: EXPORT_C void RDbDatabase::Close()
sl@0: 	{
sl@0: 	CDbDatabase* db=iDatabase();
sl@0: 	if (db && InTransaction())
sl@0: 		Commit();	// attempt to commit
sl@0: 	iDatabase.Close();
sl@0: 	}
sl@0: 
sl@0: //
sl@0: // Runs the incremental DDL object to completion.
sl@0: //
sl@0: LOCAL_C void CompleteDDLL(CDbIncremental* aIncremental,TInt& aStep)
sl@0: 	{
sl@0: 	__ASSERT((aIncremental==0)==(aStep==0));
sl@0: 	if (!aIncremental)
sl@0: 		return;
sl@0: 	aIncremental->PushL();
sl@0: 	do aIncremental->NextL(aStep);
sl@0: 		while (aStep!=0);
sl@0: 	CleanupStack::PopAndDestroy();	// aIncrmental
sl@0: 	}
sl@0: 
sl@0: //
sl@0: // Runs the DML incremental object to completion.
sl@0: //
sl@0: LOCAL_C void CompleteDMLL(CDbIncremental* aIncremental,TInt& aRows)
sl@0: 	{
sl@0: 	__ASSERT((aIncremental==0)!=(aRows==0));
sl@0: 	if (!aIncremental)
sl@0: 		return;
sl@0: 	aIncremental->PushL();
sl@0: 	while (aIncremental->NextL(aRows))
sl@0: 		;
sl@0: 	CleanupStack::PopAndDestroy();	// aIncremental
sl@0: 	}
sl@0: 
sl@0: LOCAL_C TInt Property(const RDbHandle<CDbDatabase>& aDb,CDbDatabase::TProperty aProperty)
sl@0: 	{
sl@0: 	return aDb->Property(aProperty);
sl@0: 	}
sl@0: 
sl@0: LOCAL_C TInt Utility(RDbHandle<CDbDatabase>& aDb,CDbDatabase::TUtility aType)
sl@0: 	{
sl@0: 	TInt step;
sl@0: 	TRAPD(r,CompleteDDLL(aDb->UtilityL(aType,step),step));
sl@0: 	return r;
sl@0: 	}
sl@0: 
sl@0: /**
sl@0: Reports the damage status of the database.
sl@0: The function checks database indexes and returs true if some of them are broken.
sl@0: 
sl@0: @return True if the database is damaged, false otherwise.
sl@0: */
sl@0: EXPORT_C TBool RDbDatabase::IsDamaged() const
sl@0: 	{
sl@0: 	return Property(iDatabase,CDbDatabase::EIsDamaged);
sl@0: 	}
sl@0: 
sl@0: /**
sl@0: Synchronous database recovery.
sl@0: Recover() will try to rebuild database indexes if they are broken.
sl@0: If the database data is corrupted, it cannot be recovered.
sl@0: 
sl@0: @return KErrNone The operation has completed successfully;
sl@0:         KErrNoMemory, an out of memory condition has occurred;
sl@0:         KErrPermissionDenied, the caller does not satisfy the relevant database security policies.
sl@0:                       Note that other system-wide error codes may also be returned.
sl@0: 
sl@0: @capability Note For a secure shared database, the caller must satisfy the write 
sl@0:             access policy for the database.
sl@0: */
sl@0: EXPORT_C TInt RDbDatabase::Recover()
sl@0: 	{
sl@0: 	return Utility(iDatabase,CDbDatabase::ERecover);
sl@0: 	}
sl@0: 
sl@0: /**
sl@0: Returns the currently available size information for the database. 
sl@0: This comprises a size in bytes for the database objects and a percentage used value which indicates 
sl@0: how much of that size is live data-the remainder may be available for compaction. 
sl@0: Some types of database may not be able to report this information, e.g. a RDbStoreDatabase, 
sl@0: and others may need to have UpdateStats() in order to provide valid data. 
sl@0: In these cases, the values in the RDbDatabase::TSize structure will contain an error value to indicate this.
sl@0: 
sl@0: @return RDbDatabase::TSize object, containing the database size and the percentage used value.
sl@0: */
sl@0: EXPORT_C RDbDatabase::TSize RDbDatabase::Size() const
sl@0: 	{
sl@0: 	TSize size;
sl@0: 	size.iSize=Property(iDatabase,CDbDatabase::ESize);
sl@0: 	size.iUsage=Property(iDatabase,CDbDatabase::EUsage);
sl@0: 	return size;
sl@0: 	}
sl@0: 
sl@0: /**
sl@0: Update any calculated statistics for the database. 
sl@0: Note that this can take an extended time to complete, 
sl@0: so an incremental form is also provided - RDbIncremental::UpdateStats().
sl@0: 
sl@0: @return KErrNone The operation has completed successfully;
sl@0:         KErrNoMemory, an out of memory condition has occurred;
sl@0:         KErrPermissionDenied, the caller does not satisfy the relevant database security policies.
sl@0:                       Note that other system-wide error codes may also be returned.
sl@0: 
sl@0: @capability Note For a secure shared database, the caller must satisfy the write 
sl@0:             access policy for the database.
sl@0:             
sl@0: @see RDbIncremental::UpdateStats()
sl@0: */
sl@0: EXPORT_C TInt RDbDatabase::UpdateStats()
sl@0: 	{
sl@0: 	return Utility(iDatabase,CDbDatabase::EStats);
sl@0: 	}
sl@0: 
sl@0: /**
sl@0: Synchronous database compaction.
sl@0: Compacts the database and returns when complete. 
sl@0: Note that this can take an extended time to complete, so an incremental form is also provided.
sl@0: There is a complementary interface to calculate and report database size and usage information, which
sl@0: can be used by the clients to determine when it may be appropriate to compact the database. 
sl@0: 
sl@0: @see RDbIncremental::Compact()
sl@0: @see RDbDatabase::UpdateStats()
sl@0: @see RDbDatabase::Size()
sl@0: 
sl@0: @return KErrNone The operation has completed successfully;
sl@0:         KErrNoMemory, an out of memory condition has occurred;
sl@0:         KErrPermissionDenied, the caller does not satisfy the relevant database security policies.
sl@0:                       Note that other system-wide error codes may also be returned.
sl@0: 
sl@0: @capability Note For a secure shared database, the caller must satisfy the write 
sl@0:             access policy for the database.
sl@0: */
sl@0: EXPORT_C TInt RDbDatabase::Compact()
sl@0: 	{
sl@0: 	return Utility(iDatabase,CDbDatabase::ECompact);
sl@0: 	}
sl@0: 
sl@0: 
sl@0: /**
sl@0: Drops the tables and destroys the database.
sl@0: This handle is closed on successful destruction.
sl@0: 
sl@0: @return KErrNone The operation has completed successfully;
sl@0:         KErrNoMemory, an out of memory condition has occurred;
sl@0:         KErrPermissionDenied, the caller does not satisfy the relevant database security policies.
sl@0:                       Note that other system-wide error codes may also be returned.
sl@0: 
sl@0: @capability Note For a secure shared database, the caller must satisfy the schema 
sl@0:             access policy for the database.
sl@0: */
sl@0: EXPORT_C TInt RDbDatabase::Destroy()
sl@0: 	{
sl@0: 	CDbTableNames* t=NULL;
sl@0: 	TRAPD(r,t=TableNamesL());
sl@0: 	if (r!=KErrNone)
sl@0: 		return r;
sl@0: 	TInt ii=t->Count();
sl@0: 	do
sl@0: 		{
sl@0: 		if (--ii<0)
sl@0: 			{
sl@0: 			r=iDatabase->Destroy();
sl@0: 			if (r==KErrNone)
sl@0: 				iDatabase.Close();
sl@0: 			break;
sl@0: 			}
sl@0: 		r=DropTable((*t)[ii]);
sl@0: 		} while (r==KErrNone);
sl@0: 	delete t;
sl@0: 	return r;
sl@0: 	}
sl@0: 
sl@0: /**
sl@0: Begins a transaction.
sl@0: 
sl@0: DBMS server only supports one 'granularity' of transaction lock: the whole database. 
sl@0: Beginning a transaction locks the database, and this can fail if another client has already got a lock which 
sl@0: excludes this client.
sl@0: If the same client has already locked the database it will be panic'd.
sl@0: The function is guaranteed to return KErrNone for client-side access. 
sl@0: 
sl@0: DBMS transactions do not provide any form of isolation between the clients: 
sl@0: while one client is updating a table within a transaction, other clients will be able to see the changes as 
sl@0: they are made. As a result, if a client retrieves two separate rows  from a database there is no automatic 
sl@0: guarantee that the data being retrieved has not been changed between the reads - this can lead to 
sl@0: an 'inconsistent read'. A client can prevent an update while retrieving related rows by enclosing the individual 
sl@0: reads within a transaction. Such a transaction will not modify the database and only operates as a read-lock: 
sl@0: releasing such a lock using Commit() or Rollback() will not affect the database in any way.
sl@0: 
sl@0: How RDbDatabase::Begin() works:
sl@0:  - on a shared database Begin() will attempt to get a shared read-lock on the database, and will fail with 
sl@0:    KErrLocked if anyone has an exclusive write-lock. Other clients with read-locks will not cause this operation 
sl@0:    to fail.
sl@0:  - any operation which will modify the database attempts to gain an exclusive write-lock on the database, 
sl@0:    and will fail with KErrLocked if anyone else has any lock on the database. If the current client already has 
sl@0:    a read-lock as a result of calling Begin(), then it will be upgraded to an exclusive write-lock.
sl@0:  - Commit() or Rollback() after a read-lock has been acquired (but not a write-lock) will release that client's 
sl@0:    lock. The database will only be considered to be unlocked when all such locks are removed by all clients, 
sl@0:    when it will report a EUnlock event to any notifiers.
sl@0:  - Commit() or Rollback() after a write-lock has been acquired will release the lock, and report the ECommit or 
sl@0:    ERollback event to any notifiers.
sl@0:  - automatic transactions will be used as at present if updates are made outside of explicit transactions, 
sl@0:    and such updates will also be able to fail with KErrLocked if an exclusive lock cannot be acquired.
sl@0:    
sl@0: Allowing read-locks to be shared enables greater concurrency at the same time as providing some safe guard 
sl@0: against inconsistent reads. It does, however, lead to the possibility of deadlock: two clients wanting to update 
sl@0: the database can reach deadlock if they both Begin() a transaction before either of them starts an update, 
sl@0: then one client's read-lock will prevent the other from upgrading to a write lock and vice versa. The only way out
sl@0: of this is to code the clients in such a way as to back out of such a deadlock situation, rather than retry 
sl@0: forever without releasing the locks. 
sl@0: 
sl@0: A client will be able to change the database schema while other clients are using the database, 
sl@0: as long as the other clients have no locks on it. As described above, other clients may find that their
sl@0: rowsets are then invalidated asynchronously as a result of this.
sl@0: 
sl@0: @return KErrNone The operation has completed successfully;
sl@0:         KErrLocked, the database is locked by another client;
sl@0:         KErrPermissionDenied, the caller does not satisfy the relevant database security policies.
sl@0:                       Note that other system-wide error codes may also be returned.
sl@0: 
sl@0: @capability Note For a secure shared database, the caller must satisfy either the read, write
sl@0: 			or the schema access policy for the database.
sl@0: */
sl@0: EXPORT_C TInt RDbDatabase::Begin()
sl@0: 	{
sl@0: 	return iDatabase->Begin();
sl@0: 	}
sl@0: 
sl@0: /**
sl@0: Commits the current transaction.
sl@0: 
sl@0: @return KErrNone The operation has completed successfully;
sl@0:         KErrPermissionDenied, the caller does not satisfy the relevant database security policies.
sl@0:                       Note that other system-wide error codes may also be returned.
sl@0: 
sl@0: @capability Note For a secure shared database, the caller must satisfy either the read, write
sl@0: 			or the schema access policy for the database.
sl@0: */
sl@0: EXPORT_C TInt RDbDatabase::Commit()
sl@0: 	{
sl@0: 	return iDatabase->Commit();
sl@0: 	}
sl@0: 
sl@0: /**
sl@0: Rollbacks the current transaction.
sl@0: 
sl@0: @capability Note For a secure shared database, the caller must satisfy either the read, write
sl@0: 			or the schema access policy for the database.
sl@0: */
sl@0: EXPORT_C void RDbDatabase::Rollback()
sl@0: 	{
sl@0: 	iDatabase->Rollback();
sl@0: 	}
sl@0: 
sl@0: /**
sl@0: @return True if the database is in a transaction, false otherwise.
sl@0: */
sl@0: EXPORT_C TBool RDbDatabase::InTransaction() const
sl@0: 	{
sl@0: 	return Property(iDatabase,CDbDatabase::EInTransaction);
sl@0: 	}
sl@0: 
sl@0: /**
sl@0: Creates a table on the database.
sl@0: 
sl@0: @param aName Table name.
sl@0: @param aColSet A set of column definitions which describe the table structure.
sl@0: @param aPrimaryKey Primary key definition. If it is NULL, no primary key will be created for the new table.
sl@0: 
sl@0: @return KErrNone The operation has completed successfully;
sl@0:         KErrNoMemory, an out of memory condition has occurred;
sl@0:         KErrAlreadyExists, a table with that name already exists;
sl@0:         KErrArgument, empty column set, duplicated column name, invalid column length;
sl@0:         KErrBadName, invalid table name, invalid column name (containing spaces for example);
sl@0:         KErrNotSupported, unknown column type, unknown column attributes;
sl@0:         KErrPermissionDenied, the caller does not satisfy the relevant database security policies.
sl@0:                       Note that other system-wide error codes may also be returned.
sl@0: 
sl@0: @capability Note For a secure shared database, the caller must satisfy the schema 
sl@0:             access policy for the database.
sl@0: */
sl@0: EXPORT_C TInt RDbDatabase::CreateTable(const TDesC& aName,const CDbColSet& aColSet,const CDbKey* aPrimaryKey)
sl@0: 	{
sl@0: 	TRAPD(r,iDatabase->CreateTableL(aName,aColSet,aPrimaryKey));
sl@0: 	return r;
sl@0: 	}
sl@0: 
sl@0: /**
sl@0: Drops a table synchronously.
sl@0: 
sl@0: @param aName Table name.
sl@0: 
sl@0: @return KErrNone The operation has completed successfully;
sl@0:         KErrNotFound, there is no table with the supplied name;
sl@0:         KErrPermissionDenied, the caller does not satisfy the relevant database security policies.
sl@0:                       Note that other system-wide error codes may also be returned.
sl@0: 
sl@0: @capability Note For a secure shared database, the caller must satisfy the schema 
sl@0:             access policy for the database.
sl@0: */
sl@0: EXPORT_C TInt RDbDatabase::DropTable(const TDesC& aName)
sl@0: 	{
sl@0: 	TInt step;
sl@0: 	TRAPD(r,CompleteDDLL(iDatabase->DropTableL(aName,step),step));
sl@0: 	return r;
sl@0: 	}
sl@0: 
sl@0: /**
sl@0: Alters a table synchronously.
sl@0: 
sl@0: @param aName Table name.
sl@0: @param aColSet A new set of column definitions which describe the table structure.
sl@0: 
sl@0: @return KErrNone The operation has completed successfully;
sl@0:         KErrNoMemory, an out of memory condition has occurred;
sl@0:         KErrArgument, empty column set, duplicated column name, invalid column length;
sl@0:         KErrNotFound, there is no table with the supplied name;
sl@0:         KErrNotSupported, unknown column type, unknown column attributes;
sl@0:         KErrPermissionDenied, the caller does not satisfy the relevant database security policies.
sl@0:                       Note that other system-wide error codes may also be returned.
sl@0: 
sl@0: @capability Note For a secure shared database, the caller must satisfy the schema 
sl@0:             access policy for the database.
sl@0: */
sl@0: EXPORT_C TInt RDbDatabase::AlterTable(const TDesC& aName,const CDbColSet& aColSet)
sl@0: 	{
sl@0: 	TInt step;
sl@0: 	TRAPD(r,CompleteDDLL(iDatabase->AlterTableL(aName,aColSet,step),step));
sl@0: 	return r;
sl@0: 	}
sl@0: 
sl@0: /**
sl@0: Creates an index synchronously.
sl@0: 
sl@0: @param aName Index name.
sl@0: @param aTableName Table name.
sl@0: @param aKey Index definition
sl@0: 
sl@0: @return KErrNone The operation has completed successfully;
sl@0:         KErrNoMemory, an out of memory condition has occurred;
sl@0:         KErrBadName, invalid index name (containing spaces for example);
sl@0:         KErrAlreadyExists, an index with that name already exists;
sl@0:         KErrNotFound, there is no table with that name;
sl@0:         KErrPermissionDenied, the caller does not satisfy the relevant database security policies.
sl@0:                       Note that other system-wide error codes may also be returned.
sl@0: 
sl@0: @capability Note For a secure shared database, the caller must satisfy the schema 
sl@0:             access policy for the database.
sl@0: */
sl@0: EXPORT_C TInt RDbDatabase::CreateIndex(const TDesC& aName,const TDesC& aTableName,const CDbKey& aKey)
sl@0: 	{
sl@0: 	TInt step;
sl@0: 	TRAPD(r,CompleteDDLL(iDatabase->CreateIndexL(aName,aTableName,aKey,step),step));
sl@0: 	return r;
sl@0: 	}
sl@0: 
sl@0: /**
sl@0: Drops an index synchronously.
sl@0: 
sl@0: @param aName Index name.
sl@0: @param aTableName Table name.
sl@0: 
sl@0: @return KErrNone The operation has completed successfully;
sl@0:         KErrNotFound, there is no table or index with that name;
sl@0:         KErrPermissionDenied, the caller does not satisfy the relevant database security policies.
sl@0:                       Note that other system-wide error codes may also be returned.
sl@0: 
sl@0: @capability Note For a secure shared database, the caller must satisfy the schema 
sl@0:             access policy for the database.
sl@0: */
sl@0: EXPORT_C TInt RDbDatabase::DropIndex(const TDesC& aName,const TDesC& aTableName)
sl@0: 	{
sl@0: 	TInt step;
sl@0: 	TRAPD(r,CompleteDDLL(iDatabase->DropIndexL(aName,aTableName,step),step));
sl@0: 	return r;
sl@0: 	}
sl@0: 
sl@0: /**
sl@0: Executes a SQL statement on the database, and returns when it is complete. 
sl@0: The aComp parameter is used in the execution of some SQL statements:
sl@0:  - in CREATE INDEX statements it specifies the comparison operation used for text columns in the index key;
sl@0:  - in UPDATE and DELETE statements it specifies the comparison operation used to evaluate the WHERE clause;
sl@0: Other statements ignore the value of aComp.
sl@0: A negative return value indicates an error. A successful DDL operation always returns KErrNone (zero), 
sl@0: a successful DML operation returns the number of rows that were inserted, updated or deleted by the operation.
sl@0: 
sl@0: @param aSql A string of 16-bit wide characters containing one SQL statement.
sl@0: @param aComparison Tells the DBMS how to compare text and long text columns.
sl@0: 
sl@0: @return Zero or positive value, the number of rows that were inserted, updated or deleted by the operation;
sl@0: 		KErrLocked, the database is locked by another client;
sl@0:         KErrPermissionDenied, the caller does not satisfy the relevant database security policies.
sl@0:                       Note that other system-wide error codes may also be returned.
sl@0: 
sl@0: @capability Note For a secure shared database, the caller must satisfy:
sl@0:             - the schema access policy for the database, if the SQL statement is 
sl@0: 			  CREATE/DROP/ALTER; 
sl@0:             - the write access policy for the table in the SQL, if the SQL statement is 
sl@0: 			  INSERT/UPDATE/DELETE; 
sl@0: */
sl@0: EXPORT_C TInt RDbDatabase::Execute(const TDesC& aSql,TDbTextComparison aComparison)
sl@0: 	{
sl@0: 	TInt ret;
sl@0: 	TRAP(ret, \
sl@0: 		CDbIncremental* inc=iDatabase->ExecuteL(aSql,aComparison,ret); \
sl@0: 		if (inc) \
sl@0: 			ret ? CompleteDDLL(inc,ret) : CompleteDMLL(inc,ret); \
sl@0: 		)
sl@0: 	return ret;
sl@0: 	}
sl@0: 
sl@0: /**
sl@0: Lists the tables on the database.
sl@0: 
sl@0: @return A pointer to a CDbTableNames container with table names. The caller is responsible for destroying
sl@0:         the returned CDbTableNames instance.
sl@0: 
sl@0: @leave KErrNoMemory, an out of memory condition has occurred;
sl@0:                      Note that the function may leave with other system-wide error codes.
sl@0: */
sl@0: EXPORT_C CDbTableNames* RDbDatabase::TableNamesL() const
sl@0: 	{
sl@0: 	CDbTableNames* names=CDbTableNames::NewLC();
sl@0: 	iDatabase->TablesL(*names);
sl@0: 	CleanupStack::Pop();
sl@0: 	return names;
sl@0: 	}
sl@0: 
sl@0: /**
sl@0: Returns the table definition.
sl@0: 
sl@0: @param aName Table name.
sl@0: 
sl@0: @return A pointer to a CDbColSet container with column definitions . The caller is responsible for destroying
sl@0:         the returned CDbColSet instance.
sl@0: 
sl@0: @leave KErrNoMemory, an out of memory condition has occurred;
sl@0: 	   KErrNotFound, no table with that name exists;
sl@0:                      Note that the function may leave with other system-wide error codes.
sl@0: */
sl@0: EXPORT_C CDbColSet* RDbDatabase::ColSetL(const TDesC& aName) const
sl@0: 	{
sl@0: 	CDbColSet* set=CDbColSet::NewLC();
sl@0: 	iDatabase->ColumnsL(*set,aName);
sl@0: 	CleanupStack::Pop();
sl@0: 	return set;
sl@0: 	}
sl@0: 
sl@0: /**
sl@0: Lists the indexes on a table.
sl@0: 
sl@0: @param aTable Table name.
sl@0: 
sl@0: @return A pointer to a CDbIndexNames container with column definitions . The caller is responsible for destroying
sl@0:         the returned CDbIndexNames instance.
sl@0: 
sl@0: @leave KErrNoMemory, an out of memory condition has occurred;
sl@0: 	   KErrNotFound, no table with that name exists;
sl@0:                      Note that the function may leave with other system-wide error codes.
sl@0: */
sl@0: EXPORT_C CDbIndexNames* RDbDatabase::IndexNamesL(const TDesC& aTable) const
sl@0: 	{
sl@0: 	CDbIndexNames* names=CDbIndexNames::NewLC();
sl@0: 	iDatabase->IndexesL(*names,aTable);
sl@0: 	CleanupStack::Pop();
sl@0: 	return names;
sl@0: 	}
sl@0: 
sl@0: /**
sl@0: Returns the index key.
sl@0: 
sl@0: @param aName Index name.
sl@0: @param aTable Table name.
sl@0: 
sl@0: @return A pointer to a CDbKey object containing the index definition. The caller is responsible for destroying
sl@0:         the returned CDbKey instance.
sl@0: 
sl@0: @leave KErrNoMemory, an out of memory condition has occurred;
sl@0: 	   KErrNotFound, no index or table with that name exists;
sl@0:                      Note that the function may leave with other system-wide error codes.
sl@0: */
sl@0: EXPORT_C CDbKey* RDbDatabase::KeyL(const TDesC& aName,const TDesC& aTable) const
sl@0: 	{
sl@0: 	CDbKey* key=CDbKey::NewLC();
sl@0: 	iDatabase->KeysL(*key,aName,aTable);
sl@0: 	CleanupStack::Pop();
sl@0: 	return key;
sl@0: 	}
sl@0: 
sl@0: // class CDbDatabase
sl@0: 
sl@0: CDbNotifier* CDbDatabase::NotifierL()
sl@0: 	{
sl@0: 	return AttachContext(this,OpenNotifierL());
sl@0: 	}
sl@0: 
sl@0: CDbIncremental* CDbDatabase::UtilityL(CDbDatabase::TUtility aType,TInt& aStep)
sl@0: 	{
sl@0: 	return AttachContext(this,OpenUtilityL(aType,aStep));
sl@0: 	}
sl@0: 
sl@0: CDbIncremental* CDbDatabase::DropTableL(const TDesC& aTable,TInt& aStep)
sl@0: 	{
sl@0: 	return AttachContext(this,OpenDropTableL(aTable,aStep));
sl@0: 	}
sl@0: 
sl@0: CDbIncremental* CDbDatabase::AlterTableL(const TDesC& aTable,const CDbColSet& aNewDef,TInt& aStep)
sl@0: 	{
sl@0: 	return AttachContext(this,OpenAlterTableL(aTable,aNewDef,aStep));
sl@0: 	}
sl@0: 
sl@0: CDbIncremental* CDbDatabase::CreateIndexL(const TDesC& aName,const TDesC& aTable,const CDbKey& aKey,TInt& aStep)
sl@0: 	{
sl@0: 	return AttachContext(this,OpenCreateIndexL(aName,aTable,aKey,aStep));
sl@0: 	}
sl@0: 
sl@0: CDbIncremental* CDbDatabase::DropIndexL(const TDesC& aName,const TDesC& aTable,TInt& aStep)
sl@0: 	{
sl@0: 	return AttachContext(this,OpenDropIndexL(aName,aTable,aStep));
sl@0: 	}
sl@0: 
sl@0: CDbIncremental* CDbDatabase::ExecuteL(const TDesC& aSql,TDbTextComparison aComparison,TInt& aInit)
sl@0: 	{
sl@0: 	return AttachContext(this,OpenExecuteL(aSql,aComparison,aInit));
sl@0: 	}
sl@0: 
sl@0: CDbCursor* CDbDatabase::ViewL(const TDbQuery& aQuery,const TDbWindow& aWindow,RDbRowSet::TAccess anAccess)
sl@0: 	{
sl@0: 	return AttachContext(this,PrepareViewL(aQuery,aWindow,anAccess));
sl@0: 	}
sl@0: 
sl@0: CDbCursor* CDbDatabase::TableL(const TDesC &aName,RDbRowSet::TAccess anAccess)
sl@0: 	{
sl@0: 	return AttachContext(this,OpenTableL(aName,anAccess));
sl@0: 	}
sl@0: 
sl@0: //
sl@0: // Reserved for future development
sl@0: //
sl@0: EXPORT_C void CDbDatabase::Reserved_1()
sl@0: 	{
sl@0: 	}
sl@0: 
sl@0: //
sl@0: // Reserved for future development
sl@0: //
sl@0: EXPORT_C void CDbDatabase::Reserved_2()
sl@0: 	{
sl@0: 	}