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);
            }
        }
Beispiel #2
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;
        }