imagehandlingutilities/thumbnailmanager/thumbnailserver/src/thumbnailstore.cpp
changeset 33 221be23823c5
parent 31 d429f823a6b7
child 39 1a8af2cd6858
equal deleted inserted replaced
31:d429f823a6b7 33:221be23823c5
   553     
   553     
   554     RSqlStatement stmt;
   554     RSqlStatement stmt;
   555     TInt column = 0;   
   555     TInt column = 0;   
   556     TInt rowStatus = 0;
   556     TInt rowStatus = 0;
   557     TInt64 inforows = -1;
   557     TInt64 inforows = -1;
   558     TInt64 infocount = -1;
       
   559     TInt64 datarows = -1;
   558     TInt64 datarows = -1;
   560     TInt64 datacount = -1;
       
   561     
   559     
   562     TInt ret = stmt.Prepare( iDatabase, KGetInfoRowID );
   560     TInt ret = stmt.Prepare( iDatabase, KGetInfoRowID );
   563     if(ret < 0)
   561     if(ret < 0)
   564         {
   562         {
   565         stmt.Close();
   563         stmt.Close();
   581         TPtrC errorMsg2 = iDatabase.LastErrorMessage();
   579         TPtrC errorMsg2 = iDatabase.LastErrorMessage();
   582         TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2);
   580         TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2);
   583 #endif
   581 #endif
   584         return KErrNotSupported;
   582         return KErrNotSupported;
   585         }
   583         }
   586     
   584               
   587     ret = stmt.Prepare( iDatabase, KGetInfoCount );
       
   588     if(ret < 0)
       
   589         {
       
   590         stmt.Close();
       
   591         TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetInfoCount failed %d");
       
   592         return KErrNotSupported;
       
   593         }
       
   594     rowStatus = stmt.Next();
       
   595                 
       
   596     if ( rowStatus == KSqlAtRow)    
       
   597         {        
       
   598         infocount = stmt.ColumnInt64( column );  
       
   599         }
       
   600                 
       
   601     stmt.Close();
       
   602     
       
   603     if(rowStatus < 0)
       
   604         {
       
   605 #ifdef _DEBUG
       
   606         TPtrC errorMsg2 = iDatabase.LastErrorMessage();
       
   607         TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2);
       
   608 #endif
       
   609         return KErrNotSupported;
       
   610         }
       
   611             
       
   612     ret = stmt.Prepare( iDatabase, KGetDataRowID );
   585     ret = stmt.Prepare( iDatabase, KGetDataRowID );
   613     if(ret < 0)
   586     if(ret < 0)
   614         {
   587         {
   615         stmt.Close();
   588         stmt.Close();
   616         TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetDataRowID failed");
   589         TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetDataRowID failed");
   632         TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2);
   605         TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2);
   633 #endif
   606 #endif
   634         return KErrNotSupported;
   607         return KErrNotSupported;
   635         }
   608         }
   636     
   609     
   637     ret = stmt.Prepare( iDatabase, KGetInfoDataCount );
       
   638     if(ret < 0)
       
   639         {
       
   640         stmt.Close();
       
   641         TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetInfoDataCount failed %d");
       
   642         return KErrNotSupported;
       
   643         }
       
   644     rowStatus = stmt.Next();
       
   645                 
       
   646     if ( rowStatus == KSqlAtRow)    
       
   647         {        
       
   648         datacount = stmt.ColumnInt64( column );  
       
   649         }
       
   650                 
       
   651     stmt.Close();
       
   652     
       
   653     if(rowStatus < 0)
       
   654         {
       
   655 #ifdef _DEBUG
       
   656         TPtrC errorMsg2 = iDatabase.LastErrorMessage();
       
   657         TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2);
       
   658 #endif
       
   659         return KErrNotSupported;
       
   660         }
       
   661     
       
   662     TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - inforows %Ld", inforows );
   610     TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - inforows %Ld", inforows );
   663     TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - infocount %Ld", infocount );
       
   664     TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - datarows %Ld", datarows );
   611     TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - datarows %Ld", datarows );
   665     TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - datacount %Ld", datacount );
   612             
   666             
   613     if( inforows != datarows )
   667     if( inforows != datarows || datacount != infocount)
       
   668         {
   614         {
   669         TN_DEBUG1( "CThumbnailStore::CheckRowIDsL() - tables out of sync" );
   615         TN_DEBUG1( "CThumbnailStore::CheckRowIDsL() - tables out of sync" );
   670         return KErrNotSupported;
   616         return KErrNotSupported;
   671         }  
   617         }  
   672     else
   618     else