Example #1
0
        /// <summary>
        /// Adds the tables to the database with the passed in schema
        /// </summary>
        /// <param name="fill">A database fill object.</param>
        private void FillTables(DbFill fill)
        {
            var schema = fill.Schema;

            foreach (var table in schema.Tables)
            {
                this.Tables.Add(new Table2(_process, table, this.Storage, _process.Cache));
            }
        }
Example #2
0
        /// <summary>
        /// Creates a database from a DBFill object. Used when booting up from disk.
        /// </summary>
        /// <param name="process">The FrostDB process.</param>
        /// <param name="fill">A DBFill object (usually loaded from disk.)</param>
        public Database2(Process process, DbFill fill, DbStorage storage)
        {
            _tables     = new List <Table2>();
            _process    = process;
            _name       = fill.Schema.DatabaseName;
            _databaseId = fill.Schema.DatabaseId;
            _storage    = storage;
            _schema     = fill.Schema;
            FillTables(fill);

            // to do: anything else?
        }
Example #3
0
        /// <summary>
        /// Returns a populated database object by reading all files on disk.
        /// </summary>
        /// <param name="databaseName">The name of the database to get</param>
        /// <returns>A database object</returns>
        public Database2 GetDatabase(string databaseName)
        {
            _databaseName = databaseName;
            // TO DO: Build the DB fill process
            var fill = new DbFill();

            fill.Schema               = GetSchema();
            _databaseId               = fill.Schema.DatabaseId;
            fill.PendingParticpants   = GetPendingParticipants();
            fill.AcceptedParticipants = GetAcceptedParticipants();

            return(new Database2(_process, fill, this));
        }