Beispiel #1
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);
        }
Beispiel #2
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;
		}