harvester/harvesterserver/src/ccontentinfodb.cpp
changeset 18 3e1f76dd2722
parent 1 6f2c1c46032b
--- a/harvester/harvesterserver/src/ccontentinfodb.cpp	Wed Aug 18 10:53:26 2010 +0300
+++ b/harvester/harvesterserver/src/ccontentinfodb.cpp	Thu Sep 02 21:37:32 2010 +0300
@@ -266,9 +266,12 @@
     sql.Format( KCISqlFormatSeek, &aContentName );
     
     RSqlStatement stmt;
-    stmt.Prepare( iDatabase , sql );
-    
-    TBool isfound = ( KSqlAtRow == stmt.Next() )?ETrue:EFalse; 
+    TBool isfound = EFalse;
+    //Error check necessary to avoid sqldb 2 panic, 
+    //if sqlstatement preparation fails, call to Next() raises this panic
+    TInt err = stmt.Prepare( iDatabase , sql );
+    if ( err == KErrNone)
+        isfound = ( KSqlAtRow == stmt.Next() )?ETrue:EFalse; 
     OstTraceFunctionExit0( CCONTENTINFODB_FINDL_EXIT );
     return isfound;
     }
@@ -290,11 +293,14 @@
     sql.Copy( KSelectAllRowsFormat );
     
     RSqlStatement stmt;
-    stmt.Prepare( iDatabase , sql );
-    
-    while ( KSqlAtEnd != stmt.Next() )
-        ++count;
-        
+    TInt err = stmt.Prepare( iDatabase , sql );
+    //Error check necessary to avoid sqldb 2 panic, 
+    //if sqlstatement preparation fails, call to Next() raises this panic     
+    if( err == KErrNone)
+        {
+        while ( KSqlAtEnd != stmt.Next() )
+            ++count;
+        }
     OstTraceFunctionExit0( CCONTENTINFODB_GETCONTENTCOUNTL_EXIT );
     return count;
     }