protected override void Process(FieldMetadata field) { if (!field.IsVirtual() && field.HasIndex()) { this._enclosing.ProcessBTree(context, field.GetIndex(context.SystemTrans())); } }
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(); }
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 }); } }
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()); }
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)); }
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)); }
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; } } }
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; }
public virtual void RequestIndexEntry(FieldMetadata fieldMetadata) { _indexedField = fieldMetadata; }
public StoredFieldImpl(Transaction transaction, FieldMetadata fieldMetadata) { _transaction = transaction; _fieldMetadata = fieldMetadata; }
protected override void Process(FieldMetadata field) { Assert.IsNotNull(expectedNames.Remove(field.GetName())); }
public FieldIndexException(FieldMetadata field) : this(null, null, field) { }
public FieldIndexException(string msg, Exception cause, FieldMetadata field) : this (msg, cause, field.ContainingClass().GetName(), field.GetName()) { }
public FieldIndexException(Exception cause, FieldMetadata field) : this(null, cause , field) { }
public FieldIndexException(string msg, FieldMetadata field) : this(msg, null, field ) { }
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); }
// 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()); }
private bool UseExistingIndex(Transaction systemTrans, FieldMetadata fieldMetadata ) { return(fieldMetadata.GetIndex(systemTrans) != null); }
internal virtual void Unmarshall(Transaction a_trans) { if (i_classMetadataID != 0) { ClassMetadata yc = a_trans.Container().ClassMetadataForID(i_classMetadataID); _fieldMetadata = (FieldMetadata)yc._aspects[_fieldHandle]; } }
protected override void Process(FieldMetadata field) { if (field.IsEnabledOn(AspectVersionContextImpl.CheckAlwaysEnabled)) { field.CollectConstraints(trans, parentConstraint, obj, visitor); } }
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); }
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; }
protected override void Process(FieldMetadata field) { if (field.CanAddToQuery(fieldName)) { foundField.value = field; } }
public FieldValueKey(int id, FieldMetadata field) { _id = id; _field = field; }
public _IVisitor4_119(FieldMetadata[] yfs, int[] count) { this.yfs = yfs; this.count = count; }
public StoredFieldImpl(Transaction transaction, Db4objects.Db4o.Internal.FieldMetadata fieldMetadata) { _transaction = transaction; _fieldMetadata = fieldMetadata; }
private bool HasBTreeIndex(FieldMetadata field) { return !field.IsVirtual(); }
private bool Contains(Collection4 collectedAspects, FieldMetadata field) { var aspectIterator = collectedAspects.GetEnumerator(); while (aspectIterator.MoveNext()) { if (((ClassAspect) aspectIterator.Current).Equals(field)) { return true; } } return false; }
protected override void Process(FieldMetadata field) { if (name.Equals(field.GetName())) { byReference.value = field; } }
public _IClosure4_443(FieldMetadata _enclosing, DeleteContextImpl childContext) { this._enclosing = _enclosing; this.childContext = childContext; }
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; } } }
private bool UseExistingIndex(Transaction systemTrans, FieldMetadata fieldMetadata ) { return fieldMetadata.GetIndex(systemTrans) != null; }
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; }