56
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description: This header file describes the class that handles the
|
|
15 |
* asynchronous operations on the triggers in database.
|
|
16 |
*
|
|
17 |
*/
|
|
18 |
|
|
19 |
|
|
20 |
#ifndef C_LBTDB_OPERATION_AO_H
|
|
21 |
#define C_LBTDB_OPERATION_AO_H
|
|
22 |
|
|
23 |
#include <e32base.h>
|
|
24 |
#include <d32dbms.h>
|
|
25 |
|
|
26 |
// forward declaration
|
|
27 |
class CLbtDbTriggersManager;
|
|
28 |
|
|
29 |
/**
|
|
30 |
* Execute the Database operations asynchronously
|
|
31 |
*/
|
|
32 |
NONSHARABLE_CLASS( CLbtDbOperationAO ) : public CActive
|
|
33 |
{
|
|
34 |
public:
|
|
35 |
static CLbtDbOperationAO* NewL(
|
|
36 |
RDbDatabase& aDb,
|
|
37 |
CLbtDbTriggersManager* aObserver);
|
|
38 |
|
|
39 |
virtual ~CLbtDbOperationAO();
|
|
40 |
|
|
41 |
void ExecuteQuery(
|
|
42 |
RDbView& aView,
|
|
43 |
TDesC& aQuery);
|
|
44 |
|
|
45 |
TInt ExecuteSyncQuery(
|
|
46 |
RDbView& aView,
|
|
47 |
TDesC& aQuery);
|
|
48 |
void CompactDb();
|
|
49 |
|
|
50 |
TBool IsCompactionOngoing();
|
|
51 |
|
|
52 |
protected:
|
|
53 |
/**
|
|
54 |
* Implements cancellation of an outstanding request.
|
|
55 |
*/
|
|
56 |
virtual void DoCancel();
|
|
57 |
|
|
58 |
/**
|
|
59 |
* Handles completion of the Db operation request.
|
|
60 |
*/
|
|
61 |
virtual void RunL();
|
|
62 |
|
|
63 |
/**
|
|
64 |
* Handles error in the execution of the Db operation
|
|
65 |
*/
|
|
66 |
virtual TInt RunError(TInt aError);
|
|
67 |
|
|
68 |
private:
|
|
69 |
|
|
70 |
CLbtDbOperationAO(
|
|
71 |
RDbDatabase& aDb,
|
|
72 |
CLbtDbTriggersManager* aObserver);
|
|
73 |
|
|
74 |
void ConstructL();
|
|
75 |
|
|
76 |
private:
|
|
77 |
enum TDbOperationType
|
|
78 |
{
|
|
79 |
EDbOperationNone = 0, // Currently ready to execute a Db operation
|
|
80 |
EDbSqlQuery = 1, // Executing a Sql Query on the Database
|
|
81 |
EDbCompaction = 2 // Executing a compaction operation on the database
|
|
82 |
};
|
|
83 |
|
|
84 |
private: // data
|
|
85 |
/** Handle to the Database */
|
|
86 |
RDbDatabase& iDb;
|
|
87 |
|
|
88 |
/**
|
|
89 |
* The Database view which provides the interface to execute
|
|
90 |
* the db operations.
|
|
91 |
* Does not own the Handle. This is just a reference.
|
|
92 |
*/
|
|
93 |
RDbView* iView;
|
|
94 |
|
|
95 |
/**
|
|
96 |
* The observer for the asynchronous operation.
|
|
97 |
* Does not own the observer object.
|
|
98 |
*/
|
|
99 |
CLbtDbTriggersManager* iObserver;
|
|
100 |
|
|
101 |
/**
|
|
102 |
* The Db handle to execute incremental operations on the database.
|
|
103 |
* Typical operations are on the database itself like compaction and
|
|
104 |
* recovery..
|
|
105 |
*/
|
|
106 |
RDbIncremental iDbIncrOp;
|
|
107 |
|
|
108 |
/**
|
|
109 |
* Counts the remaining steps in the Incremental operation
|
|
110 |
*/
|
|
111 |
TInt iSteps;
|
|
112 |
|
|
113 |
/**
|
|
114 |
* Indicates the type of async Db operation being performed by this object
|
|
115 |
*/
|
|
116 |
TDbOperationType iOperation;
|
|
117 |
};
|
|
118 |
|
|
119 |
#endif // C_LBTDB_OPERATION_AO_H
|