예제 #1
0
        public IEnumerable <int> GetLinkedDNTags(int dnTag, string attributeName)
        {
            SchemaAttribute attr = this.schema.FindAttribute(attributeName);

            if (!attr.LinkId.HasValue)
            {
                //TODO: Throw a proper exception
                // TODO: Check that attribute type is DN
                throw new Exception("This is not a linked multivalue attribute.");
            }
            int linkId = attr.LinkId.Value;
            // Remove the rightmost bit that indicates if this is a forward link or a backlink.
            int linkBase = linkId >> 1;
            // Columns order in index: link_DNT, link_base, backlink_DNT
            Key key = Key.Compose(dnTag, linkBase);

            key.AddWildcard();
            cursor.FindRecords(MatchCriteria.EqualTo, key);
            while (cursor.MoveNext())
            {
                // TODO: Not deactivated?
                int foundTag = (int)cursor.IndexRecord[backlinkDNCol];
                yield return(foundTag);
            }
        }
예제 #2
0
        private void FindLinkedRecords(int dnTag, string attributeName)
        {
            SchemaAttribute attr = this.schema.FindAttribute(attributeName);

            if (!attr.LinkId.HasValue)
            {
                //TODO: Throw a proper exception
                throw new Exception("This is not a linked multivalue attribute.");
            }

            int linkBase = attr.LinkBase.Value;
            // Columns order in index: link_DNT, link_base, backlink_DNT
            Key key = Key.Compose(dnTag, linkBase);

            key.AddWildcard();
            this.cursor.FindRecords(MatchCriteria.EqualTo, key);
        }