208 iItemsDatabase.Commit(); |
208 iItemsDatabase.Commit(); |
209 Close(); |
209 Close(); |
210 } |
210 } |
211 |
211 |
212 // ----------------------------------------------------------------------------- |
212 // ----------------------------------------------------------------------------- |
|
213 // CLookupMapTileDatabase::ReSetEntryL() |
|
214 // Reset the entry with null value and get the used maptile path as part of aLookupItem. |
|
215 // ----------------------------------------------------------------------------- |
|
216 // |
|
217 void CLookupMapTileDatabase::ReSetEntryL(TLookupItem &aLookupItem) |
|
218 { |
|
219 TFileName queryBuffer; |
|
220 queryBuffer.Format(KQueryToDB, aLookupItem.iUid, aLookupItem.iSource); |
|
221 TInt ret = Open(); |
|
222 if (ret != KErrNone) |
|
223 { |
|
224 Close(); |
|
225 Open(); |
|
226 |
|
227 } |
|
228 iItemsDatabase.Begin(); |
|
229 |
|
230 // Create a view of the table based on the query created. |
|
231 RDbView myView; |
|
232 myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer)); |
|
233 CleanupClosePushL(myView); |
|
234 |
|
235 myView.EvaluateAll(); |
|
236 myView.FirstL(); |
|
237 |
|
238 if (myView.AtRow()) |
|
239 { |
|
240 myView.GetL(); |
|
241 aLookupItem.iFilePath.Copy(myView.ColDes16(KColumnFilePath)); |
|
242 // found the entry. update it. |
|
243 myView.UpdateL(); |
|
244 myView.SetColL(KColumnFilePath, KNullDesC); |
|
245 myView.SetColL(KColumnMapTileFetchingStatus, |
|
246 aLookupItem.iFetchingStatus); //MK |
|
247 myView.PutL(); |
|
248 } |
|
249 |
|
250 CleanupStack::PopAndDestroy(&myView); // myView |
|
251 iItemsDatabase.Commit(); |
|
252 |
|
253 Close(); |
|
254 } |
|
255 // ----------------------------------------------------------------------------- |
213 // CLookupMapTileDatabase::UpdateEntryL() |
256 // CLookupMapTileDatabase::UpdateEntryL() |
214 // Updates an entry in the lookup table. |
257 // Updates an entry in the lookup table. |
215 // ----------------------------------------------------------------------------- |
258 // ----------------------------------------------------------------------------- |
216 // |
259 // |
217 void CLookupMapTileDatabase::UpdateEntryL(const TLookupItem& aLookupItem) |
260 void CLookupMapTileDatabase::UpdateEntryL(const TLookupItem& aLookupItem) |
233 myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer)); |
276 myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer)); |
234 CleanupClosePushL(myView); |
277 CleanupClosePushL(myView); |
235 |
278 |
236 myView.EvaluateAll(); |
279 myView.EvaluateAll(); |
237 myView.FirstL(); |
280 myView.FirstL(); |
238 |
281 |
239 if (myView.AtRow()) |
282 if (myView.AtRow()) |
240 { |
283 { |
241 // found the entry. update it. |
284 // found the entry. update it. |
242 myView.UpdateL(); |
285 myView.UpdateL(); |
243 myView.SetColL(KColumnFilePath, aLookupItem.iFilePath); |
286 myView.SetColL(KColumnFilePath, aLookupItem.iFilePath); |
244 myView.SetColL(KColumnMapTileFetchingStatus, aLookupItem.iFetchingStatus); //MK |
287 myView.SetColL(KColumnMapTileFetchingStatus, aLookupItem.iFetchingStatus); //MK |
245 myView.PutL(); |
288 myView.PutL(); |
246 } |
289 } |
247 |
290 |
248 CleanupStack::PopAndDestroy(&myView); // myView |
291 CleanupStack::PopAndDestroy(&myView); // myView |
249 iItemsDatabase.Commit(); |
292 iItemsDatabase.Commit(); |
250 |
293 |
251 Close(); |
294 Close(); |
252 |
295 |
253 } |
296 } |
254 |
297 |
255 // ----------------------------------------------------------------------------- |
298 // ----------------------------------------------------------------------------- |
256 // CLookupMapTileDatabase::DeleteEntryL() |
299 // CLookupMapTileDatabase::DeleteEntryL() |