Create a database

@access public
@param string $database The database name to create
439300
public function create_database($database) {
		$query = 'CREATE DATABASE ' . $this->quote_identifier($database);
		$statement = $this->get_statement($query);

		$statement->execute();
	}
672478
protected function dropDatabase($database)
    {
        $connection = $this->pool->getConnection();
        $database = $database ?? $connection->defaultDatabase;

        $connection->getRawConnection()->dropDatabase($database);
    }
719549
public static function drop_database($database, $db = null)
	{
		return \DB::query('DROP DATABASE '.\DB::quote_identifier($database, $db ? $db : static::$connection), \DB::DELETE)->execute($db ? $db : static::$connection);
	}
491479
public function setDatabase($database)
    {
        $this->_options[ConnectionOptions::OPTION_DATABASE] = $database;
        $this->_database                                    = $database;

        $this->updateHttpHeader();
    }
702157
def db_create(database, containment='NONE', new_database_options=None, **kwargs):
    '''
    
    '''
    if containment not in ['NONE', 'PARTIAL']:
        return 'CONTAINMENT can be one of NONE and PARTIAL'
    sql = "CREATE DATABASE [{0}] CONTAINMENT = {1} ".format(database, containment)
    if new_database_options:
        sql += ' WITH ' + ', '.join(new_database_options)
    conn = None
    try:
        conn = _get_connection(**kwargs)
        conn.autocommit(True)
        # cur = conn.cursor()
        # cur.execute(sql)
        conn.cursor().execute(sql)
    except Exception as e:
        return 'Could not create the login: {0}'.format(e)
    finally:
        if conn:
            conn.autocommit(False)
            conn.close()
    return True
351338
def create_database(self, instance, name, character_set=None,
            collate=None):
        """"""
        return instance.create_database(name, character_set=character_set,
                collate=collate)
27087
public function database(string $database = null): MongoDatabase
    {
        if (empty($database)) {
            $database = $this->config->defaultDatabase();
        }

        //Spiral support ability to link multiple virtual databases together using aliases
        $database = $this->config->resolveAlias($database);

        if (isset($this->databases[$database])) {
            return $this->databases[$database];
        }

        if (!$this->config->hasDatabase($database)) {
            throw new ODMException(
                "Unable to initiate MongoDatabase, no presets for '{$database}' found"
            );
        }

        $options = $this->config->databaseOptions($database);

        //Initiating database instance
        return $this->createDatabase(
            $database,
            $options['server'],
            $options['database'],
            $options['driverOptions'] ?? [],
            $options['options'] ?? []
        );
    }
332325
function createDatabase(database, callback) {

    database.type = databases.alias(database.type);

    //
    // Make sure that the user is passing in a valid database type
    //
    if (databases.available.indexOf(database.type) === -1) {
      jitsu.log.warn('Invalid database type ' + database.type.red);
      database.type = null;
      return promptForDatabase(callback);
    }

    jitsu.databases.create(database.type, database.name, function (err, a, res) {
      if (err || res.statusCode >= 400) {
        //
        // TODO: Refactor this error handling
        //
        if (err && (err.statusCode === 409 || err.statusCode === 404)) {
          jitsu.log.error('Database with name ' + database.name.magenta + ' already exists');
          jitsu.log.info('Try again with a new database name');
          database.name = null;
          return promptForDatabase(callback);
        }
        else {
          jitsu.log.error('Database could not be created');
          jitsu.log.error(err || ('Unknown error code: ' + res.statusCode));
          jitsu.log.error('Try again and if it still fails, please contact nodejitsu');
          return callback(err);
        }
      }
      else {
        jitsu.log.info('A new ' + database.type.magenta + ' has been created');
      }

      databases.get(database.name, callback);
    });
  }
204291
protected function _select_db($database)
	{
		if ($this->_config['connection']['database'] !== static::$_current_databases[$this->_connection_id])
		{
			if ($this->_connection->select_db($database) !== true)
			{
				// Unable to select database
				throw new \Database_Exception($this->_connection->error, $this->_connection->errno);
			}
		}

		static::$_current_databases[$this->_connection_id] = $database;
	}
1292616
public function connect( $config )
    {
        if ( $config !== NULL )
        {
            if ( NULL === $config[ 'db_name' ] || '' === $config[ 'db_name' ] )
            {
                throw new DatabaseException( 'Invalid database name.' );
            }

            $this->name = $config[ 'db_name' ];

            try
            {
                $dns = "sqlite:" . $this->name;

                $this->database = new PDO( $dns );

            }
            catch ( Exception $e )
            {
                throw new DatabaseException( $e->getMessage() );
            }
        }
    }
1020591
public function create()
    {
        $conn = $this->connection->getConnection();
        $db = r\db($this->connection->getDatabaseName());
        $db->tableCreate($this->table)->run($conn);
    }
297527
protected function createDatabase()
    {
        /** @var Container $container */
        $container = $this->console->container;

        $dbService = $container->get(DatabaseService::class);
        $config    = $dbService->getDbConfig();

        // Auto create database
        $name = $config['name'];

        $config['name'] = null;

        $db = $dbService->createConnection('_preset', $config->toArray());

        $db->getDatabase($name)->create(true);

        $db->select($name);

        $config['name'] = $name;
    }
823242
public function connectDatabase($database = array())
    {
        $model = new BaseModel();
        if (isset($this->options['debugStatus']) && $this->options['debugStatus'] === TRUE) {
            $model->debugStatus = $this->options['debugStatus'];
            if (isset($this->options['debugLevel']) && !empty($this->options['debugLevel'])) {
                $model->debugLevel = $this->options['debugLevel'];
            }
            if (isset($this->options['loggerPath']) && !empty($this->options['loggerPath'])) {
                $model->debugLoggerPath = $this->options['loggerPath'];
            }
            $model->debugLoggerFilename = 'Log-' . date('Y-m-d') . '.log';
            $model->__construct();
        }
        $model->setDatabase($database);

        return $model;
    }
1234424
protected function connectDatabase($database)
    {
        $parameters = $this->parameters;
        $parameters['database'] = $database;
        $parameters['multipleactiveresultsets'] = 0;

        // Ensure that driver is available (required by PDO)
        if (empty($parameters['driver'])) {
            $parameters['driver'] = $this->getDatabaseServer();
        }

        // Notify connector of parameters, instructing the connector
        // to connect immediately to the Azure database
        $this->connector->connect($parameters, true);

        // Configure the connection
        $this->query('SET QUOTED_IDENTIFIER ON');
        $this->query('SET TEXTSIZE 2147483647');
    }
1092999
public function select($database)
	{
		$this->connect();

		$this->setQuery('USE ' . $this->quoteName($database));

		$this->execute();

		return $this;
	}
961707
public function startDatabase($database)
    {
        assert($this->_platform instanceof SQLAnywherePlatform);
        $this->_execSql($this->_platform->getStartDatabaseSQL($database));
    }
976653
def create_database(self, database):
        
        url = "db"

        data = {'name': database}

        self.request(
            url=url,
            method='POST',
            data=data,
            expected_response_code=201
        )

        return True