protected override void Process(FieldMetadata field)
			{
				if (!field.IsVirtual() && field.HasIndex())
				{
					this._enclosing.ProcessBTree(context, field.GetIndex(context.SystemTrans()));
				}
			}
Esempio n. 2
0
		public virtual void InitOnUp(Transaction systemTrans, FieldMetadata fieldMetadata
			)
		{
			ObjectContainerBase anyStream = systemTrans.Container();
			if (!anyStream.MaintainsIndices())
			{
				return;
			}
			if (!fieldMetadata.SupportsIndex())
			{
				Indexed(false);
			}
			TernaryBool indexedFlag = _config.GetAsTernaryBool(IndexedKey);
			if (indexedFlag.DefiniteNo())
			{
				fieldMetadata.DropIndex((LocalTransaction)systemTrans);
				return;
			}
			if (UseExistingIndex(systemTrans, fieldMetadata))
			{
				return;
			}
			if (!indexedFlag.DefiniteYes())
			{
				return;
			}
			fieldMetadata.CreateIndex();
		}
Esempio n. 3
0
 public virtual void TestDropIndex()
 {
     DropIndex(CatClass, CatFieldNames[0]);
     Db4objects.Db4o.Internal.FieldMetadata field = FieldMetadata(CatClass, CatFieldNames
                                                                  [0]);
     Assert.IsFalse(field.HasIndex());
 }
 protected override void Process(FieldMetadata field)
 {
     if (field.CanAddToQuery(fieldName))
     {
         visitor.Visit(new object[] { classMetadata, field });
     }
 }
Esempio n. 5
0
 public virtual void TestFieldIndex()
 {
     Db4objects.Db4o.Internal.FieldMetadata field0 = FieldMetadata(CatClass, CatFieldNames
                                                                   [0]);
     Assert.IsTrue(field0.HasIndex());
     Db4objects.Db4o.Internal.FieldMetadata field1 = FieldMetadata(CatClass, CatFieldNames
                                                                   [1]);
     Assert.IsFalse(field1.HasIndex());
 }
Esempio n. 6
0
        private Db4objects.Db4o.Internal.FieldMetadata FieldMetadata(string className, string
                                                                     fieldName)
        {
            ClassMetadata meta = ClassMetadataForName(className);

            Db4objects.Db4o.Internal.FieldMetadata field0 = meta.FieldMetadataForName(fieldName
                                                                                      );
            return(field0);
        }
        public virtual IStoredField StoredField(string name, object type)
        {
            FieldMetadata fieldMetadata = (FieldMetadata)_classMetadata.StoredField(name, type
                                                                                    );

            if (fieldMetadata == null)
            {
                return(null);
            }
            return(new StoredFieldImpl(_transaction, fieldMetadata));
        }
Esempio n. 8
0
 public override bool Equals(object obj)
 {
     if (!(obj is Db4objects.Db4o.Internal.FieldMetadata))
     {
         return(false);
     }
     Db4objects.Db4o.Internal.FieldMetadata other = (Db4objects.Db4o.Internal.FieldMetadata
                                                     )obj;
     other.Alive();
     Alive();
     return(other._isPrimitive == _isPrimitive && other._fieldType == _fieldType && other
            ._name.Equals(_name));
 }
Esempio n. 9
0
		public QField(Transaction a_trans, string name, FieldMetadata fieldMetadata, int 
			classMetadataID, int a_index)
		{
			// C/S only	
			i_trans = a_trans;
			i_name = name;
			_fieldMetadata = fieldMetadata;
			i_classMetadataID = classMetadataID;
			_fieldHandle = a_index;
			if (_fieldMetadata != null)
			{
				if (!_fieldMetadata.Alive())
				{
					_fieldMetadata = null;
				}
			}
		}
Esempio n. 10
0
			private void AddFieldConstraint(ClassMetadata containingClass, FieldMetadata field
				)
			{
				QConClass qcc = new QConClass(this._enclosing._trans, null, field.QField(this._enclosing
					._trans), containingClass.ClassReflector());
				this._enclosing.AddConstraint(qcc);
				this._enclosing.ToConstraint(this._enclosing.i_constraints).Or(qcc);
			}
		private object GetFieldValue(int id, FieldMetadata field)
		{
			SodaQueryComparator.FieldValueKey key = new SodaQueryComparator.FieldValueKey(id, 
				field);
			object cachedValue = _fieldValueCache[key];
			if (null != cachedValue)
			{
				return cachedValue;
			}
			object fieldValue = ReadFieldValue(id, field);
			_fieldValueCache[key] = fieldValue;
			return fieldValue;
		}
			protected override void Process(FieldMetadata field)
			{
				if (field.CanAddToQuery(fieldName))
				{
					visitor.Visit(new object[] { classMetadata, field });
				}
			}
Esempio n. 13
0
		public virtual void RequestIndexEntry(FieldMetadata fieldMetadata)
		{
			_indexedField = fieldMetadata;
		}
