|
1 /* |
|
2 * Copyright (c) 2002-2005 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: Provides static functions which handles database creation |
|
15 * and deletion. |
|
16 * |
|
17 * |
|
18 */ |
|
19 |
|
20 |
|
21 #ifndef POSLMDATABASEMANAGER_H |
|
22 #define POSLMDATABASEMANAGER_H |
|
23 |
|
24 #include <e32base.h> |
|
25 #include <d32dbms.h> |
|
26 |
|
27 /** |
|
28 * This class contains static functions which handles database creation |
|
29 * and deletion. |
|
30 */ |
|
31 class PosLmDatabaseManager |
|
32 { |
|
33 public: |
|
34 enum TLmDbChangeType |
|
35 { |
|
36 ELmDbAdded = 0, |
|
37 ELmDbRemoved |
|
38 }; |
|
39 |
|
40 public: // New functions |
|
41 |
|
42 /** |
|
43 * Deletes a database. |
|
44 * @param[in] aDatabaseUri A database URI. |
|
45 */ |
|
46 static void DeleteDatabaseL( const TDesC& aUri ); |
|
47 |
|
48 /** |
|
49 * Creates a landmark database at the specified location. |
|
50 * |
|
51 * @param[in] aUri A database URI. |
|
52 * @param[in] aReplaceDatabase If ETrue, the database will be replaced |
|
53 * if it exists. If EFalse, the database will be created. |
|
54 */ |
|
55 static void CreateDatabaseL( |
|
56 const TDesC& aUri, |
|
57 TBool aDefaultDatabase = EFalse, |
|
58 TBool aReplaceDatabase = EFalse ); |
|
59 |
|
60 /** |
|
61 * Copies a database. |
|
62 * |
|
63 * @param[in] aSourceUri URI for the source database that shall be copied. |
|
64 * @param[in] aTargetUri URI for the new database copy. |
|
65 */ |
|
66 static void CopyDatabaseL( |
|
67 const TDesC& aSourceUri, |
|
68 const TDesC& aTargetUri ); |
|
69 |
|
70 /** Creates table with info of server-maintained indexes */ |
|
71 static void CreateIndexTableL( RDbNamedDatabase& aDb ); |
|
72 |
|
73 private: // New functions |
|
74 |
|
75 /* |
|
76 * Creates the tables in the landmark database. |
|
77 * @param[in] aDb Opened database that will contain the created tables. |
|
78 */ |
|
79 static void CreateTablesL( RDbNamedDatabase& aDb ); |
|
80 |
|
81 /* |
|
82 * Creates the landmark table. |
|
83 * @param[in] aDb Opened database that will contain the created table. |
|
84 */ |
|
85 static void CreateLandmarkTableL( RDbNamedDatabase& aDb ); |
|
86 |
|
87 /* |
|
88 * Creates the landmark field table. |
|
89 * @param[in] aDb Opened database that will contain the created table. |
|
90 */ |
|
91 static void CreateLandmarkFieldTableL( RDbNamedDatabase& aDb ); |
|
92 |
|
93 /* |
|
94 * Creates the category table. |
|
95 * @param[in] aDb Opened database that will contain the created table. |
|
96 */ |
|
97 static void CreateCategoryTableL( RDbNamedDatabase& aDb ); |
|
98 |
|
99 /* |
|
100 * Creates the landmark-category table. |
|
101 * @param[in] aDb Opened database that will contain the created table. |
|
102 */ |
|
103 static void CreateLmCategoryTableL( RDbNamedDatabase& aDb ); |
|
104 |
|
105 /* |
|
106 * Creates the icon table. |
|
107 * @param[in] aDb Opened database that will contain the created table. |
|
108 */ |
|
109 static void CreateIconTableL( RDbNamedDatabase& aDb ); |
|
110 |
|
111 /* |
|
112 * Creates the settings table. |
|
113 * @param[in] aDb Opened database that will contain the created table. |
|
114 */ |
|
115 static void CreateSettingsTableL( RDbNamedDatabase& aDb ); |
|
116 |
|
117 /* |
|
118 * Creates the indexes in the landmark database. |
|
119 * @param[in] aDb Opened database that will contain the created indexes. |
|
120 */ |
|
121 static void CreateIndexesL( RDbNamedDatabase& aDb ); |
|
122 |
|
123 /* |
|
124 * Creates an index in the landmark database. |
|
125 * |
|
126 * @param[in] aDb Opened database that will contain the created indexes. |
|
127 * @param[in] aIndex An index name. |
|
128 * @param[in] aTable An table name. |
|
129 * @param[in] aColumn An column name. |
|
130 * @param[in] aUnique Tells whether this index should be unique or not. |
|
131 */ |
|
132 static void CreateIndexL( |
|
133 RDbNamedDatabase& aDb, |
|
134 const TDesC& aIndex, |
|
135 const TDesC& aTable, |
|
136 const TDesC& aColumn, |
|
137 TBool aUnique ); |
|
138 |
|
139 /* |
|
140 * Sets a counter to one and not zero for the specified table in the |
|
141 * specified database. |
|
142 * |
|
143 * @param[in] aDb Opened database to change. |
|
144 * @param[in] aTable The table to modify. |
|
145 */ |
|
146 static void SetCounterToOneL( |
|
147 RDbNamedDatabase& aDb, |
|
148 const TDesC& aTable ); |
|
149 |
|
150 }; |
|
151 |
|
152 #endif // POSLMDATABASEMANAGER_H |
|
153 |
|
154 // End of File |
|
155 |