Beispiel #1
0
		private void DeleteMembers(StatefulBuffer objectBytes)
		{
			ObjectHeader oh = new ObjectHeader(_clazz, objectBytes);
			DeleteInfo info = (DeleteInfo)TreeInt.Find(_transaction._delete, _id);
			if (info != null)
			{
				if (info._cascade > _cascade)
				{
					_cascade = info._cascade;
				}
			}
			objectBytes.SetCascadeDeletes(_cascade);
			DeleteContextImpl context = new DeleteContextImpl(objectBytes, oh, _clazz.ClassReflector
				(), null);
			_clazz.DeleteMembers(context, _typeInfo, true);
		}
Beispiel #2
0
 internal override void DeleteMembers(DeleteContextImpl context, ArrayType arrayType
     , bool isUpdate)
 {
     if (arrayType == ArrayType.PlainArray)
     {
         new ArrayHandler(TypeHandler(), true).DeletePrimitiveEmbedded((StatefulBuffer) context
             .Buffer(), this);
     }
     else
     {
         if (arrayType == ArrayType.MultidimensionalArray)
         {
             new MultidimensionalArrayHandler(TypeHandler(), true).DeletePrimitiveEmbedded((StatefulBuffer
                 ) context.Buffer(), this);
         }
     }
 }
Beispiel #3
0
 private int CollectionDeleteDepth(DeleteContextImpl context)
 {
     return 1;
 }
Beispiel #4
0
 internal virtual void DeleteMembers(DeleteContextImpl context, ArrayType arrayType
     , bool isUpdate)
 {
     var buffer = (StatefulBuffer) context.Buffer();
     var preserveCascade = context.CascadeDeleteDepth();
     try
     {
         if (CascadeOnDelete())
         {
             if (ClassReflector().IsCollection())
             {
                 buffer.SetCascadeDeletes(CollectionDeleteDepth(context));
             }
             else
             {
                 buffer.SetCascadeDeletes(1);
             }
         }
         Handlers4.FieldAwareTypeHandler(CorrectHandlerVersion(context)).DeleteMembers(context
             , isUpdate);
     }
     catch (Exception e)
     {
         // This a catch for changed class hierarchies.
         // It's very ugly to catch all here but it does
         // help to heal migration from earlier db4o
         // versions.
         var dp = Container()._handlers.DiagnosticProcessor();
         if (dp.Enabled())
         {
             dp.DeletionFailed();
         }
     }
     buffer.SetCascadeDeletes(preserveCascade);
 }
Beispiel #5
0
 private void CascadeDeletion(StatefulBuffer buffer, object obj)
 {
     var oh = new ObjectHeader(this, buffer);
     var context = new DeleteContextImpl(buffer, oh, ClassReflector(), null
         );
     DeleteMembers(context, ArrayTypeFor(buffer, obj), false);
 }
Beispiel #6
0
		public override void Delete(DeleteContextImpl context, bool isUpdate)
		{
			context.Seek(context.Offset() + LinkLength(context));
		}
Beispiel #7
0
 public DeleteContextImpl(DeleteContextImpl parentContext
     , IReflectClass fieldClass, Config4Field fieldConfig) : this(parentContext.StatefulBuffer
         (), parentContext._objectHeader, fieldClass, fieldConfig)
 {
 }
 public _MarshallingInfoTraverseAspectCommand_438(DeleteContextImpl context, bool
     isUpdate, IMarshallingInfo baseArg1) : base(baseArg1)
 {
     this.context = context;
     this.isUpdate = isUpdate;
 }
		/// <exception cref="Db4objects.Db4o.CorruptionException"></exception>
		/// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
		private void RemoveIndexEntry(DeleteContextImpl context)
		{
			if (!HasIndex())
			{
				return;
			}
			int offset = context.Offset();
			object obj = ReadIndexEntry(context);
			RemoveIndexEntry(context.Transaction(), context.ObjectId(), obj);
			context.Seek(offset);
		}
			public _IClosure4_445(FieldMetadata _enclosing, DeleteContextImpl childContext)
			{
				this._enclosing = _enclosing;
				this.childContext = childContext;
			}
		/// <exception cref="Db4objects.Db4o.Internal.FieldIndexException"></exception>
		public override void Delete(DeleteContextImpl context, bool isUpdate)
		{
			if (!CheckAlive(context))
			{
				return;
			}
			try
			{
				RemoveIndexEntry(context);
				if (isUpdate)
				{
					IncrementOffset(context);
					return;
				}
				StatefulBuffer buffer = (StatefulBuffer)context.Buffer();
				DeleteContextImpl childContext = new DeleteContextImpl(context, GetStoredType(), 
					_config);
				context.SlotFormat().DoWithSlotIndirection(buffer, GetHandler(), new _IClosure4_445
					(this, childContext));
			}
			catch (CorruptionException exc)
			{
				throw new FieldIndexException(exc, this);
			}
		}
Beispiel #12
0
			public _IClosure4_119(TypeHandlerAspect _enclosing, DeleteContextImpl context)
			{
				this._enclosing = _enclosing;
				this.context = context;
			}
Beispiel #13
0
		public override void Delete(DeleteContextImpl context, bool isUpdate)
		{
			context.SlotFormat().DoWithSlotIndirection(context, new _IClosure4_119(this, context
				));
		}
		public override void Delete(DeleteContextImpl context, bool isUpdate)
		{
		}
Beispiel #15
0
		// do nothing
		public abstract override void Delete(DeleteContextImpl context, bool isUpdate);
 public virtual void DeleteMembers(DeleteContextImpl context, bool isUpdate)
 {
     ITraverseAspectCommand command = new _MarshallingInfoTraverseAspectCommand_438(context
         , isUpdate, EnsureFieldList(context));
     TraverseAllAspects(context, command);
 }
 public virtual void DeleteMembers(DeleteContextImpl deleteContext, bool isUpdate)
 {
 }
 public DeleteContextImpl(Db4objects.Db4o.Internal.Delete.DeleteContextImpl parentContext
                          , IReflectClass fieldClass, Config4Field fieldConfig) : this(parentContext.StatefulBuffer
                                                                                           (), parentContext._objectHeader, fieldClass, fieldConfig)
 {
 }
Beispiel #19
0
 public override void Delete(DeleteContextImpl context, bool isUpdate)
 {
     if (isUpdate)
     {
         context.Seek(context.Offset() + LinkLength(context));
         return;
     }
     context.Seek(context.Offset() + Const4.IntLength);
     var longPart = context.ReadLong();
     if (longPart > 0)
     {
         if (context.Container().MaintainsIndices())
         {
             RemoveIndexEntry(context.Transaction(), context.ObjectId(), longPart);
         }
     }
 }