Esempio n. 14
0
 public StoredFieldImpl(Transaction transaction, FieldMetadata
                        fieldMetadata)
 {
     _transaction   = transaction;
     _fieldMetadata = fieldMetadata;
 }
			protected override void Process(FieldMetadata field)
			{
				Assert.IsNotNull(expectedNames.Remove(field.GetName()));
			}
Esempio n. 16
0
 public FieldIndexException(FieldMetadata field) : this(null, null, field)
 {
 }
Esempio n. 17
0
		public FieldIndexException(string msg, Exception cause, FieldMetadata field) : this
			(msg, cause, field.ContainingClass().GetName(), field.GetName())
		{
		}
Esempio n. 18
0
		public FieldIndexException(Exception cause, FieldMetadata field) : this(null, cause
			, field)
		{
		}
Esempio n. 19
0
		public FieldIndexException(string msg, FieldMetadata field) : this(msg, null, field
			)
		{
		}
Esempio n. 20
0
		public FieldIndexException(FieldMetadata field) : this(null, null, field)
		{
		}
Esempio n. 21
0
		private bool CollectReflectFields(Collection4 collectedAspects)
		{
			bool dirty = false;
			IReflectField[] reflectFieldArray = ReflectFields();
			for (int reflectFieldIndex = 0; reflectFieldIndex < reflectFieldArray.Length; ++reflectFieldIndex)
			{
				IReflectField reflectField = reflectFieldArray[reflectFieldIndex];
				if (!StoreField(reflectField))
				{
					continue;
				}
				Db4objects.Db4o.Internal.ClassMetadata classMetadata = Handlers4.ErasedFieldType(
					Container(), reflectField.GetFieldType());
				if (classMetadata == null)
				{
					continue;
				}
				FieldMetadata field = new FieldMetadata(this, reflectField, classMetadata);
				if (Contains(collectedAspects, field))
				{
					continue;
				}
				dirty = true;
				collectedAspects.Add(field);
			}
			return dirty;
		}
		private object ReadFieldValue(int id, FieldMetadata field)
		{
			ByteArrayBuffer buffer = BufferFor(id);
			HandlerVersion handlerVersion = field.ContainingClass().SeekToField(_transaction, 
				buffer, field);
			if (handlerVersion == HandlerVersion.Invalid)
			{
				return null;
			}
			QueryingReadContext context = new QueryingReadContext(_transaction, handlerVersion
				._number, buffer, id);
			return field.Read(context);
		}
Esempio n. 23
0
 public FieldIndexException(string msg, FieldMetadata field) : this(msg, null, field
                                                                    )
 {
 }
Esempio n. 24
0
 // Scrolls offset in passed reader to the offset the passed field should
 // be read at.
 public HandlerVersion SeekToField(Transaction trans, ByteArrayBuffer buffer, FieldMetadata
     field)
 {
     if (buffer == null)
     {
         return HandlerVersion.Invalid;
     }
     if (!StandardReferenceTypeHandlerIsUsed())
     {
         return HandlerVersion.Invalid;
     }
     buffer.Seek(0);
     var oh = new ObjectHeader(_container, buffer);
     var res = oh.ClassMetadata().SeekToField(new ObjectHeaderContext(trans, buffer,
         oh), field);
     if (!res)
     {
         return HandlerVersion.Invalid;
     }
     return new HandlerVersion(oh.HandlerVersion());
 }
Esempio n. 25
0
 public FieldIndexException(Exception cause, FieldMetadata field) : this(null, cause
                                                                         , field)
 {
 }
Esempio n. 26
0
 private bool UseExistingIndex(Transaction systemTrans, FieldMetadata fieldMetadata
                               )
 {
     return(fieldMetadata.GetIndex(systemTrans) != null);
 }
Esempio n. 27
0
 public FieldIndexException(string msg, Exception cause, FieldMetadata field) : this
     (msg, cause, field.ContainingClass().GetName(), field.GetName())
 {
 }
Esempio n. 28
0
		internal virtual void Unmarshall(Transaction a_trans)
		{
			if (i_classMetadataID != 0)
			{
				ClassMetadata yc = a_trans.Container().ClassMetadataForID(i_classMetadataID);
				_fieldMetadata = (FieldMetadata)yc._aspects[_fieldHandle];
			}
		}
Esempio n. 29
0
 protected override void Process(FieldMetadata field)
 {
     if (field.IsEnabledOn(AspectVersionContextImpl.CheckAlwaysEnabled))
     {
         field.CollectConstraints(trans, parentConstraint, obj, visitor);
     }
 }
Esempio n. 30
0
		public virtual void AddIndexEntry(FieldMetadata fieldMetadata, object obj)
		{
			if (!_currentBuffer.HasParent())
			{
				object indexEntry = (obj == _currentMarshalledObject) ? _currentIndexEntry : obj;
				if (_isNew || !UpdateDepth().CanSkip(_reference))
				{
					fieldMetadata.AddIndexEntry(Transaction(), ObjectID(), indexEntry);
				}
				return;
			}
			_currentBuffer.RequestIndexEntry(fieldMetadata);
		}
