コード例 #1
0
ファイル: LocalDatabase.cs プロジェクト: prepare/deveeldb
        public IServerConnector Boot(IDbConfig config)
        {
            if (IsBooted)
                throw new DatabaseException("Database was booted more than once.");

            // Start the DbSystem and bind it to a IDatabaseInterface.
            if (System.Controller.IsInitialized(databaseName))
                dbsys = System.Controller.ConnectToDatabase(config, databaseName);
            else
                dbsys = System.Controller.StartDatabase(config, databaseName);

            var connector = new LocalEmbeddedServerConnector(this);

            IsBooted = true;
            ++openConnections;

            return connector;
        }
コード例 #2
0
ファイル: TestBase.cs プロジェクト: prepare/deveeldb
        public void FixtureSetUp()
        {
            DbConfig config = DbConfig.Default;
            OnConfigure(config);
            DbController controller = DbController.Create(config);

            system = !controller.DatabaseExists(config, DatabaseName)
                        ? controller.CreateDatabase(null, DatabaseName, AdminUser, AdminPassword)
                        : controller.StartDatabase(null, DatabaseName);

            OnSetUp();
        }
コード例 #3
0
ファイル: LocalDatabase.cs プロジェクト: prepare/deveeldb
        public IServerConnector Create(IDbConfig config, string userName, string password)
        {
            if (String.IsNullOrEmpty(userName))
                throw new ArgumentNullException("userName");
            if (String.IsNullOrEmpty(password))
                throw new ArgumentNullException("password");

            if (IsBooted)
                throw new DatabaseException("The database was already booted.");

            // Create the DbSystem and bind it to a IDatabaseInterface.
            dbsys = System.Controller.CreateDatabase(config, databaseName, userName, password);
            var connector = new LocalEmbeddedServerConnector(this);

            IsBooted = true;
            ++openConnections;

            return connector;
        }
コード例 #4
0
        public void SetUp()
        {
            DbConfig config = DbConfig.Default;
            OnConfigure(config);
            DbController controller = DbController.Create(Environment.CurrentDirectory, config);

            system = !controller.DatabaseExists(DatabaseName)
                        ? controller.CreateDatabase(config, DatabaseName, AdminUser, AdminPassword)
                        : controller.StartDatabase(config, DatabaseName);

            connection = (DeveelDbConnection)system.GetConnection(AdminUser, AdminPassword);
            // connection.AutoCommit = true;
        }