os/persistentdata/persistentstorage/sql/SRC/Server/Compact/SqlCompactConn.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef SQLCOMPACTCONN_H
    17 #define SQLCOMPACTCONN_H
    18 
    19 #include "SqlCompact.h"
    20 
    21 //Forward declarations
    22 struct sqlite3;
    23 struct TSqlFreePageCallback;
    24 
    25 #ifdef _DEBUG
    26 #define SQLCOMPACTCONN_INVARIANT() Invariant()
    27 #else
    28 #define SQLCOMPACTCONN_INVARIANT() void(0)
    29 #endif
    30 
    31 /**
    32 An implementation class for the MSqlCompactConn interface.
    33 Establishes a connection with the database.
    34 The established connection can be used for compacting the database.
    35 
    36 @see MSqlCompactConn
    37 
    38 @internalComponent
    39 */
    40 NONSHARABLE_CLASS(CSqlCompactConn) : public CBase, public MSqlCompactConn
    41 	{
    42 	friend class CSqlCompactTestActive;
    43 	
    44 public:
    45 	static CSqlCompactConn* NewL(const TDesC& aFullName, TSqlFreePageCallback& aFreePageCallback);
    46 	virtual ~CSqlCompactConn();
    47 	virtual void Release();
    48 	virtual TInt Compact(TInt aPageCount, TInt& aProcessedPageCount, TInt aLength);
    49 	void Invariant() const;
    50 
    51 private:
    52 	void ConstructL(const TDesC& aFullName, TSqlFreePageCallback& aFreePageCallback);
    53 	TInt FreePageCountL();
    54 	TInt PageSizeL();
    55 
    56 private:
    57 	sqlite3* iHandle;
    58 
    59 	};
    60 
    61 /**
    62 A factory function for the MSqlCompactConn interface.
    63 
    64 @see MSqlCompactConn
    65 
    66 @internalComponent
    67 */
    68 MSqlCompactConn* SqlCreateCompactConnL(const TDesC& aFullName, TSqlFreePageCallback& aFreePageCallback);
    69 
    70 #endif//SQLCOMPACTCONN_H