locationdataharvester/mylocationsengine/src/lookupmaptiledb.cpp
changeset 35 59575560d1e6
parent 31 8db05346071b
child 38 793f76d9ab0c
--- a/locationdataharvester/mylocationsengine/src/lookupmaptiledb.cpp	Tue Jul 06 14:10:28 2010 +0300
+++ b/locationdataharvester/mylocationsengine/src/lookupmaptiledb.cpp	Wed Aug 18 09:43:18 2010 +0300
@@ -18,11 +18,13 @@
 #include <QFile>
 
 #include <bautils.h>
+#include <locationservicedefines.h>
 #include "mylocationlogger.h"
 #include "lookupmaptiledb.h"
 
 _LIT( KSelectAllFrom, "SELECT * FROM " );
 _LIT(KQueryToDB,"SELECT * FROM cntmaptilelookuptable WHERE cntuid = %d AND source = %d");
+_LIT(KQueryGetCalendaIds,"SELECT cntuid FROM cntmaptilelookuptable WHERE source = %d");
 _LIT( KSelectfilepathFrom, "SELECT filepath FROM " );
 _LIT(KQueryMaptile, "SELECT filepath FROM cntmaptilelookuptable WHERE filepath = '%S'");
 // string 'where'
@@ -456,6 +458,47 @@
 }
 
 // -----------------------------------------------------------------------------
+// CLookupMapTileDatabase::GetAllCalendarIdsL()
+// Gets the list of calendar ids .
+// -----------------------------------------------------------------------------
+//
+void CLookupMapTileDatabase::GetAllCalendarIdsL( RArray<TUint32>& aIdArray )
+{
+    __TRACE_CALLSTACK;// Create a query to find the item.
+    TFileName queryBuffer;
+    queryBuffer.Format( KQueryGetCalendaIds, ESourceCalendar );
+    
+    TInt ret = Open();
+        if (ret != KErrNone)
+        {
+           Close();
+           ret= Open();
+           
+        }
+    iItemsDatabase.Begin();
+
+    
+    // Create a view of the table with the above query.
+    RDbView myView;
+    myView.Prepare( iItemsDatabase, TDbQuery( queryBuffer ) );
+    CleanupClosePushL( myView );
+    myView.EvaluateAll();
+    myView.FirstL();
+
+    while( myView.AtRow() )
+    {
+        // Item found. get the details.
+        myView.GetL();
+        TUint32 id;
+        id = myView.ColUint( KColumnUid );
+        aIdArray.Append( id );
+        myView.NextL();
+    }
+
+    CleanupStack::PopAndDestroy( &myView ); // myView
+}
+
+// -----------------------------------------------------------------------------
 // CLookupMapTileDatabase::FindEntryL()
 // Finds an entry in the lookup table.
 // -----------------------------------------------------------------------------