Esempio n. 1
0
        protected virtual IDatabase CreateDatabase(IDatabaseContext context)
        {
            var database = new Database(context);
            database.Create(AdminUserName, AdminPassword);
            database.Open();

            return database;
        }
Esempio n. 2
0
        public TableSourceComposite(Database database)
        {
            Database = database;

            tempStoreSystem = new InMemoryStorageSystem();
            objectStates = new List<TransactionObjectState>();

            StateStoreName = String.Format("{0}_{1}", database.Name(), StateStorePostfix);

            Setup();
        }
Esempio n. 3
0
        internal Transaction(Database database, int commitId, TransactionIsolation isolation, IEnumerable<TableSource> committedTables, IEnumerable<IIndexSet> indexSets)
        {
            CommitId = commitId;
            Database = database;
            Isolation = isolation;

            InitManagers();

            Registry = new TransactionRegistry(this);
            tableManager.AddVisibleTables(committedTables, indexSets);

            AddInternalTables();

            OldNewTableState = new OldNewTableState();

            IsClosed = false;

            Database.TransactionFactory.OpenTransactions.AddTransaction(this);

            currentSchema = database.DatabaseContext.DefaultSchema();
            readOnly = dbReadOnly = database.DatabaseContext.ReadOnly();
            autoCommit = database.DatabaseContext.AutoCommit();
            ignoreCase = database.DatabaseContext.IgnoreIdentifiersCase();
        }
Esempio n. 4
0
 internal Transaction(Database database, int commitId, TransactionIsolation isolation)
     : this(database, commitId, isolation, new TableSource[0], new IIndexSet[0])
 {
 }
Esempio n. 5
0
        public void TestSetup()
        {
            testSequenceName = ObjectName.Parse("APP.test_sequence");

            var dbConfig = DbConfig.Empty;
            dbConfig.SetValue(DatabaseConfigKeys.DatabaseName, "testdb");

            var systemContext = new SystemContext(DbConfig.SystemDefault);
            var dbContext = new DatabaseContext(systemContext, dbConfig);
            var database = new Database(dbContext);
            database.Create("SA", "12345");
            database.Open();

            transaction = database.CreateTransaction(TransactionIsolation.Serializable);

            if (TestContext.CurrentContext.Test.Name != "CreateNormalSequence") {
                var seqInfo = new SequenceInfo(testSequenceName, new SqlNumber(0), new SqlNumber(1), new SqlNumber(0), new SqlNumber(Int64.MaxValue), 126);
                transaction.CreateSequence(seqInfo);
            }
        }
Esempio n. 6
0
 public DatabaseTransactionFactory(Database database)
 {
     this.database = database;
     OpenTransactions = new TransactionCollection();
 }
Esempio n. 7
0
        // ---------- Static methods ----------
        /// <summary>
        /// Creates a Database object for the given DbConfig configuration.
        /// </summary>
        /// <param name="config"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        private static IDatabase CreateDatabase(IDbConfig config, string name)
        {
            var context = new DatabaseContext();

            // Initialize the DatabaseSystem first,
            // ------------------------------------

            // This will throw an Error exception if the database system has already
            // been initialized.
            context.Init(config);

            // Start the database class
            // ------------------------

            var database = new Database(context, name);

            // Start up message
            database.Context.Logger.Trace(typeof(DbController), "Starting Database Server");

            return database;
        }