1 /* |
|
2 * Copyright (c) 2008 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: SQL database maintenance class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 #ifndef C_CMDMSQLDBMAINTENANCE_H |
|
25 #define C_CMDMSQLDBMAINTENANCE_H |
|
26 |
|
27 #include <e32base.h> |
|
28 |
|
29 /** Literals */ |
|
30 _LIT( KCmDatabase, "c:\\System\\Data\\MediaServant\\cm_database.sq"); |
|
31 _LIT( KCmDbDir, "c:\\System\\Data\\MediaServant\\"); |
|
32 |
|
33 /* Forward declarations. */ |
|
34 class CCmDmSQLiteConnection; |
|
35 |
|
36 /** |
|
37 * CCmDmSqlDbMaintenance class |
|
38 * Part of Database manager. Database manager is part of |
|
39 * Content manager component.CCMDMSqlDbMaintenance creates needed |
|
40 * database tables and initializes connenction to the database |
|
41 * |
|
42 * @lib cmdatabasemanager.lib |
|
43 * |
|
44 * @since S60 5.1 |
|
45 */ |
|
46 class CCmDmSqlDbMaintenance : public CBase |
|
47 { |
|
48 |
|
49 public: |
|
50 |
|
51 /** |
|
52 * Two-phased constructor. |
|
53 */ |
|
54 IMPORT_C static CCmDmSqlDbMaintenance* NewL(); |
|
55 |
|
56 /** |
|
57 * Two-phased constructor. |
|
58 */ |
|
59 IMPORT_C static CCmDmSqlDbMaintenance* NewLC(); |
|
60 |
|
61 /** |
|
62 * Destructor. |
|
63 */ |
|
64 virtual ~CCmDmSqlDbMaintenance(); |
|
65 |
|
66 /** |
|
67 * Initializes database connection |
|
68 * |
|
69 * @since S60 5.1 |
|
70 * @param None |
|
71 * @return TInt, Error code |
|
72 */ |
|
73 TInt InitConnection( CCmDmSQLiteConnection& aConnection ); |
|
74 |
|
75 /** |
|
76 * Closes database connection |
|
77 * |
|
78 * @since S60 5.1 |
|
79 * @param None |
|
80 * @return None |
|
81 */ |
|
82 void CloseConnection( CCmDmSQLiteConnection& aConnection ); |
|
83 |
|
84 /** |
|
85 * Creates db file |
|
86 * |
|
87 * @since S60 5.1 |
|
88 * @param aConnection, reference to connection class |
|
89 * @return TInt, Error code |
|
90 */ |
|
91 TInt CreateDbFile( CCmDmSQLiteConnection& aConnection ); |
|
92 |
|
93 /** |
|
94 * Creates database tables |
|
95 * |
|
96 * @since S60 5.1 |
|
97 * @param aConnection, sqlite connection |
|
98 * @return None |
|
99 */ |
|
100 void CreateDb( CCmDmSQLiteConnection& aConnection ); |
|
101 |
|
102 /** |
|
103 * Creates database indexes |
|
104 * |
|
105 * @since S60 5.1 |
|
106 * @param aConnection, sqlite connection |
|
107 * @return None |
|
108 */ |
|
109 void CreateIndexes( CCmDmSQLiteConnection& aConnection ); |
|
110 |
|
111 private: |
|
112 |
|
113 /** |
|
114 * Performs the first phase of two phase construction. |
|
115 */ |
|
116 CCmDmSqlDbMaintenance(); |
|
117 |
|
118 /** |
|
119 * Performs the second phase construction. |
|
120 */ |
|
121 void ConstructL(); |
|
122 |
|
123 }; |
|
124 |
|
125 #endif // C_CMDMSQLDBMAINTENANCE_H |
|