equal
deleted
inserted
replaced
13 // Description: |
13 // Description: |
14 // |
14 // |
15 |
15 |
16 #include "TzLocalizationDbAccessor.h" |
16 #include "TzLocalizationDbAccessor.h" |
17 #include "TzLocalizationDataTypes.h" |
17 #include "TzLocalizationDataTypes.h" |
|
18 #include "OstTraceDefinitions.h" |
|
19 #ifdef OST_TRACE_COMPILER_IN_USE |
|
20 #include "TzLocalizationDbAccessorTraces.h" |
|
21 #endif |
|
22 |
18 |
23 |
19 //================================================================== |
24 //================================================================== |
20 // Database location and access policy |
25 // Database location and access policy |
21 //================================================================== |
26 //================================================================== |
22 _LIT(KTzLocalizationDbName,"c:TzLocalization.db"); |
27 _LIT(KTzLocalizationDbName,"c:TzLocalization.db"); |
89 OpenDbL(); |
94 OpenDbL(); |
90 } |
95 } |
91 |
96 |
92 void CTzLocalizationDbAccessor::OpenDbL() |
97 void CTzLocalizationDbAccessor::OpenDbL() |
93 { |
98 { |
|
99 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, CTZLOCALIZATIONDBACCESSOR_OPENDBL_ENTRY, "CTzLocalizationDbAccessor::OpenDbL Entry" ); |
|
100 |
94 if (iZoneMutex.OpenGlobal(KTzMutexName) != KErrNone) |
101 if (iZoneMutex.OpenGlobal(KTzMutexName) != KErrNone) |
95 { |
102 { |
96 User::LeaveIfError(iZoneMutex.CreateGlobal(KTzMutexName)) ; |
103 User::LeaveIfError(iZoneMutex.CreateGlobal(KTzMutexName)) ; |
97 } |
104 } |
98 //Connect to database server session |
105 //Connect to database server session |
113 if (!IsTableCreatedL(KUCTableName)) |
120 if (!IsTableCreatedL(KUCTableName)) |
114 { |
121 { |
115 User::LeaveIfError(CreateUserCityTableL()); |
122 User::LeaveIfError(CreateUserCityTableL()); |
116 } |
123 } |
117 } |
124 } |
|
125 OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_FLOW_PARAM, CTZLOCALIZATIONDBACCESSOR_OPENDBL_EXIT, "CTzLocalizationDbAccessor::OpenDbL Exit" ); |
|
126 |
118 } |
127 } |
119 |
128 |
120 |
129 |
121 /** |
130 /** |
122 Destructor |
131 Destructor |
178 @return KErrNone if succesful, or one of the DBMS Leave codes |
187 @return KErrNone if succesful, or one of the DBMS Leave codes |
179 @internalTechnology |
188 @internalTechnology |
180 */ |
189 */ |
181 TInt CTzLocalizationDbAccessor::CreateFrequentlyUsedZoneTableL() |
190 TInt CTzLocalizationDbAccessor::CreateFrequentlyUsedZoneTableL() |
182 { |
191 { |
|
192 |
183 // Create the columns for the cached zones table |
193 // Create the columns for the cached zones table |
184 RArray<TDbCol> cachedTableCols; |
194 RArray<TDbCol> cachedTableCols; |
185 CleanupClosePushL(cachedTableCols); |
195 CleanupClosePushL(cachedTableCols); |
186 cachedTableCols.AppendL(TDbCol(KCZTableTzIdCol, EDbColUint16)); |
196 cachedTableCols.AppendL(TDbCol(KCZTableTzIdCol, EDbColUint16)); |
187 cachedTableCols.AppendL(TDbCol(KCZTableStdCol, EDbColText)); |
197 cachedTableCols.AppendL(TDbCol(KCZTableStdCol, EDbColText)); |
246 @return KErrNone if succesful, or one of the DBMS Leave codes |
256 @return KErrNone if succesful, or one of the DBMS Leave codes |
247 @internalTechnology |
257 @internalTechnology |
248 */ |
258 */ |
249 TInt CTzLocalizationDbAccessor::CreateUserCityTableL() |
259 TInt CTzLocalizationDbAccessor::CreateUserCityTableL() |
250 { |
260 { |
|
261 |
251 //Create the columns for the user aded cities table |
262 //Create the columns for the user aded cities table |
252 RArray<TDbCol> cityTableCols; |
263 RArray<TDbCol> cityTableCols; |
253 CleanupClosePushL(cityTableCols); |
264 CleanupClosePushL(cityTableCols); |
254 cityTableCols.AppendL(TDbCol(KUCTableTzId, EDbColUint16)); |
265 cityTableCols.AppendL(TDbCol(KUCTableTzId, EDbColUint16)); |
255 cityTableCols.AppendL(TDbCol(KUCTableCity, EDbColText)); |
266 cityTableCols.AppendL(TDbCol(KUCTableCity, EDbColText)); |