|
1 /* |
|
2 * Copyright (c) 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: |
|
15 * ?description_line |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef FT_DATABASEUTILITY_H |
|
21 #define FT_DATABASEUTILITY_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <e32std.h> |
|
25 |
|
26 // CONSTANTS |
|
27 const TInt KPosLmSqlStatementMaxLen = 256; |
|
28 _LIT(KPosLmSqlAll, "*"); |
|
29 _LIT(KPosLmSqlSelect, "SELECT %S FROM %S"); |
|
30 |
|
31 // Table names |
|
32 _LIT(KPosLmLandmarkTable, "lmt_landmark"); |
|
33 _LIT(KPosLmLandmarkFieldTable, "lmt_lmfield"); |
|
34 _LIT(KPosLmCategoryTable, "lmt_cat"); |
|
35 _LIT(KPosLmLandmarkCategoryTable, "lmt_lmcat"); |
|
36 _LIT(KPosLmIconTable, "lmt_icon"); |
|
37 _LIT(KPosLmSettingsTable, "lmt_settings"); |
|
38 |
|
39 // COLUMN NAMES: Landmark table |
|
40 _LIT(KPosLmLandmarkIdCol, "lmc_lmid"); |
|
41 _LIT(KPosLmLatitudeCol, "lmc_lat"); |
|
42 _LIT(KPosLmLongitudeCol, "lmc_long"); |
|
43 _LIT(KPosLmAltitudeCol, "lmc_alt"); |
|
44 _LIT(KPosLmHorizAccCol, "lmc_hacc"); |
|
45 _LIT(KPosLmVertAccCol, "lmc_vacc"); |
|
46 _LIT(KPosLmCoverageRadiusCol, "lmc_covrad"); |
|
47 _LIT(KPosLmIconIdCol, "lmc_iconid"); |
|
48 _LIT(KPosLmIconPicNrCol, "lmc_iconnr"); |
|
49 _LIT(KPosLmMaskPicNrCol, "lmc_masknr"); |
|
50 _LIT(KPosLmNameCol, "lmc_name"); |
|
51 _LIT(KPosLmNDescCol, "lmc_desc"); |
|
52 |
|
53 // COLUMN NAMES: Landmark Field |
|
54 // KPosLmLandmarkIdCol declared above |
|
55 _LIT(KPosLmFieldTypeCol, "lmc_fieldtype"); |
|
56 _LIT(KPosLmFieldStringCol, "lmc_fieldstr"); |
|
57 |
|
58 // COLUMN NAMES: Category table |
|
59 _LIT(KPosLmCategoryIdCol, "lmc_catid"); |
|
60 _LIT(KPosLmGlobalCategoryIdCol, "lmc_glcatid"); |
|
61 // KPosLmIconIdCol declared above |
|
62 // KPosLmIconPicNrCol declared above |
|
63 _LIT(KPosLmCategoryNameCol, "lmc_catname"); |
|
64 _LIT(KPosLmCategoryNameModifiedCol, "lmc_namemod"); |
|
65 |
|
66 // COLUMN NAMES: Landmark-Category table |
|
67 // KPosLmLandmarkIdCol declared above |
|
68 // KPosLmCategoryIdCol declared above |
|
69 |
|
70 // COLUMN NAMES: Icon table |
|
71 // KPosLmIconIdCol declared above |
|
72 _LIT(KPosLmIconPathCol, "lmc_iconpath"); |
|
73 |
|
74 // COLUMN NAMES: Landmark settings table |
|
75 _LIT(KPosLmLanguageCol, "lmc_language"); |
|
76 _LIT(KPosLmInitFlagCol, "lmc_init"); |
|
77 |
|
78 // INDEXES: Landmark table |
|
79 _LIT(KPosLmLandmarkIdIndex, "lmi_lmid"); |
|
80 |
|
81 // INDEXES: Category table |
|
82 _LIT(KPosLmCategoryIdIndex, "lmi_catid"); |
|
83 _LIT(KPosLmGlobalCategoryIdIndex, "lmi_glcatid"); |
|
84 _LIT(KPosLmCategoryNameIndex, "lmi_catname"); |
|
85 |
|
86 // INDEXES: Icon table |
|
87 _LIT(KPosLmIconIdIndex, "lmi_iconid"); |
|
88 |
|
89 // CLASS DECLARATION |
|
90 class RDbNamedDatabase; |
|
91 |
|
92 /** |
|
93 * Utility function for landmark database. |
|
94 */ |
|
95 class FTDatabaseUtility |
|
96 { |
|
97 |
|
98 public: // New functions |
|
99 |
|
100 /** |
|
101 * Removes the protocol (i.e. "file://") from the URI. This function |
|
102 * assumes that the protocol is present first in the specified URI. |
|
103 * |
|
104 * @param aUri A URI. On out it contains the URI without the protocol. |
|
105 */ |
|
106 IMPORT_C static void RemoveProtocolFromUriL( |
|
107 /* IN/OUT */ TPtrC& aDbUri |
|
108 ); |
|
109 |
|
110 static void CreateDatabaseL(const TDesC& aDbpath, TBool aReplaceDatabase= EFalse, TBool aWrongId=EFalse, TBool aCreateInvalidIndex=EFalse); |
|
111 |
|
112 |
|
113 private: |
|
114 |
|
115 static void CreateTablesL(RDbNamedDatabase& aDb, TBool aCreateInvalidIndex); |
|
116 |
|
117 static void CreateLandmarkTableL(RDbNamedDatabase& aDb, TBool aCreateInvalidIndex); |
|
118 |
|
119 static void CreateLandmarkFieldTableL(RDbNamedDatabase& aDb); |
|
120 |
|
121 static void CreateCategoryTableL(RDbNamedDatabase& aDb, TBool aCreateInvalidIndex); |
|
122 |
|
123 static void CreateLmCategoryTableL(RDbNamedDatabase& aDb); |
|
124 |
|
125 static void CreateIconTableL(RDbNamedDatabase& aDb); |
|
126 |
|
127 static void CreateSettingsTableL(RDbNamedDatabase& aDb); |
|
128 |
|
129 static void CreateIndexesL(RDbNamedDatabase& aDb); |
|
130 |
|
131 static void CreateIndexL(RDbNamedDatabase& aDb,const TDesC& aIndex, |
|
132 const TDesC& aTable, |
|
133 const TDesC& aColumn, |
|
134 TBool aUnique |
|
135 ); |
|
136 |
|
137 static void SetCounterToOneL(RDbNamedDatabase& aDb,const TDesC& aTable); |
|
138 |
|
139 }; |
|
140 |
|
141 #endif // FT_DATABASEUTILITY_H |
|
142 |
|
143 // End of File |
|
144 |