metadataengine/server/src/mdsfindsqlclause.cpp
branchRCL_3
changeset 12 9f21bab39f42
parent 10 ab88d4a85041
child 19 b73252188534
equal deleted inserted replaced
10:ab88d4a85041 12:9f21bab39f42
   657 	iQueryBuf->AppendL( KFromBaseObject );
   657 	iQueryBuf->AppendL( KFromBaseObject );
   658 	iQueryBuf->AppendL( iNamespaceIdDes );
   658 	iQueryBuf->AppendL( iNamespaceIdDes );
   659 	iQueryBuf->AppendL( KAsBaseObject );
   659 	iQueryBuf->AppendL( KAsBaseObject );
   660 
   660 
   661 	// if object definitions is BaseObject
   661 	// if object definitions is BaseObject
   662 	if( KBaseObjectDefId != iSourceObjectDef->GetId() )
   662 	if( iSourceObjectDef && KBaseObjectDefId != iSourceObjectDef->GetId() )
   663 		{
   663 		{
   664 		// "," + object def's table + namespace def id + " AS O ON BO.ObjectId=O.ObjectId "
   664 		// "," + object def's table + namespace def id + " AS O ON BO.ObjectId=O.ObjectId "
   665         iQueryBuf->AppendL( KComma );
   665         iQueryBuf->AppendL( KComma );
   666 
   666 
   667 		AppendTableByObjectDefIdL( iSourceObjectDef->GetId() );
   667 		AppendTableByObjectDefIdL( iSourceObjectDef->GetId() );
  1312 			CleanupStack::Pop( pattern );
  1312 			CleanupStack::Pop( pattern );
  1313 
  1313 
  1314 			iQueryBuf->AppendL( KObjectUriBeginsWith );			
  1314 			iQueryBuf->AppendL( KObjectUriBeginsWith );			
  1315 			}
  1315 			}
  1316 			break;
  1316 			break;
       
  1317 		 case EObjectConditionCompareUriContains:
       
  1318             {
       
  1319             TPtrC16 uriPtr = iSerializedBuffer->ReceivePtr16L();
       
  1320 
       
  1321             HBufC16* pattern = HBufC16::NewLC( uriPtr.Length() + 2 );  // prepare for %uri%
       
  1322 
       
  1323             TPtr16 modPattern = pattern->Des();
       
  1324 
       
  1325             // add wildcard before and after URI "%uri%"
       
  1326             modPattern.Append( KWildcard );
       
  1327             modPattern.Append( uriPtr );
       
  1328             modPattern.Append( KWildcard );
       
  1329 
       
  1330             iVariables.AppendL( TColumn( pattern ) );
       
  1331 
       
  1332             CleanupStack::Pop( pattern );
       
  1333 
       
  1334             iQueryBuf->AppendL( KObjectUriBeginsWith );         
       
  1335             }
       
  1336             break;
  1317 		case EObjectConditionCompareFreeText:
  1337 		case EObjectConditionCompareFreeText:
  1318 			{
  1338 			{
  1319 			TPtrC16 freetextPtr = iSerializedBuffer->ReceivePtr16L();
  1339 			TPtrC16 freetextPtr = iSerializedBuffer->ReceivePtr16L();
  1320 
  1340 
  1321 			HBufC* freetext = freetextPtr.AllocLC();
  1341 			HBufC* freetext = freetextPtr.AllocLC();
  1536 	// get object def ID for source object def if 
  1556 	// get object def ID for source object def if 
  1537 	// condition is not from "Object" def and 
  1557 	// condition is not from "Object" def and 
  1538 	// (not multi object query or (multi object query and WHERE to search from 
  1558 	// (not multi object query or (multi object query and WHERE to search from 
  1539 	// doesn't match with WHAT to search))
  1559 	// doesn't match with WHAT to search))
  1540 	if( KBaseObjectDefId != objectDefId && ( !iSourceObjectDefs || 
  1560 	if( KBaseObjectDefId != objectDefId && ( !iSourceObjectDefs || 
  1541 			( iSourceObjectDefs && iObjectDef != iSourceObjectDef ) ) )
  1561 			( iSourceObjectDefs && iSourceObjectDef && iObjectDef != iSourceObjectDef ) ) )
  1542 		{
  1562 		{
  1543 		objectDefId = iSourceObjectDef->GetId();
  1563 		objectDefId = iSourceObjectDef->GetId();
  1544 		}
  1564 		}
  1545 	AppendTableByObjectDefIdL( objectDefId );
  1565 	AppendTableByObjectDefIdL( objectDefId );
  1546 
  1566 
  1574 // ---------------------------------------------------------------------------
  1594 // ---------------------------------------------------------------------------
  1575 //
  1595 //
  1576 TDefId CMdSFindSqlClause::ObjectDefForPropertyCondition(TDefId aObjectDefId)
  1596 TDefId CMdSFindSqlClause::ObjectDefForPropertyCondition(TDefId aObjectDefId)
  1577 	{
  1597 	{
  1578 	// if object def is not base object def
  1598 	// if object def is not base object def
  1579 	if( KBaseObjectDefId != aObjectDefId )
  1599 	if( iSourceObjectDef && KBaseObjectDefId != aObjectDefId )
  1580 		{
  1600 		{
  1581 		const CMdsObjectDef* parent = iSourceObjectDef->GetParent();
  1601 		const CMdsObjectDef* parent = iSourceObjectDef->GetParent();
  1582 
  1602 
  1583 		// check if property's object def belongs to 
  1603 		// check if property's object def belongs to 
  1584 		// any of source object def's parents
  1604 		// any of source object def's parents