os/persistentdata/persistentstorage/sql/SRC/Server/Compact/SqlCompactConn.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/persistentdata/persistentstorage/sql/SRC/Server/Compact/SqlCompactConn.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,70 @@
     1.4 +// Copyright (c) 2008-2010 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 SQLCOMPACTCONN_H
    1.20 +#define SQLCOMPACTCONN_H
    1.21 +
    1.22 +#include "SqlCompact.h"
    1.23 +
    1.24 +//Forward declarations
    1.25 +struct sqlite3;
    1.26 +struct TSqlFreePageCallback;
    1.27 +
    1.28 +#ifdef _DEBUG
    1.29 +#define SQLCOMPACTCONN_INVARIANT() Invariant()
    1.30 +#else
    1.31 +#define SQLCOMPACTCONN_INVARIANT() void(0)
    1.32 +#endif
    1.33 +
    1.34 +/**
    1.35 +An implementation class for the MSqlCompactConn interface.
    1.36 +Establishes a connection with the database.
    1.37 +The established connection can be used for compacting the database.
    1.38 +
    1.39 +@see MSqlCompactConn
    1.40 +
    1.41 +@internalComponent
    1.42 +*/
    1.43 +NONSHARABLE_CLASS(CSqlCompactConn) : public CBase, public MSqlCompactConn
    1.44 +	{
    1.45 +	friend class CSqlCompactTestActive;
    1.46 +	
    1.47 +public:
    1.48 +	static CSqlCompactConn* NewL(const TDesC& aFullName, TSqlFreePageCallback& aFreePageCallback);
    1.49 +	virtual ~CSqlCompactConn();
    1.50 +	virtual void Release();
    1.51 +	virtual TInt Compact(TInt aPageCount, TInt& aProcessedPageCount, TInt aLength);
    1.52 +	void Invariant() const;
    1.53 +
    1.54 +private:
    1.55 +	void ConstructL(const TDesC& aFullName, TSqlFreePageCallback& aFreePageCallback);
    1.56 +	TInt FreePageCountL();
    1.57 +	TInt PageSizeL();
    1.58 +
    1.59 +private:
    1.60 +	sqlite3* iHandle;
    1.61 +
    1.62 +	};
    1.63 +
    1.64 +/**
    1.65 +A factory function for the MSqlCompactConn interface.
    1.66 +
    1.67 +@see MSqlCompactConn
    1.68 +
    1.69 +@internalComponent
    1.70 +*/
    1.71 +MSqlCompactConn* SqlCreateCompactConnL(const TDesC& aFullName, TSqlFreePageCallback& aFreePageCallback);
    1.72 +
    1.73 +#endif//SQLCOMPACTCONN_H