supl/locationsuplfw/settingsapi/src/epos_csettingsdatabasehandler.cpp
changeset 22 4c4ed41530db
parent 18 3825cf2dc8c2
child 39 3efc7a0e8755
equal deleted inserted replaced
20:82ee1f804b63 22:4c4ed41530db
    52 const TInt KPskTlsUsed = 4;
    52 const TInt KPskTlsUsed = 4;
    53 const TInt KServerEnabled = 8;
    53 const TInt KServerEnabled = 8;
    54 const TInt KSimChangeRemove = 32;
    54 const TInt KSimChangeRemove = 32;
    55 const TInt KUsageInHomeNw = 64;
    55 const TInt KUsageInHomeNw = 64;
    56 const TInt KEditable = 128;
    56 const TInt KEditable = 128;
       
    57 const TInt KProductConfigured= 256;
    57 
    58 
    58 //values used to set and retrieve major and minor version numbers from a single int
    59 //values used to set and retrieve major and minor version numbers from a single int
    59 const TInt KVersionMinorMask = 255;
    60 const TInt KVersionMinorMask = 255;
    60 const TInt KVersionMajorMask = 8;
    61 const TInt KVersionMajorMask = 8;
    61 
    62 
   124 _LIT(KColTriggerNotificationStatus, "NotificationStatus");
   125 _LIT(KColTriggerNotificationStatus, "NotificationStatus");
   125 _LIT(KColTriggerType,"TriggerType");
   126 _LIT(KColTriggerType,"TriggerType");
   126 _LIT(KColRequestType,"RequestType");
   127 _LIT(KColRequestType,"RequestType");
   127 _LIT(KColOutstandingTrigger,"OutstandingTrigger");      
   128 _LIT(KColOutstandingTrigger,"OutstandingTrigger");      
   128 _LIT(KColInterval,"Interval");
   129 _LIT(KColInterval,"Interval");
       
   130 _LIT(KColEndTime,"EndTime");
   129 
   131 
   130 _LIT(KColServerId,"ServerId");
   132 _LIT(KColServerId,"ServerId");
   131 _LIT(KColIap1,"Iap1");
   133 _LIT(KColIap1,"Iap1");
   132 _LIT(KColIap2,"Iap2");
   134 _LIT(KColIap2,"Iap2");
   133 _LIT(KColServerAddress,"ServerAddress");
   135 _LIT(KColServerAddress,"ServerAddress");
   152 //
   154 //
   153 // Destructor method
   155 // Destructor method
   154 // ---------------------------------------------------------------------------
   156 // ---------------------------------------------------------------------------
   155 CSettingsDatabaseHandler::~CSettingsDatabaseHandler()
   157 CSettingsDatabaseHandler::~CSettingsDatabaseHandler()
   156     {
   158     {
   157     if(iSettingsRep)
   159 				delete iSettingsRep;
   158         {
   160 				iSettingsRep = NULL;
   159         delete iSettingsRep;
   161 				
   160         iSettingsRep = NULL;
   162 				delete iSettingsNotifierRep;
   161         }    
   163 				iSettingsNotifierRep = NULL;
   162     if(iSettingsNotifierRep)
   164 				
   163         {
   165 				Close();
   164         delete iSettingsNotifierRep;
   166 				
   165         iSettingsNotifierRep = NULL;
   167 				LogQuery(_L("Deleted Settings DB Handle CLosed"));
   166         }
   168 				
   167     iDb.Close();
       
   168     LogQuery(_L("Deleted Settings DB Handle CLosed"));
       
   169     }
   169     }
   170 
   170 
   171 // ---------------------------------------------------------------------------
   171 // ---------------------------------------------------------------------------
   172 // CSettingsDatabaseHandler::ConstructL()
   172 // CSettingsDatabaseHandler::ConstructL()
   173 //
   173 //
   271     PrintErrorMessage(dbPath,err,3);
   271     PrintErrorMessage(dbPath,err,3);
   272     User::LeaveIfError(err);
   272     User::LeaveIfError(err);
   273     }
   273     }
   274  
   274  
   275 // ---------------------------------------------------------------------------
   275 // ---------------------------------------------------------------------------
   276 // CSettingsDatabaseHandler::RemoveDb()
       
   277 //
       
   278 // 
       
   279 // ---------------------------------------------------------------------------
       
   280 TInt CSettingsDatabaseHandler::RemoveDb()
       
   281     {
       
   282     Close();
       
   283    // iDbs.DeleteDatabase(KWordDatabase,KSecureUid);
       
   284     return KErrNone;
       
   285     }
       
   286 
       
   287 // ---------------------------------------------------------------------------
       
   288 // CSettingsDatabaseHandler::Close()
   276 // CSettingsDatabaseHandler::Close()
   289 //
   277 //
   290 // Close the database.
   278 // Close the database.
   291 // ---------------------------------------------------------------------------
   279 // ---------------------------------------------------------------------------
   292 TInt CSettingsDatabaseHandler::Close()
   280 TInt CSettingsDatabaseHandler::Close()
   448     TTime  timeLastUse;
   436     TTime  timeLastUse;
   449     TTime  timeLastTried;
   437     TTime  timeLastTried;
   450     
   438     
   451     TInt32  netInfoLastUse = 0;
   439     TInt32  netInfoLastUse = 0;
   452     TInt32  netInfoLastSucess = 0;
   440     TInt32  netInfoLastSucess = 0;
   453     TBool   serverEnabled,simChangeRemove,usageInHomeNw,editable;
   441     TBool   serverEnabled,simChangeRemove,usageInHomeNw,editable,prodConfig;
   454     
   442     
   455     TInt ret = 0;
   443     TInt ret = aServParamValues->Get(slpId,SLPAddress->Des(),IAPName->Des(),serverEnabled,simChangeRemove,usageInHomeNw,editable);
   456     ret = aServParamValues->Get(slpId,SLPAddress->Des(),IAPName->Des(),serverEnabled,simChangeRemove,usageInHomeNw,editable);
   444     					 aServParamValues->GetServerConfigurationType(prodConfig); 
       
   445     
   457     if(ret == KErrNotFound)
   446     if(ret == KErrNotFound)
   458         {
   447         {
   459         CleanupStack::PopAndDestroy(3); //SLPAddress,IAPName,manuName
   448         CleanupStack::PopAndDestroy(3); //SLPAddress,IAPName,manuName
   460         aSlpId = -1;
   449         aSlpId = -1;
   461         PrintErrorMessage(_L(""),KErrNotFound,8);
   450         PrintErrorMessage(_L(""),KErrNotFound,8);
   512         OtherProperties |= KUsageInHomeNw;
   501         OtherProperties |= KUsageInHomeNw;
   513         }
   502         }
   514     if(editable)
   503     if(editable)
   515         {
   504         {
   516         OtherProperties |= KEditable;
   505         OtherProperties |= KEditable;
       
   506         }
       
   507     if(prodConfig)
       
   508         {
       
   509         OtherProperties |= KProductConfigured;
   517         }
   510         }
   518     
   511     
   519     TBuf<KMaxHSLPAddrLen> tempBuf;
   512     TBuf<KMaxHSLPAddrLen> tempBuf;
   520     TBuf<KMaxIAPLen> tempIapBuf;
   513     TBuf<KMaxIAPLen> tempIapBuf;
   521     tempBuf.Copy(*SLPAddress);
   514     tempBuf.Copy(*SLPAddress);
   847     TInt64 slpId;
   840     TInt64 slpId;
   848     HBufC* SLPAddress = HBufC::NewLC( KMaxHSLPAddrLen);
   841     HBufC* SLPAddress = HBufC::NewLC( KMaxHSLPAddrLen);
   849     
   842     
   850     HBufC* IAPName = HBufC::NewLC( KMaxIAPLen);
   843     HBufC* IAPName = HBufC::NewLC( KMaxIAPLen);
   851     TBool  serverEnabled,simChangeRemove,usageInHomeNw,editable;
   844     TBool  serverEnabled,simChangeRemove,usageInHomeNw,editable;
   852 
   845     
   853 
   846     TInt ret = aParamValues->Get(slpId,SLPAddress->Des(),IAPName->Des(),serverEnabled,simChangeRemove,usageInHomeNw,editable);
   854     TInt ret = 0;
       
   855     ret = aParamValues->Get(slpId,SLPAddress->Des(),IAPName->Des(),serverEnabled,simChangeRemove,usageInHomeNw,editable);
       
   856     if(ret == KErrNotFound || slpId == -1 )
   847     if(ret == KErrNotFound || slpId == -1 )
   857         {
   848         {
   858         CleanupStack::PopAndDestroy(2); //SLPAddress,IAPName
   849         CleanupStack::PopAndDestroy(2); //SLPAddress,IAPName
   859         PrintErrorMessage(_L(""),KErrArgument,9);
   850         PrintErrorMessage(_L(""),KErrArgument,9);
   860         User::Leave(KErrArgument); 
   851         User::Leave(KErrArgument); 
   906          }
   897          }
   907      else
   898      else
   908          {
   899          {
   909          OtherProperties &= ~KEditable;
   900          OtherProperties &= ~KEditable;
   910          }
   901          }
   911 
   902      //product configuration flag is not altered here since it should not be modified while updation
       
   903      //and gets set only during addition of a new server through product configuration
       
   904      
   912      TBuf<KGenericStringLen> tempBuf;
   905      TBuf<KGenericStringLen> tempBuf;
   913      tempBuf.Copy(*SLPAddress);
   906      tempBuf.Copy(*SLPAddress);
   914      tempBuf.Trim();
   907      tempBuf.Trim();
   915     iSQLString.Copy(KUpdateRecord);
   908     iSQLString.Copy(KUpdateRecord);
   916     iSQLString.Append(KCreateTableName);
   909     iSQLString.Append(KCreateTableName);
  1154         }
  1147         }
  1155     else
  1148     else
  1156         {
  1149         {
  1157         OtherProperties &= ~KEditable;
  1150         OtherProperties &= ~KEditable;
  1158         }
  1151         }
  1159 
  1152     //product configuration flag is not altered here since it should not be modified while updation
       
  1153     //and gets modified only during addition of a new server
       
  1154     
  1160     TBuf<KGenericStringLen> tempBuf;
  1155     TBuf<KGenericStringLen> tempBuf;
  1161     tempBuf.Copy(*SLPAddress);
  1156     tempBuf.Copy(*SLPAddress);
  1162     tempBuf.Trim();
  1157     tempBuf.Trim();
  1163     iSQLString.Copy(KUpdateRecord);
  1158     iSQLString.Copy(KUpdateRecord);
  1164     iSQLString.Append(KCreateTableName);
  1159     iSQLString.Append(KCreateTableName);
  1689     
  1684     
  1690     TBool serverEnabled = EFalse;
  1685     TBool serverEnabled = EFalse;
  1691     TBool simChangeRemove = EFalse;
  1686     TBool simChangeRemove = EFalse;
  1692     TBool usageInHomeNw = EFalse;
  1687     TBool usageInHomeNw = EFalse;
  1693     TBool editable = EFalse;
  1688     TBool editable = EFalse;
  1694 
  1689     TBool prodConfig = ETrue;
  1695 
  1690 
  1696     TInt columnIndexSLPID = stmt.ColumnIndex(KColSLPId);
  1691     TInt columnIndexSLPID = stmt.ColumnIndex(KColSLPId);
  1697     TInt columnIndexSLPAddress = stmt.ColumnIndex(KColSLPAddress);
  1692     TInt columnIndexSLPAddress = stmt.ColumnIndex(KColSLPAddress);
  1698     TInt columnIndexIAP = stmt.ColumnIndex(KColIap);
  1693     TInt columnIndexIAP = stmt.ColumnIndex(KColIap);
  1699     TInt columnIndexOtherProperties = stmt.ColumnIndex(KColOtherProperties);
  1694     TInt columnIndexOtherProperties = stmt.ColumnIndex(KColOtherProperties);
  1713         LogQuery(otherpropbuf);
  1708         LogQuery(otherpropbuf);
  1714         serverEnabled = otherprops & KServerEnabled;
  1709         serverEnabled = otherprops & KServerEnabled;
  1715         simChangeRemove = otherprops & KSimChangeRemove; 
  1710         simChangeRemove = otherprops & KSimChangeRemove; 
  1716         usageInHomeNw = otherprops & KUsageInHomeNw; 
  1711         usageInHomeNw = otherprops & KUsageInHomeNw; 
  1717         editable = otherprops & KEditable;
  1712         editable = otherprops & KEditable;
       
  1713         prodConfig = otherprops & KProductConfigured;
  1718         params->Set(ServerAddress,Iap,serverEnabled,simChangeRemove,usageInHomeNw,editable,SLPId);
  1714         params->Set(ServerAddress,Iap,serverEnabled,simChangeRemove,usageInHomeNw,editable,SLPId);
       
  1715         params->SetServerConfigurationType(prodConfig);
       
  1716         
  1719         aParamValues.Append(params);//ownership transferred to RPointerArray
  1717         aParamValues.Append(params);//ownership transferred to RPointerArray
  1720         }   
  1718         }   
  1721 
  1719 
  1722     stmt.Close();
  1720     stmt.Close();
  1723     LogAllSLP();
  1721     LogAllSLP();
  1757     
  1755     
  1758     TBool serverEnabled = EFalse;
  1756     TBool serverEnabled = EFalse;
  1759     TBool simChangeRemove = EFalse;
  1757     TBool simChangeRemove = EFalse;
  1760     TBool usageInHomeNw = EFalse;
  1758     TBool usageInHomeNw = EFalse;
  1761     TBool editable = EFalse;
  1759     TBool editable = EFalse;
  1762 
  1760     TBool prodConfig = ETrue;
  1763 
  1761 
  1764     TInt columnIndexSLPID = stmt.ColumnIndex(KColSLPId);
  1762     TInt columnIndexSLPID = stmt.ColumnIndex(KColSLPId);
  1765     TInt columnIndexSLPAddress = stmt.ColumnIndex(KColSLPAddress);
  1763     TInt columnIndexSLPAddress = stmt.ColumnIndex(KColSLPAddress);
  1766     TInt columnIndexIAP = stmt.ColumnIndex(KColIap);
  1764     TInt columnIndexIAP = stmt.ColumnIndex(KColIap);
  1767     TInt columnIndexOtherProperties = stmt.ColumnIndex(KColOtherProperties);
  1765     TInt columnIndexOtherProperties = stmt.ColumnIndex(KColOtherProperties);
  1781         LogQuery(otherpropbuf);
  1779         LogQuery(otherpropbuf);
  1782         serverEnabled = otherprops & KServerEnabled;
  1780         serverEnabled = otherprops & KServerEnabled;
  1783         simChangeRemove = otherprops & KSimChangeRemove; 
  1781         simChangeRemove = otherprops & KSimChangeRemove; 
  1784         usageInHomeNw = otherprops & KUsageInHomeNw; 
  1782         usageInHomeNw = otherprops & KUsageInHomeNw; 
  1785         editable = otherprops & KEditable;
  1783         editable = otherprops & KEditable;
       
  1784         prodConfig = otherprops & KProductConfigured;
  1786         params->Set(ServerAddress,Iap,serverEnabled,simChangeRemove,usageInHomeNw,editable,SLPId);
  1785         params->Set(ServerAddress,Iap,serverEnabled,simChangeRemove,usageInHomeNw,editable,SLPId);
       
  1786         params->SetServerConfigurationType(prodConfig);
  1787         aParamValues.Append(params);//ownership transferred to RPointerArray
  1787         aParamValues.Append(params);//ownership transferred to RPointerArray
  1788         }   
  1788         }   
  1789 
  1789 
  1790     stmt.Close();
  1790     stmt.Close();
  1791     LogAllSLP();
  1791     LogAllSLP();
  2070     
  2070     
  2071     TBool serverEnabled = EFalse;
  2071     TBool serverEnabled = EFalse;
  2072     TBool simChangeRemove = EFalse;
  2072     TBool simChangeRemove = EFalse;
  2073     TBool usageInHomeNw = EFalse;
  2073     TBool usageInHomeNw = EFalse;
  2074     TBool editable = EFalse;
  2074     TBool editable = EFalse;
       
  2075     TBool prodConfig = ETrue;
  2075     
  2076     
  2076     TInt columnIndexSLPID = stmt.ColumnIndex(KColSLPId);
  2077     TInt columnIndexSLPID = stmt.ColumnIndex(KColSLPId);
  2077     TInt columnIndexSLPAddress = stmt.ColumnIndex(KColSLPAddress);
  2078     TInt columnIndexSLPAddress = stmt.ColumnIndex(KColSLPAddress);
  2078     
  2079     
  2079     TInt columnIndexIAP = stmt.ColumnIndex(KColIap);
  2080     TInt columnIndexIAP = stmt.ColumnIndex(KColIap);
  2091         
  2092         
  2092         serverEnabled = otherprops & KServerEnabled;
  2093         serverEnabled = otherprops & KServerEnabled;
  2093         simChangeRemove = otherprops & KSimChangeRemove;
  2094         simChangeRemove = otherprops & KSimChangeRemove;
  2094         usageInHomeNw = otherprops & KUsageInHomeNw;
  2095         usageInHomeNw = otherprops & KUsageInHomeNw;
  2095         editable = otherprops & KEditable;
  2096         editable = otherprops & KEditable;
       
  2097         prodConfig = otherprops & KProductConfigured;
  2096         //logging
  2098         //logging
  2097         otherpropbuf.Zero();
  2099         otherpropbuf.Zero();
  2098         otherpropbuf.AppendNum(otherprops);
  2100         otherpropbuf.AppendNum(otherprops);
  2099         LogQuery(serverAddress);
  2101         LogQuery(serverAddress);
  2100         LogQuery(Iap)   ;     
  2102         LogQuery(Iap)   ;     
  2102         }   
  2104         }   
  2103 
  2105 
  2104     stmt.Close();
  2106     stmt.Close();
  2105     
  2107     
  2106     aParamValues->Set(serverAddress,Iap,serverEnabled,simChangeRemove,usageInHomeNw,editable,SLPId);
  2108     aParamValues->Set(serverAddress,Iap,serverEnabled,simChangeRemove,usageInHomeNw,editable,SLPId);
       
  2109     aParamValues->SetServerConfigurationType(prodConfig);
       
  2110     
  2107     return KErrNone;
  2111     return KErrNone;
  2108     }
  2112     }
  2109 // --------------------------------------------------------------------------------------
  2113 // --------------------------------------------------------------------------------------
  2110 // CSettingsDatabaseHandler::GetSlpInfoFromAddress()
  2114 // CSettingsDatabaseHandler::GetSlpInfoFromAddress()
  2111 //
  2115 //
  2144 
  2148 
  2145     TBool serverEnabled = EFalse;
  2149     TBool serverEnabled = EFalse;
  2146     TBool simChangeRemove = EFalse;
  2150     TBool simChangeRemove = EFalse;
  2147     TBool usageInHomeNw = EFalse;
  2151     TBool usageInHomeNw = EFalse;
  2148     TBool editable = EFalse;
  2152     TBool editable = EFalse;
       
  2153     TBool prodConfig = ETrue;
  2149     
  2154     
  2150     TInt columnIndexSLPID = stmt.ColumnIndex(KColSLPId);
  2155     TInt columnIndexSLPID = stmt.ColumnIndex(KColSLPId);
  2151     TInt columnIndexSLPAddress = stmt.ColumnIndex(KColSLPAddress);
  2156     TInt columnIndexSLPAddress = stmt.ColumnIndex(KColSLPAddress);
  2152     
  2157     
  2153     TInt columnIndexIAP = stmt.ColumnIndex(KColIap);
  2158     TInt columnIndexIAP = stmt.ColumnIndex(KColIap);
  2165         
  2170         
  2166         serverEnabled = otherprops & KServerEnabled;
  2171         serverEnabled = otherprops & KServerEnabled;
  2167         simChangeRemove = otherprops & KSimChangeRemove;
  2172         simChangeRemove = otherprops & KSimChangeRemove;
  2168         usageInHomeNw = otherprops & KUsageInHomeNw;
  2173         usageInHomeNw = otherprops & KUsageInHomeNw;
  2169         editable = otherprops & KEditable;
  2174         editable = otherprops & KEditable;
       
  2175         prodConfig = otherprops & KProductConfigured;
  2170         //logging
  2176         //logging
  2171         otherpropbuf.Zero();
  2177         otherpropbuf.Zero();
  2172         otherpropbuf.AppendNum(otherprops);
  2178         otherpropbuf.AppendNum(otherprops);
  2173         LogQuery(serverAddress);
  2179         LogQuery(serverAddress);
  2174         LogQuery(Iap);
  2180         LogQuery(Iap);
  2180     
  2186     
  2181     if(SLPId == -1)//we did not find any server by the slp id that was requested for
  2187     if(SLPId == -1)//we did not find any server by the slp id that was requested for
  2182         return KErrNotFound;
  2188         return KErrNotFound;
  2183     
  2189     
  2184     aParamValues->Set(serverAddress,Iap,serverEnabled,simChangeRemove,usageInHomeNw,editable,SLPId);
  2190     aParamValues->Set(serverAddress,Iap,serverEnabled,simChangeRemove,usageInHomeNw,editable,SLPId);
       
  2191     aParamValues->SetServerConfigurationType(prodConfig);
  2185     return KErrNone;
  2192     return KErrNone;
  2186     }
  2193     }
  2187 // ------------------------------------------------------------------------------------
  2194 // ------------------------------------------------------------------------------------
  2188 // CSettingsDatabaseHandler::GetDefaultServer()
  2195 // CSettingsDatabaseHandler::GetDefaultServer()
  2189 //
  2196 //
  2216     
  2223     
  2217     TBool serverEnabled = EFalse;
  2224     TBool serverEnabled = EFalse;
  2218     TBool simChangeRemove = EFalse;
  2225     TBool simChangeRemove = EFalse;
  2219     TBool usageInHomeNw = EFalse;
  2226     TBool usageInHomeNw = EFalse;
  2220     TBool editable = EFalse;
  2227     TBool editable = EFalse;
  2221 
  2228     TBool prodConfig = ETrue;
       
  2229     
  2222     TInt columnIndexSLPID = stmt.ColumnIndex(KColSLPId);
  2230     TInt columnIndexSLPID = stmt.ColumnIndex(KColSLPId);
  2223     TInt columnIndexSLPAddress = stmt.ColumnIndex(KColSLPAddress);
  2231     TInt columnIndexSLPAddress = stmt.ColumnIndex(KColSLPAddress);
  2224     TInt columnIndexIAP = stmt.ColumnIndex(KColIap);
  2232     TInt columnIndexIAP = stmt.ColumnIndex(KColIap);
  2225     TInt columnIndexOtherProperties = stmt.ColumnIndex(KColOtherProperties);
  2233     TInt columnIndexOtherProperties = stmt.ColumnIndex(KColOtherProperties);
  2226 
  2234 
  2234        
  2242        
  2235         serverEnabled = otherprops & KServerEnabled;
  2243         serverEnabled = otherprops & KServerEnabled;
  2236         simChangeRemove = otherprops & KSimChangeRemove;
  2244         simChangeRemove = otherprops & KSimChangeRemove;
  2237         usageInHomeNw = otherprops & KUsageInHomeNw;
  2245         usageInHomeNw = otherprops & KUsageInHomeNw;
  2238         editable = otherprops & KEditable;
  2246         editable = otherprops & KEditable;
       
  2247         prodConfig = otherprops & KProductConfigured;
  2239         //logging
  2248         //logging
  2240         otherpropbuf.Zero();
  2249         otherpropbuf.Zero();
  2241         otherpropbuf.AppendNum(otherprops);
  2250         otherpropbuf.AppendNum(otherprops);
  2242         LogQuery(serverAddress);
  2251         LogQuery(serverAddress);
  2243         LogQuery(Iap);
  2252         LogQuery(Iap);
  2250         return KErrNotFound;
  2259         return KErrNotFound;
  2251         }
  2260         }
  2252     stmt.Close();
  2261     stmt.Close();
  2253 
  2262 
  2254     aParamValues->Set(serverAddress,Iap,serverEnabled,simChangeRemove,usageInHomeNw,editable,SLPId);
  2263     aParamValues->Set(serverAddress,Iap,serverEnabled,simChangeRemove,usageInHomeNw,editable,SLPId);
       
  2264     aParamValues->SetServerConfigurationType(prodConfig);
  2255     return KErrNone;
  2265     return KErrNone;
  2256     }
  2266     }
  2257 // ---------------------------------------------------------------------------
  2267 // ---------------------------------------------------------------------------
  2258 // CSettingsDatabaseHandler::SlpCount()
  2268 // CSettingsDatabaseHandler::SlpCount()
  2259 //
  2269 //
  2912     iSQLString.Append(KDataTypeInteger);
  2922     iSQLString.Append(KDataTypeInteger);
  2913     iSQLString.Append(KCommaSeparator); 
  2923     iSQLString.Append(KCommaSeparator); 
  2914 
  2924 
  2915     iSQLString.Append(KColInterval);
  2925     iSQLString.Append(KColInterval);
  2916     iSQLString.Append(KDataTypeInteger);
  2926     iSQLString.Append(KDataTypeInteger);
       
  2927     iSQLString.Append(KCommaSeparator);
       
  2928     
       
  2929     iSQLString.Append(KColEndTime);
       
  2930     iSQLString.Append(KDataTypeInteger);
       
  2931         
  2917     iSQLString.Append(KClosingBracket);
  2932     iSQLString.Append(KClosingBracket);
  2918     
  2933     
  2919     TInt err = iDb.Exec(iSQLString);
  2934     TInt err = iDb.Exec(iSQLString);
  2920     
  2935     
  2921     PrintErrorMessage(iSQLString,err,1);                            
  2936     PrintErrorMessage(iSQLString,err,1);                            
  2943     TBool triggerNotificationStatus;
  2958     TBool triggerNotificationStatus;
  2944     CTriggerParams::TTriggerType triggerType;
  2959     CTriggerParams::TTriggerType triggerType;
  2945     CTriggerParams::TRequestType requestType;
  2960     CTriggerParams::TRequestType requestType;
  2946     TUint64 outstandingTrigger;
  2961     TUint64 outstandingTrigger;
  2947     TUint64 interval;
  2962     TUint64 interval;
  2948     
  2963     TTime endTime;
  2949     TInt ret = aSessionParamValues->Get(sessionId,sessionName->Des(),notificationPresent,triggerNotificationStatus,
  2964     TInt ret = aSessionParamValues->Get(sessionId,sessionName->Des(),notificationPresent,triggerNotificationStatus,
  2950                              triggerType,requestType,outstandingTrigger,interval );
  2965                              triggerType,requestType,outstandingTrigger,interval );
       
  2966                              
       
  2967          aSessionParamValues->GetTriggerEndTime(endTime);
  2951          
  2968          
       
  2969     TInt64 endTimeInt;
       
  2970     endTimeInt = endTime.Int64();
  2952     if(ret == KErrNotFound)
  2971     if(ret == KErrNotFound)
  2953         {
  2972         {
  2954         delete sessionName;
  2973         delete sessionName;
  2955         User::Leave(KErrGeneral);        
  2974         User::Leave(KErrGeneral);        
  2956         }
  2975         }
  2979         
  2998         
  2980     iSQLString.Append(KColOutstandingTrigger);
  2999     iSQLString.Append(KColOutstandingTrigger);
  2981     iSQLString.Append(KCommaSeparator); 
  3000     iSQLString.Append(KCommaSeparator); 
  2982 
  3001 
  2983     iSQLString.Append(KColInterval);
  3002     iSQLString.Append(KColInterval);
       
  3003     iSQLString.Append(KCommaSeparator);
       
  3004     
       
  3005     iSQLString.Append(KColEndTime);
       
  3006     
  2984     iSQLString.Append(KClosingBracket);
  3007     iSQLString.Append(KClosingBracket);
  2985     
  3008     
  2986     iSQLString.Append(KValues);
  3009     iSQLString.Append(KValues);
  2987 
  3010 
  2988     iSQLString.Append(KOpeningBracket);
  3011     iSQLString.Append(KOpeningBracket);
  3009     
  3032     
  3010     iSQLString.AppendNum(outstandingTrigger);
  3033     iSQLString.AppendNum(outstandingTrigger);
  3011     iSQLString.Append(KCommaSeparator);
  3034     iSQLString.Append(KCommaSeparator);
  3012     
  3035     
  3013     iSQLString.AppendNum(interval);
  3036     iSQLString.AppendNum(interval);
  3014           
  3037     iSQLString.Append(KCommaSeparator);
       
  3038     
       
  3039     iSQLString.AppendNum(endTimeInt);
       
  3040     
  3015     iSQLString.Append(KClosingBracket);
  3041     iSQLString.Append(KClosingBracket);
  3016 
  3042 
  3017     delete sessionName;   
  3043     delete sessionName;   
  3018     TInt err = iDb.Exec(_L("BEGIN")); 
  3044     TInt err = iDb.Exec(_L("BEGIN")); 
  3019     err = iDb.Exec(iSQLString);
  3045     err = iDb.Exec(iSQLString);
  3161     CTriggerParams::TTriggerType triggerType;
  3187     CTriggerParams::TTriggerType triggerType;
  3162     CTriggerParams::TRequestType requestType;
  3188     CTriggerParams::TRequestType requestType;
  3163     TUint64 outstandingTrigger;
  3189     TUint64 outstandingTrigger;
  3164     TUint64 interval;
  3190     TUint64 interval;
  3165     TBuf<KGenericStringLen> sessionName;
  3191     TBuf<KGenericStringLen> sessionName;
  3166     
  3192     TTime endTime;
       
  3193     TInt64 endTimeInt;
       
  3194         
  3167     TInt columnIndexSessionID = stmt.ColumnIndex(KColSessionId);
  3195     TInt columnIndexSessionID = stmt.ColumnIndex(KColSessionId);
  3168     TInt columnIndexSessionName = stmt.ColumnIndex(KColSessionName);
  3196     TInt columnIndexSessionName = stmt.ColumnIndex(KColSessionName);
  3169     TInt columnIndexNotificationPresent = stmt.ColumnIndex(KColNotificationPresent);
  3197     TInt columnIndexNotificationPresent = stmt.ColumnIndex(KColNotificationPresent);
  3170     TInt columnIndexTriggerNotificationStatus = stmt.ColumnIndex(KColTriggerNotificationStatus);
  3198     TInt columnIndexTriggerNotificationStatus = stmt.ColumnIndex(KColTriggerNotificationStatus);
  3171     TInt columnIndexTriggerType = stmt.ColumnIndex(KColTriggerType);
  3199     TInt columnIndexTriggerType = stmt.ColumnIndex(KColTriggerType);
  3172     TInt columnIndexRequestType = stmt.ColumnIndex(KColRequestType);
  3200     TInt columnIndexRequestType = stmt.ColumnIndex(KColRequestType);
  3173     TInt columnIndexOutstandingTrigger = stmt.ColumnIndex(KColOutstandingTrigger);
  3201     TInt columnIndexOutstandingTrigger = stmt.ColumnIndex(KColOutstandingTrigger);
  3174     TInt columnIndexInterval = stmt.ColumnIndex(KColInterval);
  3202     TInt columnIndexInterval = stmt.ColumnIndex(KColInterval);
       
  3203     TInt columnIndexEndTime = stmt.ColumnIndex(KColEndTime);
  3175 
  3204 
  3176     // Reset client array
  3205     // Reset client array
  3177     aParamValues.Reset();
  3206     aParamValues.Reset();
  3178     while((err=stmt.Next())==KSqlAtRow)
  3207     while((err=stmt.Next())==KSqlAtRow)
  3179         {
  3208         {
  3184         triggerNotificationStatus = stmt.ColumnInt(columnIndexTriggerNotificationStatus);
  3213         triggerNotificationStatus = stmt.ColumnInt(columnIndexTriggerNotificationStatus);
  3185         triggerType = (CTriggerParams::TTriggerType) stmt.ColumnInt(columnIndexTriggerType);
  3214         triggerType = (CTriggerParams::TTriggerType) stmt.ColumnInt(columnIndexTriggerType);
  3186         requestType = (CTriggerParams::TRequestType) stmt.ColumnInt(columnIndexRequestType);
  3215         requestType = (CTriggerParams::TRequestType) stmt.ColumnInt(columnIndexRequestType);
  3187         outstandingTrigger = stmt.ColumnInt(columnIndexOutstandingTrigger);
  3216         outstandingTrigger = stmt.ColumnInt(columnIndexOutstandingTrigger);
  3188         interval = stmt.ColumnInt(columnIndexInterval);
  3217         interval = stmt.ColumnInt(columnIndexInterval);
  3189         
  3218         endTimeInt = stmt.ColumnInt64(columnIndexEndTime);
       
  3219         endTime = endTimeInt;
  3190         params->Set(sessionId,sessionName,notificationPresent,triggerNotificationStatus,triggerType,requestType,outstandingTrigger,interval);
  3220         params->Set(sessionId,sessionName,notificationPresent,triggerNotificationStatus,triggerType,requestType,outstandingTrigger,interval);
       
  3221 				params->SetTriggerEndTime(endTime);        
  3191         aParamValues.Append(params);//ownership transferred to RPointerArray
  3222         aParamValues.Append(params);//ownership transferred to RPointerArray
  3192         }   
  3223         }   
  3193 
  3224 
  3194     stmt.Close();
  3225     stmt.Close();
  3195     if(aParamValues.Count()==0)
  3226     if(aParamValues.Count()==0)
  3235     CTriggerParams::TTriggerType triggerType;
  3266     CTriggerParams::TTriggerType triggerType;
  3236     CTriggerParams::TRequestType requestType;
  3267     CTriggerParams::TRequestType requestType;
  3237     TUint64 outstandingTrigger;
  3268     TUint64 outstandingTrigger;
  3238     TUint64 interval;
  3269     TUint64 interval;
  3239     TBuf<KGenericStringLen> sessionName;
  3270     TBuf<KGenericStringLen> sessionName;
       
  3271     TTime endTime;
       
  3272     TInt64 endTimeInt;
       
  3273     
  3240         
  3274         
  3241     TInt columnIndexSessionID = stmt.ColumnIndex(KColSessionId);
  3275     TInt columnIndexSessionID = stmt.ColumnIndex(KColSessionId);
  3242     TInt columnIndexSessionName = stmt.ColumnIndex(KColSessionName);
  3276     TInt columnIndexSessionName = stmt.ColumnIndex(KColSessionName);
  3243     TInt columnIndexNotificationPresent = stmt.ColumnIndex(KColNotificationPresent);
  3277     TInt columnIndexNotificationPresent = stmt.ColumnIndex(KColNotificationPresent);
  3244     TInt columnIndexTriggerNotificationStatus = stmt.ColumnIndex(KColTriggerNotificationStatus);
  3278     TInt columnIndexTriggerNotificationStatus = stmt.ColumnIndex(KColTriggerNotificationStatus);
  3245     TInt columnIndexTriggerType = stmt.ColumnIndex(KColTriggerType);
  3279     TInt columnIndexTriggerType = stmt.ColumnIndex(KColTriggerType);
  3246     TInt columnIndexRequestType = stmt.ColumnIndex(KColRequestType);
  3280     TInt columnIndexRequestType = stmt.ColumnIndex(KColRequestType);
  3247     TInt columnIndexOutstandingTrigger = stmt.ColumnIndex(KColOutstandingTrigger);
  3281     TInt columnIndexOutstandingTrigger = stmt.ColumnIndex(KColOutstandingTrigger);
  3248     TInt columnIndexInterval = stmt.ColumnIndex(KColInterval);
  3282     TInt columnIndexInterval = stmt.ColumnIndex(KColInterval);
       
  3283     TInt columnIndexEndTime = stmt.ColumnIndex(KColEndTime);
       
  3284     
  3249     while((err=stmt.Next())==KSqlAtRow)
  3285     while((err=stmt.Next())==KSqlAtRow)
  3250         {
  3286         {
  3251         sessionId = stmt.ColumnInt(columnIndexSessionID);
  3287         sessionId = stmt.ColumnInt(columnIndexSessionID);
  3252         stmt.ColumnText(columnIndexSessionName,sessionName);
  3288         stmt.ColumnText(columnIndexSessionName,sessionName);
  3253         notificationPresent = stmt.ColumnInt(columnIndexNotificationPresent);
  3289         notificationPresent = stmt.ColumnInt(columnIndexNotificationPresent);
  3254         triggerNotificationStatus = stmt.ColumnInt(columnIndexTriggerNotificationStatus);
  3290         triggerNotificationStatus = stmt.ColumnInt(columnIndexTriggerNotificationStatus);
  3255         triggerType = (CTriggerParams::TTriggerType) stmt.ColumnInt(columnIndexTriggerType);
  3291         triggerType = (CTriggerParams::TTriggerType) stmt.ColumnInt(columnIndexTriggerType);
  3256         requestType = (CTriggerParams::TRequestType) stmt.ColumnInt(columnIndexRequestType);
  3292         requestType = (CTriggerParams::TRequestType) stmt.ColumnInt(columnIndexRequestType);
  3257         outstandingTrigger = stmt.ColumnInt(columnIndexOutstandingTrigger);
  3293         outstandingTrigger = stmt.ColumnInt(columnIndexOutstandingTrigger);
  3258         interval = stmt.ColumnInt(columnIndexInterval);
  3294         interval = stmt.ColumnInt(columnIndexInterval);
  3259                 
  3295         endTimeInt = stmt.ColumnInt64(columnIndexEndTime);
       
  3296         endTime = endTimeInt;
  3260         aParamValues->Set(sessionId,sessionName,notificationPresent,triggerNotificationStatus,triggerType,requestType,outstandingTrigger,interval);
  3297         aParamValues->Set(sessionId,sessionName,notificationPresent,triggerNotificationStatus,triggerType,requestType,outstandingTrigger,interval);
       
  3298         aParamValues->SetTriggerEndTime(endTime);
  3261         }   
  3299         }   
  3262 
  3300 
  3263     stmt.Close();
  3301     stmt.Close();
  3264     }
  3302     }
  3265 
  3303