Пример #1
0
        public IndexPage(IndexFileInfo inf, byte [] data, DatabaseImp database)
        {
            if (inf.KeyCount > 100)
            {
                throw new System.Exception("Max number of index columns exceeded");
            }
            Inf      = inf;
            Database = database;
            bool leaf = IsLeafPage();

            ColStore = leaf ? inf.KeyCount : inf.Types.Length; // Currently these are the same.
            NodeSize = NodeOverhead + inf.KeySize() + (leaf ? 0 : PageIdSize);
            NodeBase = FixedHeader + (leaf ? 0 : PageIdSize) - NodeSize;

            MaxNode = (PageSize - (NodeBase + NodeSize)) / NodeSize;
            if (MaxNode > 2047)
            {
                MaxNode = 2047;           // Node ids are 11 bits.
            }
            if (data == null)
            {
                Data = new byte[PageSize];
            }
            else
            {
                Data = data;
                ReadHeader();
            }
            // Console.WriteLine( "New IndexPage Count=" + Count + " ColStore=" + ColStore + " NodeSize=" + NodeSize + " MaxNode=" + MaxNode );
        }
Пример #2
0
 public IndexFile( FullyBufferedStream f, IndexFileInfo inf, DatabaseImp d, long indexId )
 {
   F = f; Inf = inf; Database = d; IndexId = indexId;
   Initialise();
   //System.Console.WriteLine("New IndexFile " + " Root=" + Root + " PageAlloc=" + PageAlloc );
   //Dump();
 }
Пример #3
0
        bool Dirty;         // Has the table been modified since the last commit or rollback?

        public Table(DatabaseImp database, Schema schema, string name, ColInfo ci, long tableId)
        {
            Database = database;
            TableId  = tableId;
            schema.TableDict[name] = this;

            IxInfo   = new IndexInfo[0];
            DataFile = Database.OpenFile(FileType.Table, tableId);

            InitColumnInfo(ci);

            // System.Console.WriteLine( "Opened " + Schema + "." + name + " RowSize=" + RowSize + " RowCount=" + RowCount );
        }
Пример #4
0
        public Table(DatabaseImp db, Schema schema, string name, ColInfo cols, long tableId)
        {
            TableId = tableId;

            schema.TableDict[name] = this;

            Schema = schema.Name;
            Name   = name;
            Db     = db;
            Ix     = new IndexInfo[0];
            Cols   = cols;

            DF = Db.OpenFile(FileType.Table, tableId);

            RowSize  = CalcRowSize(Cols);
            RowCount = (long)(DF.Length / RowSize);

            RB = new byte[RowSize];

            // System.Console.WriteLine( "Opened " + Schema + "." + name + " RowSize=" + RowSize + " RowCount=" + RowCount );
        }
Пример #5
0
 public PageParent(IndexFileInfo inf, byte [] data, DatabaseImp d) : base(inf, data, d)
 {
 }