messagingfw/msgsrvnstore/server/src/msvdbadapter.cpp
branchRCL_3
changeset 10 e174c577e901
parent 6 fe71b07a6401
child 22 d2c4c66342f3
equal deleted inserted replaced
9:dd93350a5f29 10:e174c577e901
  1237 		User::Leave(KErrNotFound);
  1237 		User::Leave(KErrNotFound);
  1238 		}
  1238 		}
  1239 
  1239 
  1240 	//Get the entry from the statement
  1240 	//Get the entry from the statement
  1241 	aEntry = CMsvEntryFreePool::Instance()->EntryL();
  1241 	aEntry = CMsvEntryFreePool::Instance()->EntryL();
       
  1242 	CleanupStack::PushL(cacheEntry);
  1242 	aEntry->Entry().iId = aId;
  1243 	aEntry->Entry().iId = aId;
  1243 	
  1244 	
  1244 	LoadEntryFromStatementL(getStmt, EGetEntry, aVisibleParentEntryId, *aEntry);
  1245 	LoadEntryFromStatementL(getStmt, EGetEntry, aVisibleParentEntryId, *aEntry);
  1245 	
  1246 	
  1246 	//We do not return non-standard visible folders from a non-current drive's database.
  1247 	//We do not return non-standard visible folders from a non-current drive's database.
  1281 	// Mask iRelatedId if it is a non-standard id.
  1282 	// Mask iRelatedId if it is a non-standard id.
  1282 	if(!IsStandardId(aEntry->Entry().iRelatedId))
  1283 	if(!IsStandardId(aEntry->Entry().iRelatedId))
  1283 		{
  1284 		{
  1284 		aEntry->Entry().iRelatedId = MaskTMsvId(driveId, aEntry->Entry().iRelatedId);
  1285 		aEntry->Entry().iRelatedId = MaskTMsvId(driveId, aEntry->Entry().iRelatedId);
  1285 		}
  1286 		}
  1286 	
  1287 
       
  1288 	CleanupStack::Pop(cacheEntry);
  1287 	CleanupStack::PopAndDestroy(2); //getStmt, queryBuf
  1289 	CleanupStack::PopAndDestroy(2); //getStmt, queryBuf
  1288 	}
  1290 	}
  1289 
  1291 
  1290 
  1292 
  1291 
  1293 
  1343 			continue;
  1345 			continue;
  1344 			}
  1346 			}
  1345 			
  1347 			
  1346 		TMsvId aVisibleParentEntryId;
  1348 		TMsvId aVisibleParentEntryId;
  1347 		CMsvCacheEntry *cacheEntry = CMsvEntryFreePool::Instance()->EntryL();
  1349 		CMsvCacheEntry *cacheEntry = CMsvEntryFreePool::Instance()->EntryL();
       
  1350 		CleanupStack::PushL(cacheEntry);
  1348 		if(!IsStandardId(aParentId))
  1351 		if(!IsStandardId(aParentId))
  1349 			{
  1352 			{
  1350 			aParentId = MaskTMsvId(driveId, aParentId);
  1353 			aParentId = MaskTMsvId(driveId, aParentId);
  1351 			}
  1354 			}
  1352 		cacheEntry->Entry().iParentId = aParentId;
  1355 		cacheEntry->Entry().iParentId = aParentId;
  1370 			cacheEntry->Entry().iRelatedId = MaskTMsvId(driveId, cacheEntry->Entry().iRelatedId);
  1373 			cacheEntry->Entry().iRelatedId = MaskTMsvId(driveId, cacheEntry->Entry().iRelatedId);
  1371 			}
  1374 			}
  1372 	
  1375 	
  1373 		//Add the child entry to the array given
  1376 		//Add the child entry to the array given
  1374 		aChildArray.AppendL(cacheEntry);
  1377 		aChildArray.AppendL(cacheEntry);
       
  1378 		CleanupStack::Pop(cacheEntry);
  1375 		}
  1379 		}
  1376 	
  1380 	
  1377 	CleanupStack::PopAndDestroy(2); //getStmt, queryBuf
  1381 	CleanupStack::PopAndDestroy(2); //getStmt, queryBuf
  1378 	}
  1382 	}
  1379 
  1383 
  1508 		  	{
  1512 		  	{
  1509 			continue;
  1513 			continue;
  1510 			}
  1514 			}
  1511 		
  1515 		
  1512 		CMsvCacheEntry* cacheEntry = CMsvEntryFreePool::Instance()->EntryL();
  1516 		CMsvCacheEntry* cacheEntry = CMsvEntryFreePool::Instance()->EntryL();
       
  1517 		CleanupStack::PushL(cacheEntry);
  1513 		if(!IsStandardId(aParentId))
  1518 		if(!IsStandardId(aParentId))
  1514 			{
  1519 			{
  1515 			aParentId = MaskTMsvId(driveId, aParentId);
  1520 			aParentId = MaskTMsvId(driveId, aParentId);
  1516 			}
  1521 			}
  1517 		cacheEntry->Entry().iParentId = aParentId;
  1522 		cacheEntry->Entry().iParentId = aParentId;
  1561 			cacheEntry->Entry().iRelatedId = MaskTMsvId(driveId, cacheEntry->Entry().iRelatedId);
  1566 			cacheEntry->Entry().iRelatedId = MaskTMsvId(driveId, cacheEntry->Entry().iRelatedId);
  1562 			}
  1567 			}
  1563 		
  1568 		
  1564 		//Add the child entry to the array given
  1569 		//Add the child entry to the array given
  1565 		aChildArray.AppendL(cacheEntry);
  1570 		aChildArray.AppendL(cacheEntry);
       
  1571 		CleanupStack::Pop(cacheEntry);
  1566 		}
  1572 		}
  1567 	CleanupStack::PopAndDestroy(2);		// condGetChildrenStmnt,queryBuf
  1573 	CleanupStack::PopAndDestroy(2);		// condGetChildrenStmnt,queryBuf
  1568 	}
  1574 	}
  1569 
  1575 
  1570 
  1576 
  2402 		User::Leave(KErrNotFound);
  2408 		User::Leave(KErrNotFound);
  2403 		}
  2409 		}
  2404 
  2410 
  2405 	//Get the entry from the statement
  2411 	//Get the entry from the statement
  2406 	aEntry = CMsvEntryFreePool::Instance()->EntryL();
  2412 	aEntry = CMsvEntryFreePool::Instance()->EntryL();
       
  2413 	CleanupStack::PushL(aEntry);
  2407 	aEntry->Entry().iId = aId;
  2414 	aEntry->Entry().iId = aId;
  2408 	LoadEntryFromStatementL(iStatement[EGetEntry], EGetEntry, aVisibleParentEntryId, *aEntry);
  2415 	LoadEntryFromStatementL(iStatement[EGetEntry], EGetEntry, aVisibleParentEntryId, *aEntry);
  2409 
  2416 	CleanupStack::Pop(aEntry);
  2410 	//Reset the RSqlStatement
  2417 	//Reset the RSqlStatement
  2411 	User::LeaveIfError(iStatement[EGetEntry].Reset());
  2418 	User::LeaveIfError(iStatement[EGetEntry].Reset());
  2412 	}
  2419 	}
  2413 
  2420 
  2414 
  2421 
  2430 
  2437 
  2431 	while(KSqlAtRow == iStatement[EGetChildEntries].Next())
  2438 	while(KSqlAtRow == iStatement[EGetChildEntries].Next())
  2432 		{
  2439 		{
  2433 		TMsvId aVisibleParentEntryId;
  2440 		TMsvId aVisibleParentEntryId;
  2434 		CMsvCacheEntry *cacheEntry = CMsvEntryFreePool::Instance()->EntryL();
  2441 		CMsvCacheEntry *cacheEntry = CMsvEntryFreePool::Instance()->EntryL();
       
  2442 		CleanupStack::PushL(cacheEntry);
  2435 		cacheEntry->Entry().iParentId = aParentId;
  2443 		cacheEntry->Entry().iParentId = aParentId;
  2436 		LoadEntryFromStatementL(iStatement[EGetChildEntries], EGetChildEntries, aVisibleParentEntryId, *cacheEntry);
  2444 		LoadEntryFromStatementL(iStatement[EGetChildEntries], EGetChildEntries, aVisibleParentEntryId, *cacheEntry);
  2437 		//Add the child entry to the array given
  2445 		//Add the child entry to the array given
  2438 		aChildArray.AppendL(cacheEntry);
  2446 		aChildArray.AppendL(cacheEntry);
       
  2447 		CleanupStack::Pop(cacheEntry);
  2439 		}
  2448 		}
  2440 
  2449 
  2441 	//Reset the RSqlStatement
  2450 	//Reset the RSqlStatement
  2442 	User::LeaveIfError(iStatement[EGetChildEntries].Reset());
  2451 	User::LeaveIfError(iStatement[EGetChildEntries].Reset());
  2443 	}
  2452 	}
  2509 	BindIntL(condGetChildrenStmnt, index, aParentId);
  2518 	BindIntL(condGetChildrenStmnt, index, aParentId);
  2510 
  2519 
  2511 	while(KSqlAtRow == condGetChildrenStmnt.Next())
  2520 	while(KSqlAtRow == condGetChildrenStmnt.Next())
  2512 		{
  2521 		{
  2513 		CMsvCacheEntry* cacheEntry = CMsvEntryFreePool::Instance()->EntryL();
  2522 		CMsvCacheEntry* cacheEntry = CMsvEntryFreePool::Instance()->EntryL();
       
  2523 		CleanupStack::PushL(cacheEntry);
  2514 		cacheEntry->Entry().iParentId = aParentId;
  2524 		cacheEntry->Entry().iParentId = aParentId;
  2515 
  2525 
  2516 		index = 0;
  2526 		index = 0;
  2517 		cacheEntry->Entry().iId = ColumnInt(condGetChildrenStmnt, index);
  2527 		cacheEntry->Entry().iId = ColumnInt(condGetChildrenStmnt, index);
  2518 		cacheEntry->Entry().iServiceId = ColumnInt(condGetChildrenStmnt, ++index);
  2528 		cacheEntry->Entry().iServiceId = ColumnInt(condGetChildrenStmnt, ++index);
  2536 		cacheEntry->iDetailsBuffer = ColumnTextL(condGetChildrenStmnt, ++index); 	
  2546 		cacheEntry->iDetailsBuffer = ColumnTextL(condGetChildrenStmnt, ++index); 	
  2537 		cacheEntry->Entry().iDetails.Set(*cacheEntry->iDetailsBuffer);
  2547 		cacheEntry->Entry().iDetails.Set(*cacheEntry->iDetailsBuffer);
  2538 		
  2548 		
  2539 		//Add the child entry to the array given
  2549 		//Add the child entry to the array given
  2540 		aChildArray.AppendL(cacheEntry);
  2550 		aChildArray.AppendL(cacheEntry);
       
  2551 		CleanupStack::Pop(cacheEntry);
  2541 		}
  2552 		}
  2542 	CleanupStack::PopAndDestroy(2);		// condGetChildrenStmnt,queryBuf
  2553 	CleanupStack::PopAndDestroy(2);		// condGetChildrenStmnt,queryBuf
  2543 	}
  2554 	}
  2544 
  2555 
  2545 
  2556