imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp
branchRCL_3
changeset 37 f759b6186ab5
parent 28 ff2fb7658ff7
child 38 2b4b06654caa
--- a/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp	Mon Jun 21 16:00:46 2010 +0300
+++ b/imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp	Thu Jul 15 18:59:26 2010 +0300
@@ -548,13 +548,15 @@
     TInt column = 0;   
     TInt rowStatus = 0;
     TInt64 inforows = -1;
+    TInt64 infocount = -1;
     TInt64 datarows = -1;
+    TInt64 datacount = -1;
     
     TInt ret = stmt.Prepare( iDatabase, KGetInfoRowID );
     if(ret < 0)
         {
         stmt.Close();
-        TN_DEBUG1( "CThumbnailStore::CheckRowIDs() failed 1 %d");
+        TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetInfoRowID failed %d");
         return KErrNotSupported;
         }
     rowStatus = stmt.Next();
@@ -572,14 +574,39 @@
         TPtrC errorMsg2 = iDatabase.LastErrorMessage();
         TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2);
 #endif
-        return ret;
+        return KErrNotSupported;
+        }
+    
+    ret = stmt.Prepare( iDatabase, KGetInfoCount );
+    if(ret < 0)
+        {
+        stmt.Close();
+        TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetInfoCount failed %d");
+        return KErrNotSupported;
+        }
+    rowStatus = stmt.Next();
+                
+    if ( rowStatus == KSqlAtRow)    
+        {        
+        infocount = stmt.ColumnInt64( column );  
+        }
+                
+    stmt.Close();
+    
+    if(rowStatus < 0)
+        {
+#ifdef _DEBUG
+        TPtrC errorMsg2 = iDatabase.LastErrorMessage();
+        TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2);
+#endif
+        return KErrNotSupported;
         }
             
     ret = stmt.Prepare( iDatabase, KGetDataRowID );
     if(ret < 0)
         {
         stmt.Close();
-        TN_DEBUG1( "CThumbnailStore::CheckRowIDs() failed 2");
+        TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetDataRowID failed");
         return KErrNotSupported;
         }
     rowStatus = stmt.Next();
@@ -597,10 +624,40 @@
         TPtrC errorMsg2 = iDatabase.LastErrorMessage();
         TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2);
 #endif
-        return ret;
+        return KErrNotSupported;
+        }
+    
+    ret = stmt.Prepare( iDatabase, KGetInfoDataCount );
+    if(ret < 0)
+        {
+        stmt.Close();
+        TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetInfoDataCount failed %d");
+        return KErrNotSupported;
+        }
+    rowStatus = stmt.Next();
+                
+    if ( rowStatus == KSqlAtRow)    
+        {        
+        datacount = stmt.ColumnInt64( column );  
         }
+                
+    stmt.Close();
+    
+    if(rowStatus < 0)
+        {
+#ifdef _DEBUG
+        TPtrC errorMsg2 = iDatabase.LastErrorMessage();
+        TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2);
+#endif
+        return KErrNotSupported;
+        }
+    
+    TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - inforows %Ld", inforows );
+    TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - infocount %Ld", infocount );
+    TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - datarows %Ld", datarows );
+    TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - datacount %Ld", datacount );
             
-    if( inforows != datarows)
+    if( inforows != datarows || datacount != infocount)
         {
         TN_DEBUG1( "CThumbnailStore::CheckRowIDsL() - tables out of sync" );
         return KErrNotSupported;