omaprovisioning/provisioning/ProvisioningEngine/Src/CWPInternetAPDB.cpp
changeset 63 e0c1916b8ddc
parent 0 b497e44ab2fc
child 62 19bba8228ff0
equal deleted inserted replaced
57:f5b689a4f7a2 63:e0c1916b8ddc
   239     FLOG( _L( "[Provisioning] CWPInternetAPDB::ReadItemsL" ) );
   239     FLOG( _L( "[Provisioning] CWPInternetAPDB::ReadItemsL" ) );
   240     RDbView Myview;
   240     RDbView Myview;
   241     Myview.Prepare(iItemsDatabase, TDbQuery(QueryBuffer));
   241     Myview.Prepare(iItemsDatabase, TDbQuery(QueryBuffer));
   242     CleanupClosePushL(Myview);
   242     CleanupClosePushL(Myview);
   243     Myview.EvaluateAll();
   243     Myview.EvaluateAll();
   244     Myview.FirstL();
   244     if ( Myview.FirstL())
   245 
   245     {
   246     while (Myview.AtRow())
   246     	while (Myview.AtRow())
   247         {
   247         {
   248         Myview.GetL();
   248         Myview.GetL();
   249 
   249 
   250         TAccessPointItem AccessPointItem;
   250         TAccessPointItem AccessPointItem;
   251         AccessPointItem.iIndex = Myview.ColInt(1);
   251         AccessPointItem.iIndex = Myview.ColInt(1);
   254         AccessPointItem.iOriginator.Copy(Myview.ColDes(4));
   254         AccessPointItem.iOriginator.Copy(Myview.ColDes(4));
   255 
   255 
   256         aItemArray.Append(AccessPointItem);
   256         aItemArray.Append(AccessPointItem);
   257         Myview.NextL();
   257         Myview.NextL();
   258         }
   258         }
       
   259     }
   259 
   260 
   260     CleanupStack::PopAndDestroy(); // Myview
   261     CleanupStack::PopAndDestroy(); // Myview
   261     FLOG( _L( "[Provisioning] CWPInternetAPDB::ReadItemsL: done" ) );
   262     FLOG( _L( "[Provisioning] CWPInternetAPDB::ReadItemsL: done" ) );
   262     }
   263     }
   263 
   264 
   321     // query buffer with index finds only the selected item row.
   322     // query buffer with index finds only the selected item row.
   322     Myview.Prepare(iItemsDatabase, TDbQuery(QueryBuffer));
   323     Myview.Prepare(iItemsDatabase, TDbQuery(QueryBuffer));
   323     CleanupClosePushL(Myview);
   324     CleanupClosePushL(Myview);
   324 
   325 
   325     Myview.EvaluateAll();
   326     Myview.EvaluateAll();
   326     Myview.FirstL();
   327     if( Myview.FirstL())
   327 
   328     {
   328     if (!Myview.IsEmptyL())
   329     	if (!Myview.IsEmptyL())
   329         {
   330         {
   330         // we have autoincrement in index so it should be unique
   331         // we have autoincrement in index so it should be unique
   331         // but just to make sure, we use 'while', instead of 'if'
   332         // but just to make sure, we use 'while', instead of 'if'
   332         while (Myview.AtRow())
   333         while (Myview.AtRow())
   333             {
   334             {
   339         iItemsDatabase.Commit();
   340         iItemsDatabase.Commit();
   340         // compacts the databse, by physically removig deleted data.
   341         // compacts the databse, by physically removig deleted data.
   341         iItemsDatabase.Compact();
   342         iItemsDatabase.Compact();
   342         rowsdeleted = ETrue;
   343         rowsdeleted = ETrue;
   343         }
   344         }
       
   345     }
   344     CleanupStack::PopAndDestroy(1); // Myview
   346     CleanupStack::PopAndDestroy(1); // Myview
   345 
   347 
   346     FLOG( _L( "[Provisioning] CWPInternetAPDB::DeleteFromDatabaseL: done" ) );
   348     FLOG( _L( "[Provisioning] CWPInternetAPDB::DeleteFromDatabaseL: done" ) );
   347     return rowsdeleted;
   349     return rowsdeleted;
   348     }
   350     }