metadataengine/server/src/mdssqlobjectmanipulate.cpp
branchRCL_3
changeset 14 646a02f170b9
parent 3 b73a2e62868f
child 15 3cebc1a84278
--- a/metadataengine/server/src/mdssqlobjectmanipulate.cpp	Fri Feb 19 23:14:48 2010 +0200
+++ b/metadataengine/server/src/mdssqlobjectmanipulate.cpp	Fri Mar 12 15:44:28 2010 +0200
@@ -191,21 +191,18 @@
 
 void CMdSSqlObjectManipulate::ConstructL( )
     {
-    
 	iGenerator = CMdSIdentifierGenerator::NewL();
 
 	iNamespaceDef = NULL;
 	
-	TLockBuffer lockBuffer;
-	lockBuffer.iLock = EFalse;
 	for (TInt i = 0; i < KMaxBuffers; ++i)
 		{
-	    CMdsClauseBuffer* buffer = CMdsClauseBuffer::NewLC( 1024 );
-		lockBuffer.iBuffer = buffer;
+	    TLockBuffer lockBuffer;
+	    lockBuffer.iLock = EFalse;
+	    lockBuffer.iBuffer = CMdsClauseBuffer::NewLC( 1024 );
 		iBuffers.AppendL( lockBuffer );
 		CleanupStack::Pop(); // buffer
 		}
-
     }
 
 TBool CMdSSqlObjectManipulate::GarbageCollectionL()
@@ -2057,7 +2054,11 @@
 		if (!dataRow.Column(1).IsNull())
 			{
 			dataRow.Column(1).Get( relationId );
-			aRelationIds.InsertInOrder( relationId, TLinearOrder<TItemId>( CompareTItemIds ) );
+			const TInt error( aRelationIds.InsertInOrder( relationId, TLinearOrder<TItemId>( CompareTItemIds ) ) );
+			if( error == KErrNoMemory )
+			    {
+			    User::Leave( error );
+			    }
 			}
 		else
 			{
@@ -3266,11 +3267,18 @@
 		{
 		if (!iBuffers[i].iLock)
 			{
-			iBuffers[i].iLock = ETrue;
-			iBuffer = iBuffers[i].iBuffer;
+		    iBuffers[i].iLock = ETrue;
+            CMdsClauseBuffer* oldBuffer( iBuffer );
+            iBuffer = iBuffers[i].iBuffer;
+            TRAPD( error, iBuffer->ReserveSpaceL(aSize) );
+            if( error != KErrNone )
+                {
+                iBuffer = oldBuffer;
+                iBuffers[i].iLock = EFalse;
+                continue;
+                }		
+            TRAP_IGNORE( iBuffer->BufferL().Zero() );			
 			iNr = i;
-			TRAP_IGNORE( iBuffer->ReserveSpaceL(aSize) );
-			TRAP_IGNORE( iBuffer->BufferL().Zero() );
 			return;
 			}
 		}