locationdataharvester/mylocationsengine/src/lookupmaptiledb.cpp
branchRCL_3
changeset 17 1fc85118c3ae
equal deleted inserted replaced
16:8173571d354e 17:1fc85118c3ae
       
     1 /*
       
     2 * Copyright (c) 2010 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: Maptile database lookup table source implementation.
       
    15 *
       
    16 */
       
    17 #include <QString>
       
    18 #include <QFile>
       
    19 
       
    20 #include <bautils.h>
       
    21 #include <locationservicedefines.h>
       
    22 #include "mylocationlogger.h"
       
    23 #include "lookupmaptiledb.h"
       
    24 
       
    25 _LIT( KSelectAllFrom, "SELECT * FROM " );
       
    26 _LIT(KQueryToDB,"SELECT * FROM cntmaptilelookuptable WHERE cntuid = %d AND source = %d");
       
    27 _LIT(KQueryGetCalendaIds,"SELECT cntuid FROM cntmaptilelookuptable WHERE source = %d");
       
    28 _LIT( KSelectfilepathFrom, "SELECT filepath FROM " );
       
    29 _LIT(KQueryMaptile, "SELECT filepath FROM cntmaptilelookuptable WHERE filepath = '%S'");
       
    30 // string 'where'
       
    31 _LIT( KStringWhere, " WHERE " );
       
    32 // string ' = '
       
    33 _LIT( KStringEqual, " = " );
       
    34 
       
    35 _LIT(KQueryByMaptileFetchingState,"SELECT * FROM cntmaptilelookuptable WHERE fetchingstatus = %d");
       
    36 
       
    37 // -----------------------------------------------------------------------------
       
    38 // CLookupMapTileDatabase::CLookupMapTileDatabase()
       
    39 // Default constructor.
       
    40 // -----------------------------------------------------------------------------
       
    41 //
       
    42 CLookupMapTileDatabase::CLookupMapTileDatabase()
       
    43 {
       
    44 }
       
    45 
       
    46 // -----------------------------------------------------------------------------
       
    47 // CLookupMapTileDatabase::~CLookupMapTileDatabase()
       
    48 // Destructor.
       
    49 // -----------------------------------------------------------------------------
       
    50 //
       
    51 CLookupMapTileDatabase::~CLookupMapTileDatabase()
       
    52 {
       
    53     __TRACE_CALLSTACK;// close the database
       
    54     iItemsDatabase.Close();
       
    55     // close the file session
       
    56     iFsSession.Close();
       
    57 }
       
    58 
       
    59 // -----------------------------------------------------------------------------
       
    60 // CLookupMapTileDatabase::~CLookupMapTileDatabase()
       
    61 // Creates an object of this class and pushes to cleanup stack.
       
    62 // -----------------------------------------------------------------------------
       
    63 //
       
    64 CLookupMapTileDatabase* CLookupMapTileDatabase::NewLC(
       
    65         const TDesC& aLookupTableName)
       
    66 {
       
    67     CLookupMapTileDatabase* self = new (ELeave) CLookupMapTileDatabase;
       
    68     CleanupStack::PushL(self);
       
    69     self->ConstructL(aLookupTableName);
       
    70     return self;
       
    71 }
       
    72 
       
    73 // -----------------------------------------------------------------------------
       
    74 // CLookupMapTileDatabase::NewL()
       
    75 // Creates an object of this class.
       
    76 // -----------------------------------------------------------------------------
       
    77 //
       
    78 CLookupMapTileDatabase* CLookupMapTileDatabase::NewL(
       
    79         const TDesC& aLookupTableName)
       
    80 {
       
    81     CLookupMapTileDatabase* self = CLookupMapTileDatabase::NewLC(
       
    82             aLookupTableName);
       
    83     CleanupStack::Pop(self);
       
    84     return self;
       
    85 }
       
    86 
       
    87 // -----------------------------------------------------------------------------
       
    88 // CLookupMapTileDatabase::ConstructL()
       
    89 // 2nd phase contructor.
       
    90 // -----------------------------------------------------------------------------
       
    91 //
       
    92 void CLookupMapTileDatabase::ConstructL(const TDesC& aLookupTableName)
       
    93 {
       
    94     __TRACE_CALLSTACK;
       
    95     User::LeaveIfError(iFsSession.Connect());
       
    96 
       
    97     //create private path
       
    98     User::LeaveIfError(iFsSession.CreatePrivatePath(RFs::GetSystemDrive()));
       
    99     // private path with no drive on it
       
   100     iFsSession.PrivatePath(iDbFileName);
       
   101 
       
   102     TFindFile PrivFolder(iFsSession);
       
   103     // find out the drive
       
   104     if (KErrNone == PrivFolder.FindByDir(iDbFileName, KNullDesC))
       
   105     {
       
   106         iFsSession.MkDir(KLookupDbPath);
       
   107         iDbFileName.Copy(KLookupDbPath);
       
   108         iDbFileName.Append(aLookupTableName);
       
   109 
       
   110         if (!BaflUtils::FileExists(iFsSession, iDbFileName))
       
   111         { // no database exists so we make one
       
   112             User::LeaveIfError(iItemsDatabase.Create(iFsSession, iDbFileName));
       
   113             // and will create the only table needed for it
       
   114             CreateTableL(iItemsDatabase);
       
   115 
       
   116             //close the database
       
   117             iItemsDatabase.Close();
       
   118         }        
       
   119     }
       
   120 }
       
   121 
       
   122 // -----------------------------------------------------------------------------
       
   123 // CLookupMapTileDatabase::Open()
       
   124 // Opens the lookup database.
       
   125 // -----------------------------------------------------------------------------
       
   126 //
       
   127 TInt CLookupMapTileDatabase::Open()
       
   128 {
       
   129     __TRACE_CALLSTACK;
       
   130     return iItemsDatabase.Open(iFsSession, iDbFileName);
       
   131 }
       
   132 
       
   133 // -----------------------------------------------------------------------------
       
   134 // CLookupMapTileDatabase::Close()
       
   135 // Closes the lookup database.
       
   136 // -----------------------------------------------------------------------------
       
   137 //
       
   138 void CLookupMapTileDatabase::Close()
       
   139 {
       
   140     __TRACE_CALLSTACK;
       
   141     iItemsDatabase.Close();
       
   142 }
       
   143 
       
   144 // -----------------------------------------------------------------------------
       
   145 // CLookupMapTileDatabase::CreateTableL()
       
   146 // Creates a lookup table.
       
   147 // -----------------------------------------------------------------------------
       
   148 //
       
   149 void CLookupMapTileDatabase::CreateTableL(RDbDatabase& aDatabase)
       
   150 {
       
   151     __TRACE_CALLSTACK;// Create a table definition
       
   152     CDbColSet* columns = CDbColSet::NewLC();
       
   153 
       
   154     // Add Columns
       
   155 
       
   156     // Add uid column
       
   157     columns->AddL(TDbCol(NCntColUid, EDbColUint32));
       
   158 
       
   159     columns->AddL(TDbCol(NColSource, EDbColUint32));
       
   160 
       
   161     // add file path type column
       
   162     columns->AddL(TDbCol(NCntColFilePath, EDbColText16));
       
   163     
       
   164     //MK 
       
   165     // add map tile fetching status to the db
       
   166     columns->AddL(TDbCol(MapTileFetchingStatus, EDbColUint32));
       
   167     
       
   168 
       
   169     // Create a table
       
   170     User::LeaveIfError(aDatabase.CreateTable(KMapTileLookupTable, *columns));
       
   171 
       
   172     // cleanup the column set
       
   173     CleanupStack::PopAndDestroy(columns);
       
   174 }
       
   175 
       
   176 // -----------------------------------------------------------------------------
       
   177 // CLookupMapTileDatabase::CreateEntryL()
       
   178 // Creates an entry in the lookup table.
       
   179 // -----------------------------------------------------------------------------
       
   180 //
       
   181 void CLookupMapTileDatabase::CreateEntryL(const TLookupItem& aLookupItem)
       
   182 {
       
   183     __TRACE_CALLSTACK;// create a query for the view
       
   184     TFileName queryBuffer;
       
   185     queryBuffer.Copy(KSelectAllFrom);
       
   186     queryBuffer.Append(KMapTileLookupTable);
       
   187 
       
   188     TInt ret = Open();
       
   189     if (ret != KErrNone)
       
   190     {
       
   191 		Close();
       
   192         ret = Open();
       
   193         if( ret != KErrNone )
       
   194             return;
       
   195        
       
   196     }
       
   197 	 iItemsDatabase.Begin();
       
   198     
       
   199     RDbView myView;
       
   200     myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
       
   201     CleanupClosePushL(myView);
       
   202 
       
   203     // Inert the item
       
   204     myView.InsertL();
       
   205     // set the fields
       
   206     myView.SetColL(KColumncntUid, aLookupItem.iUid);
       
   207     myView.SetColL(KColumnSource, aLookupItem.iSource);
       
   208     myView.SetColL(KColumnFilePath, aLookupItem.iFilePath);
       
   209     myView.SetColL(KColumnMapTileFetchingStatus, aLookupItem.iFetchingStatus); //MK
       
   210 
       
   211     myView.PutL();
       
   212 
       
   213     CleanupStack::PopAndDestroy(&myView); // myView
       
   214     iItemsDatabase.Commit();
       
   215     Close();
       
   216 }
       
   217 
       
   218 // -----------------------------------------------------------------------------
       
   219 // CLookupMapTileDatabase::ReSetEntryL()
       
   220 // Reset the entry with null value and get the used maptile path as part of aLookupItem.
       
   221 // -----------------------------------------------------------------------------
       
   222 //
       
   223 void CLookupMapTileDatabase::ReSetEntryL(TLookupItem &aLookupItem)
       
   224 {
       
   225     TFileName queryBuffer;
       
   226     queryBuffer.Format(KQueryToDB, aLookupItem.iUid, aLookupItem.iSource);
       
   227     TInt ret = Open();
       
   228     if (ret != KErrNone)
       
   229     {
       
   230         Close();
       
   231         ret = Open();
       
   232         if( ret != KErrNone )
       
   233             return;
       
   234     }
       
   235     iItemsDatabase.Begin();
       
   236 
       
   237     // Create a view of the table based on the query created.
       
   238     RDbView myView;
       
   239     myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
       
   240     CleanupClosePushL(myView);
       
   241 
       
   242     myView.EvaluateAll();
       
   243     myView.FirstL();
       
   244 
       
   245     if (myView.AtRow())
       
   246     {
       
   247         myView.GetL();
       
   248         aLookupItem.iFilePath.Copy(myView.ColDes16(KColumnFilePath));
       
   249         // found the entry. update it.
       
   250         myView.UpdateL();
       
   251         myView.SetColL(KColumnFilePath, KNullDesC);
       
   252         myView.SetColL(KColumnMapTileFetchingStatus,
       
   253                 aLookupItem.iFetchingStatus); //MK
       
   254         myView.PutL();
       
   255     }
       
   256 
       
   257     CleanupStack::PopAndDestroy(&myView); // myView
       
   258     iItemsDatabase.Commit();
       
   259 
       
   260     Close();
       
   261 }
       
   262 // -----------------------------------------------------------------------------
       
   263 // CLookupMapTileDatabase::UpdateEntryL()
       
   264 // Updates an entry in the lookup table.
       
   265 // -----------------------------------------------------------------------------
       
   266 //
       
   267 void CLookupMapTileDatabase::UpdateEntryL(const TLookupItem& aLookupItem)
       
   268 {
       
   269     __TRACE_CALLSTACK;// Create the query to find the row to be updated.
       
   270     TFileName queryBuffer;
       
   271     queryBuffer.Format(KQueryToDB, aLookupItem.iUid, aLookupItem.iSource);
       
   272     TInt ret = Open();
       
   273     if (ret != KErrNone)
       
   274     {
       
   275 		Close();
       
   276         ret = Open();
       
   277         if( ret != KErrNone )
       
   278             return;       
       
   279     }
       
   280 	 iItemsDatabase.Begin();
       
   281 
       
   282     // Create a view of the table based on the query created.
       
   283     RDbView myView;
       
   284     myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
       
   285     CleanupClosePushL(myView);
       
   286 
       
   287     myView.EvaluateAll();
       
   288     myView.FirstL();
       
   289     
       
   290     if (myView.AtRow())
       
   291     {
       
   292         // found the entry. update it.
       
   293         myView.UpdateL();
       
   294         myView.SetColL(KColumnFilePath, aLookupItem.iFilePath);
       
   295         myView.SetColL(KColumnMapTileFetchingStatus, aLookupItem.iFetchingStatus); //MK
       
   296         myView.PutL();
       
   297     } 
       
   298 
       
   299     CleanupStack::PopAndDestroy(&myView); // myView
       
   300     iItemsDatabase.Commit();
       
   301 
       
   302     Close();  
       
   303 
       
   304 }
       
   305 
       
   306 // -----------------------------------------------------------------------------
       
   307 // CLookupMapTileDatabase::DeleteEntryL()
       
   308 // Deletes an entry from the lookup table.
       
   309 // -----------------------------------------------------------------------------
       
   310 //
       
   311 void CLookupMapTileDatabase::DeleteEntryL(TLookupItem& aLookupItem)
       
   312 {
       
   313     __TRACE_CALLSTACK;// Create the query to find the row to be deleted.
       
   314 
       
   315     TFileName queryBuffer;
       
   316     queryBuffer.Format(KQueryToDB, aLookupItem.iUid, aLookupItem.iSource);
       
   317 
       
   318     TInt ret = Open();
       
   319     if (ret != KErrNone)
       
   320     {
       
   321 		Close();
       
   322         ret = Open();
       
   323         if( ret != KErrNone )
       
   324             return;
       
   325     }
       
   326 	 iItemsDatabase.Begin();
       
   327 
       
   328     RDbView myView;
       
   329     // query buffer finds only the selected item row.
       
   330     myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
       
   331     CleanupClosePushL(myView);
       
   332 
       
   333     myView.EvaluateAll();
       
   334 
       
   335     // positions the cursor on the first row of the rowset
       
   336     myView.FirstL();
       
   337 
       
   338     // Delete the entry found.
       
   339     if (myView.AtRow())
       
   340     {
       
   341         myView.GetL();
       
   342         if (aLookupItem.iUid == myView.ColUint(KColumncntUid))
       
   343         {
       
   344             aLookupItem.iFilePath.Copy(myView.ColDes16(KColumnFilePath));
       
   345             
       
   346         }
       
   347         myView.DeleteL();
       
   348     }
       
   349 
       
   350     CleanupStack::PopAndDestroy(&myView); // myView
       
   351     iItemsDatabase.Commit();
       
   352     // compacts the databse, by physicaly removing deleted data.
       
   353     iItemsDatabase.Compact();
       
   354 
       
   355     Close();
       
   356 }
       
   357 
       
   358 // -----------------------------------------------------------------------------
       
   359 // CLookupMapTileDatabase::DeleteMapTileL()
       
   360 // Deletes an maptile if there's no reference to maptile in lookupdb
       
   361 // -----------------------------------------------------------------------------
       
   362 //
       
   363 void CLookupMapTileDatabase::DeleteMapTileL( const TLookupItem& aLookupItem)
       
   364 {
       
   365     __TRACE_CALLSTACK;// Create the query to find the row to be deleted.
       
   366 
       
   367     TFileName queryBuffer;    
       
   368     queryBuffer.Format(KQueryMaptile, &aLookupItem.iFilePath);
       
   369     
       
   370     TInt ret = Open();
       
   371     if (ret != KErrNone)
       
   372     {
       
   373        Close();
       
   374        ret = Open();
       
   375        if( ret != KErrNone )
       
   376            return;
       
   377     }
       
   378     
       
   379     iItemsDatabase.Begin();
       
   380 
       
   381     RDbView myView;
       
   382     // query buffer finds only the selected item row.
       
   383     myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
       
   384     CleanupClosePushL(myView);
       
   385 
       
   386     myView.EvaluateAll();
       
   387 
       
   388     // positions the cursor on the first row of the rowset
       
   389     myView.FirstL();
       
   390 
       
   391     // Delete if no reference to maptile
       
   392     if (!myView.AtRow())
       
   393     {
       
   394         QString filePath =  QString::fromUtf16( aLookupItem.iFilePath.Ptr(), aLookupItem.iFilePath.Length() );
       
   395         //delete all releted  maptile 
       
   396         QString temp=filePath;
       
   397         temp.append(MAPTILE_IMAGE_PORTRAIT);       
       
   398         QFile file;
       
   399         file.remove(temp);
       
   400         
       
   401         temp=filePath;
       
   402         temp.append(MAPTILE_IMAGE_CONTACT);
       
   403         temp.append(MAPTILE_IMAGE_LANDSCAPE);
       
   404         file.remove(temp);
       
   405         
       
   406         temp=filePath;
       
   407         temp.append(MAPTILE_IMAGE_CALENDAR);
       
   408         temp.append(MAPTILE_IMAGE_LANDSCAPE);
       
   409         file.remove(temp);
       
   410         
       
   411         temp=filePath;
       
   412         temp.append(MAPTILE_IMAGE_HURRIGANES);         
       
   413         file.remove(temp);
       
   414          
       
   415        // ret = iFsSession.Delete(aLookupItem.iFilePath);     
       
   416     }
       
   417         
       
   418     CleanupStack::PopAndDestroy(&myView); // myView
       
   419 
       
   420     Close();
       
   421 }
       
   422 
       
   423 
       
   424 // -----------------------------------------------------------------------------
       
   425 // CLookupMapTileDatabase::FindEntriesByMapTileFetchingStatusL()
       
   426 // Finds a list of lookup items given a landmark uid.
       
   427 // -----------------------------------------------------------------------------
       
   428 //
       
   429 void CLookupMapTileDatabase::FindEntriesByMapTileFetchingStateL(const TUint32 aFetchingState,
       
   430         RArray<TLookupItem>& aLookupItemArray)
       
   431 {
       
   432     __TRACE_CALLSTACK;// Create a query to find the item.
       
   433     TFileName queryBuffer;
       
   434     queryBuffer.Format(KQueryByMaptileFetchingState,aFetchingState);
       
   435     
       
   436     TInt ret = Open();
       
   437         if (ret != KErrNone)
       
   438         {
       
   439            Close();
       
   440            ret = Open();
       
   441            if( ret != KErrNone )
       
   442                return;
       
   443         }
       
   444       iItemsDatabase.Begin();
       
   445 
       
   446     
       
   447     // Create a view of the table with the above query.
       
   448     RDbView myView;
       
   449     myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
       
   450     CleanupClosePushL(myView);
       
   451     myView.EvaluateAll();
       
   452     myView.FirstL();
       
   453 
       
   454     while (myView.AtRow())
       
   455     {
       
   456         // Item found. get the details.
       
   457         myView.GetL();
       
   458         TLookupItem newItem;
       
   459         newItem.iUid = myView.ColUint(KColumnUid);
       
   460         newItem.iSource = myView.ColUint(KColumnSource);
       
   461         aLookupItemArray.Append(newItem);
       
   462         myView.NextL();
       
   463     }
       
   464 
       
   465     CleanupStack::PopAndDestroy(&myView); // myView
       
   466 }
       
   467 
       
   468 // -----------------------------------------------------------------------------
       
   469 // CLookupMapTileDatabase::GetAllCalendarIdsL()
       
   470 // Gets the list of calendar ids .
       
   471 // -----------------------------------------------------------------------------
       
   472 //
       
   473 void CLookupMapTileDatabase::GetAllCalendarIdsL( RArray<TUint32>& aIdArray )
       
   474 {
       
   475     __TRACE_CALLSTACK;// Create a query to find the item.
       
   476     TFileName queryBuffer;
       
   477     queryBuffer.Format( KQueryGetCalendaIds, ESourceCalendar );
       
   478     
       
   479     TInt ret = Open();
       
   480         if (ret != KErrNone)
       
   481         {
       
   482            Close();
       
   483            ret = Open();
       
   484            if( ret != KErrNone )
       
   485                return;
       
   486         }
       
   487     iItemsDatabase.Begin();
       
   488 
       
   489     
       
   490     // Create a view of the table with the above query.
       
   491     RDbView myView;
       
   492     myView.Prepare( iItemsDatabase, TDbQuery( queryBuffer ) );
       
   493     CleanupClosePushL( myView );
       
   494     myView.EvaluateAll();
       
   495     myView.FirstL();
       
   496 
       
   497     while( myView.AtRow() )
       
   498     {
       
   499         // Item found. get the details.
       
   500         myView.GetL();
       
   501         TUint32 id;
       
   502         id = myView.ColUint( KColumnUid );
       
   503         aIdArray.Append( id );
       
   504         myView.NextL();
       
   505     }
       
   506 
       
   507     CleanupStack::PopAndDestroy( &myView ); // myView
       
   508     Close();
       
   509 }
       
   510 
       
   511 // -----------------------------------------------------------------------------
       
   512 // CLookupMapTileDatabase::FindEntryL()
       
   513 // Finds an entry in the lookup table.
       
   514 // -----------------------------------------------------------------------------
       
   515 //
       
   516 TBool CLookupMapTileDatabase::FindEntryL(TLookupItem& aLookupItem)
       
   517 {
       
   518     __TRACE_CALLSTACK;// used to store return value
       
   519     TBool retVal = EFalse;
       
   520     // Create a query to find the item.
       
   521     TFileName queryBuffer;
       
   522     queryBuffer.Format(KQueryToDB, aLookupItem.iUid, aLookupItem.iSource);
       
   523 
       
   524    TInt ret = Open();
       
   525     if (ret != KErrNone)
       
   526     {
       
   527 		Close();
       
   528         ret = Open();
       
   529         if( ret != KErrNone )
       
   530             return EFalse;
       
   531        
       
   532     }
       
   533 	 iItemsDatabase.Begin();
       
   534 
       
   535     // Create a view of the table with the above query.
       
   536     RDbView myView;
       
   537     myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
       
   538     CleanupClosePushL(myView);
       
   539     myView.EvaluateAll();
       
   540     myView.FirstL();
       
   541 
       
   542     if (myView.AtRow())
       
   543     {
       
   544         // Item found. get the details.
       
   545         myView.GetL();
       
   546         retVal = ETrue;
       
   547     }
       
   548 
       
   549     CleanupStack::PopAndDestroy(&myView); // myView
       
   550     Close();
       
   551     return retVal;
       
   552 }
       
   553 
       
   554 // -----------------------------------------------------------------------------
       
   555 // CLookupMapTileDatabase::FindEntryByFIlePathLL()
       
   556 // Finds an entry in the lookup table for maptile image file
       
   557 // -----------------------------------------------------------------------------
       
   558 //
       
   559 TBool CLookupMapTileDatabase::FindEntryByFilePathL(const TDesC& aFilePath)
       
   560 {
       
   561     __TRACE_CALLSTACK;// used to store return value
       
   562     TBool retVal = EFalse;
       
   563    
       
   564     TInt ret = Open();
       
   565     if (ret != KErrNone)
       
   566     {
       
   567         Close();
       
   568         ret = Open();
       
   569         if( ret != KErrNone )
       
   570             return EFalse;       
       
   571     }
       
   572     
       
   573     iItemsDatabase.Begin();
       
   574     
       
   575     // Create a query to find the item.
       
   576     TFileName queryBuffer;
       
   577     _LIT(KFormatSpec, "%S%S%S%S%S'%S'");
       
   578     
       
   579     queryBuffer.Format(KFormatSpec, 
       
   580         &KSelectfilepathFrom(), 
       
   581         &KMapTileLookupTable(),
       
   582         &KStringWhere(),
       
   583         &NCntColFilePath(),
       
   584         &KStringEqual(),
       
   585         &aFilePath);
       
   586     
       
   587     // Create a view of the table with the above query.
       
   588     RDbView myView;
       
   589     TInt retPrep = myView.Prepare(iItemsDatabase, TDbQuery(queryBuffer));
       
   590     CleanupClosePushL(myView);
       
   591     myView.EvaluateAll();
       
   592     myView.FirstL();
       
   593 
       
   594     if (myView.AtRow())
       
   595     {
       
   596         // Item found, return true
       
   597         retVal = ETrue;
       
   598     }
       
   599 
       
   600     CleanupStack::PopAndDestroy(&myView); // myView
       
   601     Close();
       
   602 
       
   603     return retVal;
       
   604 }
       
   605 
       
   606 // End of file
       
   607