supl/locationsuplfw/settingsapi/src/epos_csettingsdatabasehandler.cpp
branchRCL_3
changeset 21 6b6920c56e2f
parent 20 2b4ea9893b66
--- a/supl/locationsuplfw/settingsapi/src/epos_csettingsdatabasehandler.cpp	Tue Aug 31 15:37:04 2010 +0300
+++ b/supl/locationsuplfw/settingsapi/src/epos_csettingsdatabasehandler.cpp	Wed Sep 01 12:24:21 2010 +0100
@@ -54,7 +54,6 @@
 const TInt KSimChangeRemove = 32;
 const TInt KUsageInHomeNw = 64;
 const TInt KEditable = 128;
-const TInt KProductConfigured= 256;
 
 //values used to set and retrieve major and minor version numbers from a single int
 const TInt KVersionMinorMask = 255;
@@ -127,7 +126,6 @@
 _LIT(KColRequestType,"RequestType");
 _LIT(KColOutstandingTrigger,"OutstandingTrigger");      
 _LIT(KColInterval,"Interval");
-_LIT(KColEndTime,"EndTime");
 
 _LIT(KColServerId,"ServerId");
 _LIT(KColIap1,"Iap1");
@@ -156,16 +154,18 @@
 // ---------------------------------------------------------------------------
 CSettingsDatabaseHandler::~CSettingsDatabaseHandler()
     {
-				delete iSettingsRep;
-				iSettingsRep = NULL;
-				
-				delete iSettingsNotifierRep;
-				iSettingsNotifierRep = NULL;
-				
-				Close();
-				
-				LogQuery(_L("Deleted Settings DB Handle CLosed"));
-				
+    if(iSettingsRep)
+        {
+        delete iSettingsRep;
+        iSettingsRep = NULL;
+        }    
+    if(iSettingsNotifierRep)
+        {
+        delete iSettingsNotifierRep;
+        iSettingsNotifierRep = NULL;
+        }
+    iDb.Close();
+    LogQuery(_L("Deleted Settings DB Handle CLosed"));
     }
 
 // ---------------------------------------------------------------------------
@@ -273,6 +273,18 @@
     }
  
 // ---------------------------------------------------------------------------
+// CSettingsDatabaseHandler::RemoveDb()
+//
+// 
+// ---------------------------------------------------------------------------
+TInt CSettingsDatabaseHandler::RemoveDb()
+    {
+    Close();
+   // iDbs.DeleteDatabase(KWordDatabase,KSecureUid);
+    return KErrNone;
+    }
+
+// ---------------------------------------------------------------------------
 // CSettingsDatabaseHandler::Close()
 //
 // Close the database.
@@ -438,11 +450,10 @@
     
     TInt32  netInfoLastUse = 0;
     TInt32  netInfoLastSucess = 0;
-    TBool   serverEnabled,simChangeRemove,usageInHomeNw,editable,prodConfig;
+    TBool   serverEnabled,simChangeRemove,usageInHomeNw,editable;
     
