예제 #1
0
        /// <summary>
        /// Gets a value from the tree
        /// </summary>
        /// <param name="Key"></param>
        /// <returns></returns>
        public Record GetValue(Record Key)
        {
            Record x = this.GetKeyValue(Key);

            if (x == null)
            {
                return(null);
            }

            return(Record.Split(x, this._ValueFields));
        }
예제 #2
0
        /// <summary>
        /// Gets a value from the tree
        /// </summary>
        /// <param name="Key"></param>
        /// <returns></returns>
        public Record GetValue2(Record Composite)
        {
            Record x = this.GetKeyValue(Composite);

            if (x == null)
            {
                return(null);
            }

            return(Record.Split(x, this._ValueFields));
        }
예제 #3
0
        /// <summary>
        /// Gets a record, invluding the key and value
        /// </summary>
        /// <param name="Key"></param>
        /// <returns></returns>
        public Record GetKeyValue2(Record Composite)
        {
            // Check the last key first //
            if (this._LastKey != null)
            {
                if (Record.Compare(Record.Split(Composite, this._KeyFields), this._LastKey) == 0)
                {
                    return(this._Cluster.Storage.GetPage(this._LastRef.PAGE_ID).Select(this._LastRef.ROW_ID));
                }
            }

            // Get the record key //
            RecordKey x = this._Cluster.FindFirst(Composite, true);

            // This should really only trigger if the table is empty; actually, this should never trigger //
            if (x.IsNotFound)
            {
                return(null);
            }

            // Select the record, and if it's null, return //
            Record y = this._Cluster.Storage.TrySelect(x);

            if (y == null)
            {
                return(null);
            }

            // Need to check if we didn't find the actual record //
            if (Record.Compare(y, Composite, this._KeyFields) == 0)
            {
                this._LastRef = x;
                this._LastKey = Record.Split(Composite, this._KeyFields);
                return(y);
            }

            // Not found //
            return(null);
        }
예제 #4
0
파일: Record.cs 프로젝트: pwdlugosz/Spectre
 /// <summary>
 /// Splits a record according to a key
 /// </summary>
 /// <param name="R"></param>
 /// <param name="K"></param>
 /// <returns></returns>
 public static Record operator *(Record R, Key K)
 {
     return(Record.Split(R, K));
 }