546 |
546 |
547 RSqlStatement stmt; |
547 RSqlStatement stmt; |
548 TInt column = 0; |
548 TInt column = 0; |
549 TInt rowStatus = 0; |
549 TInt rowStatus = 0; |
550 TInt64 inforows = -1; |
550 TInt64 inforows = -1; |
|
551 TInt64 infocount = -1; |
551 TInt64 datarows = -1; |
552 TInt64 datarows = -1; |
|
553 TInt64 datacount = -1; |
552 |
554 |
553 TInt ret = stmt.Prepare( iDatabase, KGetInfoRowID ); |
555 TInt ret = stmt.Prepare( iDatabase, KGetInfoRowID ); |
554 if(ret < 0) |
556 if(ret < 0) |
555 { |
557 { |
556 stmt.Close(); |
558 stmt.Close(); |
557 TN_DEBUG1( "CThumbnailStore::CheckRowIDs() failed 1 %d"); |
559 TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetInfoRowID failed %d"); |
558 return KErrNotSupported; |
560 return KErrNotSupported; |
559 } |
561 } |
560 rowStatus = stmt.Next(); |
562 rowStatus = stmt.Next(); |
561 |
563 |
562 if ( rowStatus == KSqlAtRow) |
564 if ( rowStatus == KSqlAtRow) |
570 { |
572 { |
571 #ifdef _DEBUG |
573 #ifdef _DEBUG |
572 TPtrC errorMsg2 = iDatabase.LastErrorMessage(); |
574 TPtrC errorMsg2 = iDatabase.LastErrorMessage(); |
573 TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2); |
575 TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2); |
574 #endif |
576 #endif |
575 return ret; |
577 return KErrNotSupported; |
|
578 } |
|
579 |
|
580 ret = stmt.Prepare( iDatabase, KGetInfoCount ); |
|
581 if(ret < 0) |
|
582 { |
|
583 stmt.Close(); |
|
584 TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetInfoCount failed %d"); |
|
585 return KErrNotSupported; |
|
586 } |
|
587 rowStatus = stmt.Next(); |
|
588 |
|
589 if ( rowStatus == KSqlAtRow) |
|
590 { |
|
591 infocount = stmt.ColumnInt64( column ); |
|
592 } |
|
593 |
|
594 stmt.Close(); |
|
595 |
|
596 if(rowStatus < 0) |
|
597 { |
|
598 #ifdef _DEBUG |
|
599 TPtrC errorMsg2 = iDatabase.LastErrorMessage(); |
|
600 TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2); |
|
601 #endif |
|
602 return KErrNotSupported; |
576 } |
603 } |
577 |
604 |
578 ret = stmt.Prepare( iDatabase, KGetDataRowID ); |
605 ret = stmt.Prepare( iDatabase, KGetDataRowID ); |
579 if(ret < 0) |
606 if(ret < 0) |
580 { |
607 { |
581 stmt.Close(); |
608 stmt.Close(); |
582 TN_DEBUG1( "CThumbnailStore::CheckRowIDs() failed 2"); |
609 TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetDataRowID failed"); |
583 return KErrNotSupported; |
610 return KErrNotSupported; |
584 } |
611 } |
585 rowStatus = stmt.Next(); |
612 rowStatus = stmt.Next(); |
586 |
613 |
587 if ( rowStatus == KSqlAtRow) |
614 if ( rowStatus == KSqlAtRow) |
595 { |
622 { |
596 #ifdef _DEBUG |
623 #ifdef _DEBUG |
597 TPtrC errorMsg2 = iDatabase.LastErrorMessage(); |
624 TPtrC errorMsg2 = iDatabase.LastErrorMessage(); |
598 TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2); |
625 TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2); |
599 #endif |
626 #endif |
600 return ret; |
627 return KErrNotSupported; |
601 } |
628 } |
602 |
629 |
603 if( inforows != datarows) |
630 ret = stmt.Prepare( iDatabase, KGetInfoDataCount ); |
|
631 if(ret < 0) |
|
632 { |
|
633 stmt.Close(); |
|
634 TN_DEBUG1( "CThumbnailStore::CheckRowIDs() KGetInfoDataCount failed %d"); |
|
635 return KErrNotSupported; |
|
636 } |
|
637 rowStatus = stmt.Next(); |
|
638 |
|
639 if ( rowStatus == KSqlAtRow) |
|
640 { |
|
641 datacount = stmt.ColumnInt64( column ); |
|
642 } |
|
643 |
|
644 stmt.Close(); |
|
645 |
|
646 if(rowStatus < 0) |
|
647 { |
|
648 #ifdef _DEBUG |
|
649 TPtrC errorMsg2 = iDatabase.LastErrorMessage(); |
|
650 TN_DEBUG2( "RThumbnailTransaction::ResetThumbnailIDs() lastError %S, ret = %d" , &errorMsg2); |
|
651 #endif |
|
652 return KErrNotSupported; |
|
653 } |
|
654 |
|
655 TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - inforows %Ld", inforows ); |
|
656 TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - infocount %Ld", infocount ); |
|
657 TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - datarows %Ld", datarows ); |
|
658 TN_DEBUG2( "CThumbnailStore::CheckRowIDsL() - datacount %Ld", datacount ); |
|
659 |
|
660 if( inforows != datarows || datacount != infocount) |
604 { |
661 { |
605 TN_DEBUG1( "CThumbnailStore::CheckRowIDsL() - tables out of sync" ); |
662 TN_DEBUG1( "CThumbnailStore::CheckRowIDsL() - tables out of sync" ); |
606 return KErrNotSupported; |
663 return KErrNotSupported; |
607 } |
664 } |
608 else |
665 else |