-    TInt ret = aServParamValues->Get(slpId,SLPAddress->Des(),IAPName->Des(),serverEnabled,simChangeRemove,usageInHomeNw,editable);
-    					 aServParamValues->GetServerConfigurationType(prodConfig); 
-    
+    TInt ret = 0;
+    ret = aServParamValues->Get(slpId,SLPAddress->Des(),IAPName->Des(),serverEnabled,simChangeRemove,usageInHomeNw,editable);
     if(ret == KErrNotFound)
         {
         CleanupStack::PopAndDestroy(3); //SLPAddress,IAPName,manuName
@@ -504,10 +515,6 @@
         {
         OtherProperties |= KEditable;
         }
-    if(prodConfig)
-        {
-        OtherProperties |= KProductConfigured;
-        }
     
     TBuf<KMaxHSLPAddrLen> tempBuf;
     TBuf<KMaxIAPLen> tempIapBuf;
@@ -842,8 +849,10 @@
     
     HBufC* IAPName = HBufC::NewLC( KMaxIAPLen);
     TBool  serverEnabled,simChangeRemove,usageInHomeNw,editable;
-    
-    TInt ret = aParamValues->Get(slpId,SLPAddress->Des(),IAPName->Des(),serverEnabled,simChangeRemove,usageInHomeNw,editable);
+
+
+    TInt ret = 0;
+    ret = aParamValues->Get(slpId,SLPAddress->Des(),IAPName->Des(),serverEnabled,simChangeRemove,usageInHomeNw,editable);
     if(ret == KErrNotFound || slpId == -1 )
         {
         CleanupStack::PopAndDestroy(2); //SLPAddress,IAPName
@@ -899,9 +908,7 @@
          {
          OtherProperties &= ~KEditable;
          }
-     //product configuration flag is not altered here since it should not be modified while updation
-     //and gets set only during addition of a new server through product configuration
-     
+
      TBuf<KGenericStringLen> tempBuf;
      tempBuf.Copy(*SLPAddress);
      tempBuf.Trim();
@@ -1149,9 +1156,7 @@
         {
         OtherProperties &= ~KEditable;
         }
-    //product configuration flag is not altered here since it should not be modified while updation
-    //and gets modified only during addition of a new server
-    
+
     TBuf<KGenericStringLen> tempBuf;
     tempBuf.Copy(*SLPAddress);
     tempBuf.Trim();
@@ -1686,7 +1691,7 @@
     TBool simChangeRemove = EFalse;
     TBool usageInHomeNw = EFalse;
     TBool editable = EFalse;
-    TBool prodConfig = ETrue;
+
 
     TInt columnIndexSLPID = stmt.ColumnIndex(KColSLPId);
     TInt columnIndexSLPAddress = stmt.ColumnIndex(KColSLPAddress);
@@ -1696,7 +1701,6 @@
     while((err=stmt.Next())==KSqlAtRow)
         {
         CServerParams *params = CServerParams::NewL();
-        CleanupStack::PushL(params);
         SLPId = stmt.ColumnInt(columnIndexSLPID);
         stmt.ColumnText(columnIndexSLPAddress,ServerAddress);
               
@@ -1711,12 +1715,8 @@
         simChangeRemove = otherprops & KSimChangeRemove; 
         usageInHomeNw = otherprops & KUsageInHomeNw; 
         editable = otherprops & KEditable;
-        prodConfig = otherprops & KProductConfigured;
         params->Set(ServerAddress,Iap,serverEnabled,simChangeRemove,usageInHomeNw,editable,SLPId);
-        params->SetServerConfigurationType(prodConfig);
-        
-        aParamValues.AppendL(params);//ownership transferred to RPointerArray
-        CleanupStack::Pop(params);
+        aParamValues.Append(params);//ownership transferred to RPointerArray
         }   
 
     stmt.Close();
@@ -1759,7 +1759,7 @@
     TBool simChangeRemove = EFalse;
     TBool usageInHomeNw = EFalse;
     TBool editable = EFalse;
-    TBool prodConfig = ETrue;
+
 
     TInt columnIndexSLPID = stmt.ColumnIndex(KColSLPId);
     TInt columnIndexSLPAddress = stmt.ColumnIndex(KColSLPAddress);
@@ -1769,7 +1769,6 @@
     while((err=stmt.Next())==KSqlAtRow)
         {
         CServerParams *params = CServerParams::NewL();
-        CleanupStack::PushL(params);
         SLPId = stmt.ColumnInt(columnIndexSLPID);
         stmt.ColumnText(columnIndexSLPAddress,ServerAddress);
               
@@ -1784,11 +1783,8 @@
         simChangeRemove = otherprops & KSimChangeRemove; 
         usageInHomeNw = otherprops & KUsageInHomeNw; 
         editable = otherprops & KEditable;
-        prodConfig = otherprops & KProductConfigured;
         params->Set(ServerAddress,Iap,serverEnabled,simChangeRemove,usageInHomeNw,editable,SLPId);
-        params->SetServerConfigurationType(prodConfig);
-        aParamValues.AppendL(params);//ownership transferred to RPointerArray
-        CleanupStack::Pop(params);
+        aParamValues.Append(params);//ownership transferred to RPointerArray
         }   
 
     stmt.Close();
@@ -2076,7 +2072,6 @@
     TBool simChangeRemove = EFalse;
     TBool usageInHomeNw = EFalse;
     TBool editable = EFalse;
-    TBool prodConfig = ETrue;
     
     TInt columnIndexSLPID = stmt.ColumnIndex(KColSLPId);
     TInt columnIndexSLPAddress = stmt.ColumnIndex(KColSLPAddress);
@@ -2098,7 +2093,6 @@
         simChangeRemove = otherprops & KSimChangeRemove;
         usageInHomeNw = otherprops & KUsageInHomeNw;
         editable = otherprops & KEditable;
-        prodConfig = otherprops & KProductConfigured;
         //logging
         otherpropbuf.Zero();
         otherpropbuf.AppendNum(otherprops);
@@ -2110,8 +2104,6 @@
     stmt.Close();
     
     aParamValues->Set(serverAddress,Iap,serverEnabled,simChangeRemove,usageInHomeNw,editable,SLPId);
-    aParamValues->SetServerConfigurationType(prodConfig);
-    
     return KErrNone;
     }
 // --------------------------------------------------------------------------------------
@@ -2154,7 +2146,6 @@
     TBool simChangeRemove = EFalse;
     TBool usageInHomeNw = EFalse;
     TBool editable = EFalse;
-    TBool prodConfig = ETrue;
     
     TInt columnIndexSLPID = stmt.ColumnIndex(KColSLPId);
     TInt columnIndexSLPAddress = stmt.ColumnIndex(KColSLPAddress);
@@ -2176,7 +2167,6 @@
         simChangeRemove = otherprops & KSimChangeRemove;
         usageInHomeNw = otherprops & KUsageInHomeNw;
         editable = otherprops & KEditable;
-        prodConfig = otherprops & KProductConfigured;
         //logging
         otherpropbuf.Zero();
         otherpropbuf.AppendNum(otherprops);
@@ -2192,7 +2182,6 @@
         return KErrNotFound;
     
     aParamValues->Set(serverAddress,Iap,serverEnabled,simChangeRemove,usageInHomeNw,editable,SLPId);
-    aParamValues->SetServerConfigurationType(prodConfig);
     return KErrNone;
     }
 // ------------------------------------------------------------------------------------
