Esempio n. 1
0
        /// <exception cref="System.IO.IOException"></exception>
        protected internal Index(ByteBuffer tableBuffer, IList <IndexData> indexDatas, JetFormat
                                 format)
        {
            ByteUtil.Forward(tableBuffer, format.SKIP_BEFORE_INDEX_SLOT);
            //Forward past Unknown
            _indexNumber = tableBuffer.GetInt();
            int indexDataNumber = tableBuffer.GetInt();
            // read foreign key reference info
            byte relIndexType       = tableBuffer.Get();
            int  relIndexNumber     = tableBuffer.GetInt();
            int  relTablePageNumber = tableBuffer.GetInt();
            byte cascadeUpdatesFlag = tableBuffer.Get();
            byte cascadeDeletesFlag = tableBuffer.Get();

            _indexType = tableBuffer.Get();
            if ((_indexType == FOREIGN_KEY_INDEX_TYPE) && (relIndexNumber != INVALID_INDEX_NUMBER
                                                           ))
            {
                _reference = new Index.ForeignKeyReference(relIndexType, relIndexNumber, relTablePageNumber
                                                           , (cascadeUpdatesFlag == CASCADE_UPDATES_FLAG), (cascadeDeletesFlag == CASCADE_DELETES_FLAG
                                                                                                            ));
            }
            else
            {
                _reference = null;
            }
            ByteUtil.Forward(tableBuffer, format.SKIP_AFTER_INDEX_SLOT);
            //Skip past Unknown
            _data = indexDatas[indexDataNumber];
            _data.AddIndex(this);
        }