Exemple #1
0
        internal TableStructure(BinaryReader structReader, DBStructure dbStructure)
        {
            _dbStructure = dbStructure;
            _name        = structReader.ReadString();
            _tracer      = new Tracer("(DBUtils) Table structure - " + _name);
            if (_dbStructure.Version >= 3)
            {
                _nextID = structReader.ReadInt32();
            }
            if (_dbStructure.Version >= 18)
            {
                _totalCount = structReader.ReadInt32();
            }
            _dirty = structReader.ReadBoolean();
            int count = structReader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                ColumnStructure column = new ColumnStructure(structReader);
                if (_columns.Contains(column.Name))
                {
                    throw new ColumnAlreadyExistsException("Table structure already contains such column", column.Name);
                }
                _columns.Add(column.Name, column);
            }
            int compoundCount = structReader.ReadInt32();

            for (int i = 0; i < compoundCount; i++)
            {
                string firstColumn  = structReader.ReadString();
                string secondColumn = structReader.ReadString();
                if (_compoundIndexes.Contains(firstColumn))
                {
                    throw new IndexAlreadyExistsException("Table structure already contains such compound index: " +
                                                          firstColumn + " : " + secondColumn);
                }
                _compoundIndexes.Add(firstColumn, secondColumn);
            }
            if (_dbStructure.Version >= 12)
            {
                compoundCount = structReader.ReadInt32();
                for (int i = 0; i < compoundCount; i++)
                {
                    CompoundWithValue compoundWithValue = new CompoundWithValue();
                    compoundWithValue.firstColumn  = structReader.ReadString();
                    compoundWithValue.secondColumn = structReader.ReadString();
                    compoundWithValue.valueColumn  = structReader.ReadString();
                    if (_compoundIndexesWithValue.Contains(compoundWithValue.firstColumn))
                    {
                        throw new IndexAlreadyExistsException("Table structure already contains such compound index with value" +
                                                              compoundWithValue.firstColumn + " : " + compoundWithValue.secondColumn +
                                                              " : " + compoundWithValue.valueColumn);
                    }
                    _compoundIndexesWithValue.Add(compoundWithValue.firstColumn, compoundWithValue);
                }
            }
        }
Exemple #2
0
        public Database(DBStructure dbStructure)
        {
            _dbStructure = dbStructure;
            int databaseCacheSize = 0x20000;

            if (ICore.Instance != null)
            {
                databaseCacheSize = Core.SettingStore.ReadInt("Omea", "DatabaseCacheSize", 2048 * 1024);
            }
            _bfs = new BlobFileSystem(
                IOTools.Combine(Path, Name) + ".BlobFileSystem.dbUtil", databaseCacheSize >> 3, 256);
            _tracer = new Tracer("(DBUtils) Database - " + Name);
        }
Exemple #3
0
 internal TableStructure(string name, DBStructure dbStructure)
 {
     _dbStructure = dbStructure;
     _name        = name;
     _tracer      = new Tracer("(DBUtils) Table structure - " + _name);
 }