equal
deleted
inserted
replaced
440 iCachedSuidHash = 0; |
440 iCachedSuidHash = 0; |
441 TBool needToInsert = EFalse; |
441 TBool needToInsert = EFalse; |
442 TBool needUpdateOwner = EFalse; |
442 TBool needUpdateOwner = EFalse; |
443 TUint dpId(aObject.Uint(CMTPObjectMetaData::EDataProviderId)); |
443 TUint dpId(aObject.Uint(CMTPObjectMetaData::EDataProviderId)); |
444 |
444 |
|
445 if ((aObject.DesC(CMTPObjectMetaData::ESuid)).Length() > KMaxFileName) |
|
446 { |
|
447 // The length of object uid should not excceeds KMaxFileName |
|
448 User::Leave( KErrBadName ); |
|
449 } |
|
450 |
445 TFileName suid; |
451 TFileName suid; |
446 suid.CopyLC(aObject.DesC(CMTPObjectMetaData::ESuid)); |
452 suid.CopyLC(aObject.DesC(CMTPObjectMetaData::ESuid)); |
447 TUint32 suidHash = DefaultHash::Des16(suid); |
453 TUint32 suidHash = DefaultHash::Des16(suid); |
448 TUint32 parentHandle = aObject.Uint(CMTPObjectMetaData::EParentHandle); |
454 TUint32 parentHandle = aObject.Uint(CMTPObjectMetaData::EParentHandle); |
449 TUint32 handle = KMTPHandleNone, handleInDB = KMTPHandleAll; |
455 TUint32 handle = KMTPHandleNone, handleInDB = KMTPHandleAll; |
476 else |
482 else |
477 { |
483 { |
478 aObject.SetUint(CMTPObjectMetaData::EHandle, handle); |
484 aObject.SetUint(CMTPObjectMetaData::EHandle, handle); |
479 id = iEnumeratingCacheObjList[found]->iPOUID; |
485 id = iEnumeratingCacheObjList[found]->iPOUID; |
480 aObject.SetUint(CMTPObjectMetaData::EIdentifier, id); |
486 aObject.SetUint(CMTPObjectMetaData::EIdentifier, id); |
481 if(iEnumeratingCacheObjList[found]->iFormatcode != aObject.Uint(CMTPObjectMetaData::EFormatCode)) |
487 if(iEnumeratingCacheObjList[found]->iFormatcode != aObject.Uint(CMTPObjectMetaData::EFormatCode) || |
|
488 iEnumeratingCacheObjList[found]->iObjParentId != aObject.Uint(CMTPObjectMetaData::EParentHandle)) |
482 {//have different owner |
489 {//have different owner |
483 needUpdateOwner = ETrue; |
490 needUpdateOwner = ETrue; |
484 } |
491 } |
485 delete iEnumeratingCacheObjList[found]; |
492 delete iEnumeratingCacheObjList[found]; |
486 iEnumeratingCacheObjList.Remove(found); |
493 iEnumeratingCacheObjList.Remove(found); |
521 } |
528 } |
522 // dp is not enumerating, do a plain insert |
529 // dp is not enumerating, do a plain insert |
523 needToInsert = ETrue; |
530 needToInsert = ETrue; |
524 __FLOG_VA((_L8("InsertObjectL After enmueration, needUpdateOwner %d needToInsert %d"), needUpdateOwner, needToInsert)); |
531 __FLOG_VA((_L8("InsertObjectL After enmueration, needUpdateOwner %d needToInsert %d"), needUpdateOwner, needToInsert)); |
525 } |
532 } |
|
533 |
526 if (needToInsert)//needToInsert and needUpdateOwner can't be true at same time |
534 if (needToInsert)//needToInsert and needUpdateOwner can't be true at same time |
527 { |
535 { |
528 TUint32 parentHandle(aObject.Uint(CMTPObjectMetaData::EParentHandle)); |
536 TUint32 parentHandle(aObject.Uint(CMTPObjectMetaData::EParentHandle)); |
529 handle = iHandleAllocator->NextIdL(dpId); |
537 handle = iHandleAllocator->NextIdL(dpId); |
530 id = iHandleAllocator->NextPOUIDL(); |
538 id = iHandleAllocator->NextPOUIDL(); |
560 iBatched.SetColL(EObjectStoreFormatSubCode, aObject.Uint(CMTPObjectMetaData::EFormatSubCode)); |
568 iBatched.SetColL(EObjectStoreFormatSubCode, aObject.Uint(CMTPObjectMetaData::EFormatSubCode)); |
561 iBatched.SetColL(EObjectStoreStorageId, aObject.Uint(CMTPObjectMetaData::EStorageId)); |
569 iBatched.SetColL(EObjectStoreStorageId, aObject.Uint(CMTPObjectMetaData::EStorageId)); |
562 iBatched.SetColL(EObjectStoreModes, aObject.Uint(CMTPObjectMetaData::EModes)); |
570 iBatched.SetColL(EObjectStoreModes, aObject.Uint(CMTPObjectMetaData::EModes)); |
563 iBatched.SetColL(EObjectStoreNonConsumable, aObject.Uint(CMTPObjectMetaData::ENonConsumable)); |
571 iBatched.SetColL(EObjectStoreNonConsumable, aObject.Uint(CMTPObjectMetaData::ENonConsumable)); |
564 iBatched.SetColL(EObjectStoreName, aObject.DesC(CMTPObjectMetaData::EName)); |
572 iBatched.SetColL(EObjectStoreName, aObject.DesC(CMTPObjectMetaData::EName)); |
|
573 iBatched.SetColL(EObjectStoreParentHandle, aObject.Uint(CMTPObjectMetaData::EParentHandle)); |
565 iBatched.PutL(); |
574 iBatched.PutL(); |
566 CleanupStack::Pop(&iBatched); |
575 CleanupStack::Pop(&iBatched); |
567 IncTranOpsNumL(); |
576 IncTranOpsNumL(); |
568 } |
577 } |
569 } |
578 } |
935 { |
944 { |
936 err = OpenDb(fullName); |
945 err = OpenDb(fullName); |
937 if (err==KErrNone && iDatabase.IsDamaged()) |
946 if (err==KErrNone && iDatabase.IsDamaged()) |
938 { |
947 { |
939 err = iDatabase.Recover(); |
948 err = iDatabase.Recover(); |
|
949 } |
|
950 if(KErrNone == err) |
|
951 { |
|
952 err = iDatabase.Compact(); |
|
953 if(KErrNone != err) |
|
954 {//the DB file is corrupt |
|
955 BaflUtils::DeleteFile(iSingletons.Fs(), fullName); |
|
956 } |
940 } |
957 } |
941 } |
958 } |
942 |
959 |
943 if (err != KErrNone) |
960 if (err != KErrNone) |
944 { |
961 { |