@@ -2229,8 +2218,7 @@
     TBool simChangeRemove = EFalse;
     TBool usageInHomeNw = EFalse;
     TBool editable = EFalse;
-    TBool prodConfig = ETrue;
-    
+
     TInt columnIndexSLPID = stmt.ColumnIndex(KColSLPId);
     TInt columnIndexSLPAddress = stmt.ColumnIndex(KColSLPAddress);
     TInt columnIndexIAP = stmt.ColumnIndex(KColIap);
@@ -2248,7 +2236,6 @@
         simChangeRemove = otherprops & KSimChangeRemove;
         usageInHomeNw = otherprops & KUsageInHomeNw;
         editable = otherprops & KEditable;
-        prodConfig = otherprops & KProductConfigured;
         //logging
         otherpropbuf.Zero();
         otherpropbuf.AppendNum(otherprops);
@@ -2265,7 +2252,6 @@
     stmt.Close();
 
     aParamValues->Set(serverAddress,Iap,serverEnabled,simChangeRemove,usageInHomeNw,editable,SLPId);
-    aParamValues->SetServerConfigurationType(prodConfig);
     return KErrNone;
     }
 // ---------------------------------------------------------------------------
@@ -2560,7 +2546,7 @@
         {
         SLPId = stmt.ColumnInt64(columnIndexSLPID);
         if(SLPId != aSlpId)
-            slpIndexArray.AppendL(stmt.ColumnInt64(columnIndexSLPID));
+            slpIndexArray.Append(stmt.ColumnInt64(columnIndexSLPID));
         }
     stmt.Reset(); 
     stmt.Close();
@@ -2731,7 +2717,7 @@
         {
         SLPId = stmt.ColumnInt64(columnIndexSLPID);
         if(SLPId != aSlpId)
-            slpIndexArray.AppendL(stmt.ColumnInt64(columnIndexSLPID));
+            slpIndexArray.Append(stmt.ColumnInt64(columnIndexSLPID));
         }
     stmt.Reset(); 
     stmt.Close();
@@ -2811,7 +2797,7 @@
     //Get all slp ids currently in the database
     while((err=stmt.Next())==KSqlAtRow)
         {
-        slpIdArray.AppendL(stmt.ColumnInt64(columnIndexSLPID));
+        slpIdArray.Append(stmt.ColumnInt64(columnIndexSLPID));
         }
     stmt.Reset();
     
@@ -2928,11 +2914,6 @@
 
     iSQLString.Append(KColInterval);
     iSQLString.Append(KDataTypeInteger);
-    iSQLString.Append(KCommaSeparator);
-    
-    iSQLString.Append(KColEndTime);
-    iSQLString.Append(KDataTypeInteger);
-        
     iSQLString.Append(KClosingBracket);
     
     TInt err = iDb.Exec(iSQLString);
@@ -2964,14 +2945,10 @@
     CTriggerParams::TRequestType requestType;
     TUint64 outstandingTrigger;
     TUint64 interval;
-    TTime endTime;
+    
     TInt ret = aSessionParamValues->Get(sessionId,sessionName->Des(),notificationPresent,triggerNotificationStatus,
                              triggerType,requestType,outstandingTrigger,interval );
-                             
-         aSessionParamValues->GetTriggerEndTime(endTime);
          
