sl@0: // Copyright (c) 2008-2010 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: #ifndef SQLCOMPACTCONN_H sl@0: #define SQLCOMPACTCONN_H sl@0: sl@0: #include "SqlCompact.h" sl@0: sl@0: //Forward declarations sl@0: struct sqlite3; sl@0: struct TSqlFreePageCallback; sl@0: sl@0: #ifdef _DEBUG sl@0: #define SQLCOMPACTCONN_INVARIANT() Invariant() sl@0: #else sl@0: #define SQLCOMPACTCONN_INVARIANT() void(0) sl@0: #endif sl@0: sl@0: /** sl@0: An implementation class for the MSqlCompactConn interface. sl@0: Establishes a connection with the database. sl@0: The established connection can be used for compacting the database. sl@0: sl@0: @see MSqlCompactConn sl@0: sl@0: @internalComponent sl@0: */ sl@0: NONSHARABLE_CLASS(CSqlCompactConn) : public CBase, public MSqlCompactConn sl@0: { sl@0: friend class CSqlCompactTestActive; sl@0: sl@0: public: sl@0: static CSqlCompactConn* NewL(const TDesC& aFullName, TSqlFreePageCallback& aFreePageCallback); sl@0: virtual ~CSqlCompactConn(); sl@0: virtual void Release(); sl@0: virtual TInt Compact(TInt aPageCount, TInt& aProcessedPageCount, TInt aLength); sl@0: void Invariant() const; sl@0: sl@0: private: sl@0: void ConstructL(const TDesC& aFullName, TSqlFreePageCallback& aFreePageCallback); sl@0: TInt FreePageCountL(); sl@0: TInt PageSizeL(); sl@0: sl@0: private: sl@0: sqlite3* iHandle; sl@0: sl@0: }; sl@0: sl@0: /** sl@0: A factory function for the MSqlCompactConn interface. sl@0: sl@0: @see MSqlCompactConn sl@0: sl@0: @internalComponent sl@0: */ sl@0: MSqlCompactConn* SqlCreateCompactConnL(const TDesC& aFullName, TSqlFreePageCallback& aFreePageCallback); sl@0: sl@0: #endif//SQLCOMPACTCONN_H