--- a/terminalsecurity/SCP/SCPDatabase/src/SCPParamDB.cpp Fri Aug 06 18:29:23 2010 +0530
+++ b/terminalsecurity/SCP/SCPDatabase/src/SCPParamDB.cpp Thu Aug 19 17:35:34 2010 +0530
@@ -177,23 +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 +213,20 @@
__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 <<<"));