-    TInt64 endTimeInt;
-    endTimeInt = endTime.Int64();
     if(ret == KErrNotFound)
         {
         delete sessionName;
@@ -3004,10 +2981,6 @@
     iSQLString.Append(KCommaSeparator); 
 
     iSQLString.Append(KColInterval);
-    iSQLString.Append(KCommaSeparator);
-    
-    iSQLString.Append(KColEndTime);
-    
     iSQLString.Append(KClosingBracket);
     
     iSQLString.Append(KValues);
@@ -3038,10 +3011,7 @@
     iSQLString.Append(KCommaSeparator);
     
     iSQLString.AppendNum(interval);
-    iSQLString.Append(KCommaSeparator);
-    
-    iSQLString.AppendNum(endTimeInt);
-    
+          
     iSQLString.Append(KClosingBracket);
 
     delete sessionName;   
@@ -3193,9 +3163,7 @@
     TUint64 outstandingTrigger;
     TUint64 interval;
     TBuf<KGenericStringLen> sessionName;
-    TTime endTime;
-    TInt64 endTimeInt;
-        
+    
     TInt columnIndexSessionID = stmt.ColumnIndex(KColSessionId);
     TInt columnIndexSessionName = stmt.ColumnIndex(KColSessionName);
     TInt columnIndexNotificationPresent = stmt.ColumnIndex(KColNotificationPresent);
@@ -3204,14 +3172,12 @@
     TInt columnIndexRequestType = stmt.ColumnIndex(KColRequestType);
     TInt columnIndexOutstandingTrigger = stmt.ColumnIndex(KColOutstandingTrigger);
     TInt columnIndexInterval = stmt.ColumnIndex(KColInterval);
-    TInt columnIndexEndTime = stmt.ColumnIndex(KColEndTime);
 
     // Reset client array
     aParamValues.Reset();
     while((err=stmt.Next())==KSqlAtRow)
         {
         CTriggerParams *params = CTriggerParams::NewL();
-        CleanupStack::PushL(params);
         sessionId = stmt.ColumnInt(columnIndexSessionID);
         stmt.ColumnText(columnIndexSessionName,sessionName);
         notificationPresent = stmt.ColumnInt(columnIndexNotificationPresent);
@@ -3220,12 +3186,9 @@
         requestType = (CTriggerParams::TRequestType) stmt.ColumnInt(columnIndexRequestType);
         outstandingTrigger = stmt.ColumnInt(columnIndexOutstandingTrigger);
         interval = stmt.ColumnInt(columnIndexInterval);
-        endTimeInt = stmt.ColumnInt64(columnIndexEndTime);
-        endTime = endTimeInt;
+        
         params->Set(sessionId,sessionName,notificationPresent,triggerNotificationStatus,triggerType,requestType,outstandingTrigger,interval);
-				params->SetTriggerEndTime(endTime);        
-        aParamValues.AppendL(params);//ownership transferred to RPointerArray
-        CleanupStack::Pop(params);
+        aParamValues.Append(params);//ownership transferred to RPointerArray
         }   
 
     stmt.Close();
@@ -3274,9 +3237,6 @@
     TUint64 outstandingTrigger;
     TUint64 interval;
     TBuf<KGenericStringLen> sessionName;
-    TTime endTime;
-    TInt64 endTimeInt;
-    
         
     TInt columnIndexSessionID = stmt.ColumnIndex(KColSessionId);
     TInt columnIndexSessionName = stmt.ColumnIndex(KColSessionName);
@@ -3286,8 +3246,6 @@
     TInt columnIndexRequestType = stmt.ColumnIndex(KColRequestType);
     TInt columnIndexOutstandingTrigger = stmt.ColumnIndex(KColOutstandingTrigger);
     TInt columnIndexInterval = stmt.ColumnIndex(KColInterval);
-    TInt columnIndexEndTime = stmt.ColumnIndex(KColEndTime);
-    
     while((err=stmt.Next())==KSqlAtRow)
         {
         sessionId = stmt.ColumnInt(columnIndexSessionID);
@@ -3298,10 +3256,8 @@
         requestType = (CTriggerParams::TRequestType) stmt.ColumnInt(columnIndexRequestType);
         outstandingTrigger = stmt.ColumnInt(columnIndexOutstandingTrigger);
         interval = stmt.ColumnInt(columnIndexInterval);
-        endTimeInt = stmt.ColumnInt64(columnIndexEndTime);
-        endTime = endTimeInt;
+                
         aParamValues->Set(sessionId,sessionName,notificationPresent,triggerNotificationStatus,triggerType,requestType,outstandingTrigger,interval);
-        aParamValues->SetTriggerEndTime(endTime);
         }   
 
     stmt.Close();