16 */ |
16 */ |
17 #include <QString> |
17 #include <QString> |
18 #include <QFile> |
18 #include <QFile> |
19 |
19 |
20 #include <bautils.h> |
20 #include <bautils.h> |
|
21 #include <locationservicedefines.h> |
21 #include "mylocationlogger.h" |
22 #include "mylocationlogger.h" |
22 #include "lookupmaptiledb.h" |
23 #include "lookupmaptiledb.h" |
23 |
24 |
24 _LIT( KSelectAllFrom, "SELECT * FROM " ); |
25 _LIT( KSelectAllFrom, "SELECT * FROM " ); |
25 _LIT(KQueryToDB,"SELECT * FROM cntmaptilelookuptable WHERE cntuid = %d AND source = %d"); |
26 _LIT(KQueryToDB,"SELECT * FROM cntmaptilelookuptable WHERE cntuid = %d AND source = %d"); |
|
27 _LIT(KQueryGetCalendaIds,"SELECT cntuid FROM cntmaptilelookuptable WHERE source = %d"); |
26 _LIT( KSelectfilepathFrom, "SELECT filepath FROM " ); |
28 _LIT( KSelectfilepathFrom, "SELECT filepath FROM " ); |
27 _LIT(KQueryMaptile, "SELECT filepath FROM cntmaptilelookuptable WHERE filepath = '%S'"); |
29 _LIT(KQueryMaptile, "SELECT filepath FROM cntmaptilelookuptable WHERE filepath = '%S'"); |
28 // string 'where' |
30 // string 'where' |
29 _LIT( KStringWhere, " WHERE " ); |
31 _LIT( KStringWhere, " WHERE " ); |
30 // string ' = ' |
32 // string ' = ' |
454 |
456 |
455 CleanupStack::PopAndDestroy(&myView); // myView |
457 CleanupStack::PopAndDestroy(&myView); // myView |
456 } |
458 } |
457 |
459 |
458 // ----------------------------------------------------------------------------- |
460 // ----------------------------------------------------------------------------- |
|
461 // CLookupMapTileDatabase::GetAllCalendarIdsL() |
|
462 // Gets the list of calendar ids . |
|
463 // ----------------------------------------------------------------------------- |
|
464 // |
|
465 void CLookupMapTileDatabase::GetAllCalendarIdsL( RArray<TUint32>& aIdArray ) |
|
466 { |
|
467 __TRACE_CALLSTACK;// Create a query to find the item. |
|
468 TFileName queryBuffer; |
|
469 queryBuffer.Format( KQueryGetCalendaIds, ESourceCalendar ); |
|
470 |
|
471 TInt ret = Open(); |
|
472 if (ret != KErrNone) |
|
473 { |
|
474 Close(); |
|
475 ret= Open(); |
|
476 |
|
477 } |
|
478 iItemsDatabase.Begin(); |
|
479 |
|
480 |
|
481 // Create a view of the table with the above query. |
|
482 RDbView myView; |
|
483 myView.Prepare( iItemsDatabase, TDbQuery( queryBuffer ) ); |
|
484 CleanupClosePushL( myView ); |
|
485 myView.EvaluateAll(); |
|
486 myView.FirstL(); |
|
487 |
|
488 while( myView.AtRow() ) |
|
489 { |
|
490 // Item found. get the details. |
|
491 myView.GetL(); |
|
492 TUint32 id; |
|
493 id = myView.ColUint( KColumnUid ); |
|
494 aIdArray.Append( id ); |
|
495 myView.NextL(); |
|
496 } |
|
497 |
|
498 CleanupStack::PopAndDestroy( &myView ); // myView |
|
499 } |
|
500 |
|
501 // ----------------------------------------------------------------------------- |
459 // CLookupMapTileDatabase::FindEntryL() |
502 // CLookupMapTileDatabase::FindEntryL() |
460 // Finds an entry in the lookup table. |
503 // Finds an entry in the lookup table. |
461 // ----------------------------------------------------------------------------- |
504 // ----------------------------------------------------------------------------- |
462 // |
505 // |
463 TBool CLookupMapTileDatabase::FindEntryL(TLookupItem& aLookupItem) |
506 TBool CLookupMapTileDatabase::FindEntryL(TLookupItem& aLookupItem) |