1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/sql/SRC/Client/SqlDatabaseImpl.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,80 @@
1.4 +// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef __SQLDATABASEIMPL_H__
1.20 +#define __SQLDATABASEIMPL_H__
1.21 +
1.22 +#include <sqldb.h> //RSqlDatabase::TIsolationLevel, TSqlColumnType
1.23 +#include "SqlDbSession.h" //RSqlDbSession, TSqlSrvFunction (via included SqlUtil.h)
1.24 +
1.25 +//Forward declarations
1.26 +class CSqlSecurityPolicy;
1.27 +
1.28 +/**
1.29 +CSqlDatabaseImpl implements RSqlDatabase.
1.30 +
1.31 +It can be used for:
1.32 + - establishing a connection with the database;
1.33 + - attaching/detaching a database to/from the existing connection;
1.34 + - executing SQL statements or a set of SQL statements, separated with ";";
1.35 + - deleting databases;
1.36 + - retrieving last error messages;
1.37 + - setting the isolation level;
1.38 + - returning the database security policy;
1.39 +
1.40 +@see RSqlDatabase
1.41 +
1.42 +@internalComponent
1.43 +*/
1.44 +NONSHARABLE_CLASS(CSqlDatabaseImpl) : public CBase
1.45 + {
1.46 +public:
1.47 + static CSqlDatabaseImpl* NewL(TSqlSrvFunction aFunction, const TDesC& aDbFileName,
1.48 + const CSqlSecurityPolicy* aSecurityPolicy, const TDesC8* aConfig = NULL);
1.49 + virtual ~CSqlDatabaseImpl();
1.50 + inline TInt Attach(const TDesC& aDbFileName, const TDesC& aDbName);
1.51 + inline TInt Detach(const TDesC& aDbName);
1.52 + static inline TInt Copy(const TDesC& aSrcDbFileName, const TDesC& aDestDbFileName);
1.53 + static inline TInt Delete(const TDesC& aDbFileName);
1.54 + CSqlSecurityPolicy* CloneSecurityPolicyL();
1.55 + inline TInt SetIsolationLevel(RSqlDatabase::TIsolationLevel aIsolationLevel);
1.56 + inline TInt Exec(const TDesC16& aSqlStmt);
1.57 + inline TInt Exec(const TDesC8& aSqlStmt);
1.58 + inline void Exec(const TDesC16& aSqlStmt, TRequestStatus& aStatus);
1.59 + inline void Exec(const TDesC8& aSqlStmt, TRequestStatus& aStatus);
1.60 + inline TPtrC LastErrorMessage();
1.61 + inline TInt64 LastInsertedRowId();
1.62 + inline RSqlDbSession& Session();
1.63 + inline TInt ExecScalarFullSelectL(const TDesC16& aSqlStmt, TSqlColumnType aType, TDes8& aRes);
1.64 + inline TInt ExecScalarFullSelectL(const TDesC8& aSqlStmt, TSqlColumnType aType, TDes8& aRes);
1.65 + inline TBool InTransaction();
1.66 + inline TInt Size();
1.67 + inline TInt Size(RSqlDatabase::TSize& aSize, const TDesC& aDbName);
1.68 + TInt Compact(TInt aSize, const TDesC& aDbName);
1.69 + void Compact(TInt aSize, const TDesC& aDbName, TRequestStatus& aStatus);
1.70 +
1.71 +private:
1.72 + inline CSqlDatabaseImpl();
1.73 + void ConstructL(TSqlSrvFunction aFunction, const TDesC& aDbFileName,
1.74 + const CSqlSecurityPolicy* aSecurityPolicy = NULL, const TDesC8* aConfig = NULL);
1.75 +
1.76 +private:
1.77 + RSqlDbSession iDbSession;
1.78 +
1.79 + };
1.80 +
1.81 +#include "SqlDatabaseImpl.inl"
1.82 +
1.83 +#endif //__SQLDATABASEIMPL_H__