terminalsecurity/SCP/SCPDatabase/src/SCPParamDB.cpp
branchRCL_3
changeset 25 b183ec05bd8c
parent 9 57a65a3a658c
child 26 19bba8228ff0
--- a/terminalsecurity/SCP/SCPDatabase/src/SCPParamDB.cpp	Thu Aug 19 10:44:50 2010 +0300
+++ b/terminalsecurity/SCP/SCPDatabase/src/SCPParamDB.cpp	Tue Aug 31 16:04:06 2010 +0300
@@ -177,24 +177,24 @@
 
     __LEAVE_IF_ERROR(lDBView.Prepare(iParameterDB, TDbQuery(*lSelectQry)));
     __LEAVE_IF_ERROR(lDBView.EvaluateAll());
-
-    lDBView.FirstL();
+    if( lDBView.FirstL())
+    {
+    	TInt lRowCount = lDBView.CountL();
 
-    TInt lRowCount = lDBView.CountL();
-
-    if(lRowCount == 0) {
+    	if(lRowCount == 0) {
         _SCPDB_LOG(_L("[CSCPParamDB]-> No Rows found for this parameter"));
         CleanupStack :: PopAndDestroy(2);
         return KErrNotFound;
-    }
-    else if(lRowCount > 1) {
+    	}
+    	else if(lRowCount > 1) {
         _SCPDB_LOG(_L("[CSCPParamDB]-> ERROR: More than one record matches the criterion. Db is corrupt! Leaving..."));
         User :: Leave(KErrCorrupt);
-    }
+    	}
 
-    lDBView.GetL();
-    aApp = lDBView.ColInt(iColSet->ColNo(KColAppId));
-    aValue = lDBView.ColInt(iColSet->ColNo(KColValueInt));
+    	lDBView.GetL();
+    	aApp = lDBView.ColInt(iColSet->ColNo(KColAppId));
+    	aValue = lDBView.ColInt(iColSet->ColNo(KColValueInt));
+    }
     CleanupStack :: PopAndDestroy(2);
 
     _SCPDB_LOG(_L("[CSCPParamDB]-> GetValueForParameterL <<<"));
@@ -212,21 +212,21 @@
 
     __LEAVE_IF_ERROR(lDBView.Prepare(iParameterDB, TDbQuery(*lSelectQry)));
     __LEAVE_IF_ERROR(lDBView.EvaluateAll());
-
-    lDBView.FirstL();
+    
+    if (lDBView.FirstL())
+    {
+    	TInt size(0);
+    	TInt lRowCount = lDBView.CountL();
 
-    TInt size(0);
-    TInt lRowCount = lDBView.CountL();
-
-    if(lRowCount == 0) {
+    	if(lRowCount == 0) {
         _SCPDB_LOG(_L("[CSCPParamDB]-> No Rows found for this parameter"));
         CleanupStack :: PopAndDestroy(2);
         return KErrNotFound;
-    }
+    	}
     
-    TInt lErr(KErrNone);
+    	TInt lErr(KErrNone);
     
-    do {
+    	do {
         lDBView.GetL();
         size = lDBView.ColDes(iColSet->ColNo(KColValueDes)).Size();
 
@@ -242,8 +242,9 @@
                 User :: Leave(lErr);
             }
         }
+    	}
+    	while(lDBView.NextL());
     }
-    while(lDBView.NextL());
 
     CleanupStack :: PopAndDestroy(2);
     _SCPDB_LOG(_L("[CSCPParamDB]-> GetValuesForParameterL <<<"));
@@ -329,7 +330,7 @@
         _SCPDB_LOG(_L("[CSCPParamDB]-> WARNING: Nothing to do!!"));
         return KErrNone;  
     }
-
+    
     HBufC* lDelQuery(NULL);
     
     if(iParameterDB.InTransaction()) {
@@ -414,7 +415,7 @@
 
 TInt CSCPParamDB :: DropValuesL(TInt aParamID, const TInt32 aApp) {
     _SCPDB_LOG(_L("[CSCPParamDB]-> DropValuesL() >>>"));
-
+    
     HBufC* lDelQuery(NULL);
     
     if(iParameterDB.InTransaction()) {