protected virtual void GetRecord(int x, ref IndexFileRecord r)
        {
            if (r.Col == null)
            {
                r.Col = new Value[ColStore];
            }
            int off = NodeOverhead + NodeBase + x * NodeSize;

            for (int i = 0; i < ColStore; i += 1)
            {
                DataType t    = Inf.Types[i];
                int      size = DTI.Size(t);
                ulong    u    = Get(off, size);
                off += size;

                if (t == DataType.Float)
                {
                    u = Conv.UnpackFloat((uint)u);
                }
                else if (t == DataType.Int)
                {
                    u = (ulong)(long)(int)(uint)u;
                }
                else if (t == DataType.Smallint)
                {
                    u = (ulong)(long)(short)(ushort)u;
                }
                else if (t == DataType.Tinyint)
                {
                    u = (ulong)(long)(sbyte)(byte)u;
                }

                r.Col[i].L = (long)u;
                if (t == DataType.String)
                {
                    r.Col[i]._O = Database.DecodeString((long)u);
                }
                else if (t == DataType.Binary)
                {
                    r.Col[i]._O = Database.DecodeBinary((long)u);
                }
            }
        }
Ejemplo n.º 2
0
        public override bool Get(long id, Value[] row, bool [] used)
        {
            if (id <= 0 || id > RowCount)
            {
                return(false);
            }

            DF.Position = (id - 1) * RowSize;
            int ix; byte [] RB = DF.FastRead(RowSize, out ix);

            if (RB[ix++] == 0)
            {
                return(false);         // Row has been deleted
            }
            row[0].L = id;
            DataType [] types = Cols.Types;
            byte []     sizes = Cols.Sizes;
            for (int i = 1; i < types.Length; i += 1)
            {
                int size = sizes[i];
                if (used == null || used [i]) // Column not skipped
                {
                    DataType t = types[i];
                    long     x = (long)Util.Get(RB, ix, size, t);
                    row[i].L = x;
                    if (t <= DataType.String)
                    {
                        row[i]._O =
                            t == DataType.Binary ? (object)Db.DecodeBinary(x): (object)Db.DecodeString(x);
                    }
                }
                ix += size;
            }
            return(true);
        }