Esempio n. 31
0
		internal virtual bool Attach(QQuery query, string a_field)
		{
			Db4objects.Db4o.Internal.Query.Processor.QCon qcon = this;
			ClassMetadata yc = GetYapClass();
			bool[] foundField = new bool[] { false };
			ForEachChildField(a_field, new _IVisitor4_101(foundField, query));
			if (foundField[0])
			{
				return true;
			}
			QField qf = null;
			if (yc == null || yc.HoldsAnyClass())
			{
				int[] count = new int[] { 0 };
				FieldMetadata[] yfs = new FieldMetadata[] { null };
				i_trans.Container().ClassCollection().AttachQueryNode(a_field, new _IVisitor4_119
					(yfs, count));
				if (count[0] == 0)
				{
					return false;
				}
				if (count[0] == 1)
				{
					qf = yfs[0].QField(i_trans);
				}
				else
				{
					qf = new QField(i_trans, a_field, null, 0, 0);
				}
			}
			else
			{
				if (yc.IsTranslated())
				{
					i_trans.Container()._handlers.DiagnosticProcessor().DescendIntoTranslator(yc, a_field
						);
				}
				FieldMetadata yf = yc.FieldMetadataForName(a_field);
				if (yf != null)
				{
					qf = yf.QField(i_trans);
				}
				if (qf == null)
				{
					qf = new QField(i_trans, a_field, null, 0, 0);
				}
			}
			QConPath qcp = new QConPath(i_trans, qcon, qf);
			query.AddConstraint(qcp);
			qcon.AddConstraint(qcp);
			return true;
		}
Esempio n. 32
0
			protected override void Process(FieldMetadata field)
			{
				if (field.CanAddToQuery(fieldName))
				{
					foundField.value = field;
				}
			}
Esempio n. 33
0
 public virtual void RequestIndexEntry(FieldMetadata fieldMetadata)
 {
     _indexedField = fieldMetadata;
 }
Esempio n. 34
0
 public StoredFieldImpl(Transaction transaction, FieldMetadata
     fieldMetadata)
 {
     _transaction = transaction;
     _fieldMetadata = fieldMetadata;
 }
			public FieldValueKey(int id, FieldMetadata field)
			{
				_id = id;
				_field = field;
			}
Esempio n. 36
0
			public _IVisitor4_119(FieldMetadata[] yfs, int[] count)
			{
				this.yfs = yfs;
				this.count = count;
			}
Esempio n. 37
0
 public StoredFieldImpl(Transaction transaction, Db4objects.Db4o.Internal.FieldMetadata
                        fieldMetadata)
 {
     _transaction   = transaction;
     _fieldMetadata = fieldMetadata;
 }
Esempio n. 38
0
		private bool HasBTreeIndex(FieldMetadata field)
		{
			return !field.IsVirtual();
		}
Esempio n. 39
0
 private bool Contains(Collection4 collectedAspects, FieldMetadata field)
 {
     var aspectIterator = collectedAspects.GetEnumerator();
     while (aspectIterator.MoveNext())
     {
         if (((ClassAspect) aspectIterator.Current).Equals(field))
         {
             return true;
         }
     }
     return false;
 }
Esempio n. 40
0
 protected override void Process(FieldMetadata field)
 {
     if (name.Equals(field.GetName()))
     {
         byReference.value = field;
     }
 }
Esempio n. 41
0
 public _IClosure4_443(FieldMetadata _enclosing, DeleteContextImpl childContext)
 {
     this._enclosing   = _enclosing;
     this.childContext = childContext;
 }
Esempio n. 42
0
		public StoredFieldImpl(Transaction transaction, Db4objects.Db4o.Internal.FieldMetadata
			 fieldMetadata)
		{
			_transaction = transaction;
			_fieldMetadata = fieldMetadata;
		}
Esempio n. 43
0
 protected override void Process(FieldMetadata field)
 {
     if (foundField.value != null)
     {
         return;
     }
     if (field.GetName().Equals(fieldName))
     {
         if (fieldTypeFilter == null || fieldTypeFilter == field.FieldType())
         {
             foundField.value = field;
         }
     }
 }
Esempio n. 44
0
		private bool UseExistingIndex(Transaction systemTrans, FieldMetadata fieldMetadata
			)
		{
			return fieldMetadata.GetIndex(systemTrans) != null;
		}
Esempio n. 45
0
 private bool CollectReflectFields(Collection4 collectedAspects)
 {
     var dirty = false;
     var reflectFieldArray = ReflectFields();
     for (var reflectFieldIndex = 0; reflectFieldIndex < reflectFieldArray.Length; ++reflectFieldIndex)
     {
         var reflectField = reflectFieldArray[reflectFieldIndex];
         if (!StoreField(reflectField))
         {
             continue;
         }
         var classMetadata = Handlers4.ErasedFieldType(
             Container(), reflectField.GetFieldType());
         if (classMetadata == null)
         {
             continue;
         }
         var field = new FieldMetadata(this, reflectField, classMetadata);
         if (Contains(collectedAspects, field))
         {
             continue;
         }
         dirty = true;
         collectedAspects.Add(field);
     }
     return dirty;
 }