Starts the process.

@param array $dbConfig Database connection information
@return bool True on success, false otherwise
498892
public function install($dbConfig = [])
    {
        $this->_installed = true;

        if (!$this->prepareConfig($dbConfig)) {
            return false;
        }

        $conn = $this->getConn();
        if ($conn === false) {
            return false;
        }

        if (!$this->isDbEmpty($conn)) {
            return false;
        }

        if (!$this->importTables($conn)) {
            return false;
        }

        $this->writeSetting();

        return true;
    }
1122738
protected function processConfig(array $config)
    {
        $config['command_factory'] = self::defaultCommandFactory($this->getDescription());

        // we'll add our own patched processor after this
        parent::processConfig(
            array_merge(
                $config,
                [
                    'process' => false,
                ]
            )
        );

        if (!isset($config['process']) || $config['process'] === true) {
            $this->getEmitter()->attach(
                new ProcessResponse(
                    isset($config['debug']) ? $config['debug'] : false,
                    isset($config['response_locations']) ? $config['response_locations'] : []
                )
            );
        }
    }
999145
public function setupTracy($config = [])
    {
        $tracy = Tracy::instance($config);
        $databasePanel = $tracy->getPanel('database');
        $this->dispatcher->listen(QueryExecuted::class, function ($event) use ($databasePanel) {
            $sql = $event->sql;
            $bindings = $event->bindings;
            $time = $event->time;
            $name = $event->connectionName;
            $pdo = $event->connection->getPdo();

            $databasePanel->logQuery($sql, $bindings, $time, $name, $pdo);
        });
    }
848823
public function connect($config)
    {
        $this->connection = Db::connect($config);
        $this->setBuilder();
        return $this;
    }
529887
public function connect( $config )
    {
        if ( $config !== NULL )
        {
            $this->host     = $config[ 'db_host' ];
            $this->user     = $config[ 'db_user' ];
            $this->password = $config[ 'db_pass' ];
            $this->name     = $config[ 'db_name' ];

            try
            {
                $dns = "mysql:host=" . $this->host . ";dbname=" . $this->name;

                $this->database = new PDO( $dns, $config[ 'db_user' ], $config[ 'db_pass' ] );
            }
            catch ( Exception $e )
            {
                throw new DatabaseException( $e->getMessage() );
            }
        }
    }
498346
public function connect() {
		try {
			$this->_connect ();
			return true;
		} catch ( \PDOException $e ) {
			throw new DBException ( $e->getMessage (), $e->getCode (), $e->getPrevious () );
		}
	}
1216216
public function initiate(array $config): void
    {
        $this->fieldsets = new Collection();

        foreach ($config as $key => $value) {
            if (\property_exists($this, $key)) {
                $this->{$key} = $value;
            }
        }

        $this->data = new Fluent();
    }
352043
public static function db(ConfigInterface $dbConfig)
    {
        $key = md5(json_encode($dbConfig->get()));
        if (!isset(self::$dbInstances[$key])) {
            self::$dbInstances[$key] = new DB($dbConfig);
        }

        return self::$dbInstances[$key];
    }
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() );
            }
        }
    }
493024
private function init($config = array())
    {
        $this->getCore()->open($this->getFilename(), $config);
        if ($this->currentSheet !== null) {
            $this->getCore()->setSheet($this->currentSheet);
        }
    }
235845
public function connect(array $config){
		Connection::alias($config, 'database', 'file');
		Connection::alias($config, 'updateLimit', 'update_limit');

		$defaults = array(
			'memory' => false,
			'resource' => null,
			'updateLimit' => false,
			'charset' => 'UTF-8',
			'dbcharset' => 'UTF-8',
			'persistent' => false,
			'unbuffered' => false
		);

		$config += $defaults;

		if($config['memory'])
			$config['database'] = ':memory:';

		// Connect
		if(is_resource($config['resource']))
			$connection = $config['resource'];
		elseif(!isset($config['database']))
			throw new DriverException("No database file selected.");
		elseif($config['persistent'])
			$connection = @sqlite_popen($config['database'], 0666, $error);
		else
			$connection = @sqlite_open($config['database'], 0666, $error);

		if(!is_resource($connection))
			throw new DriverException("Opening database file '$config[database]' failed.");

		$this->resource = $connection;
		$this->updateLimit = (bool) $config['updateLimit'];

		// Set charset
		$this->dbCharset = $config['dbcharset'];
		$this->charset = $config['charset'];
		if(strcasecmp($this->dbCharset, $this->charset) === 0)
			$this->dbCharset = $this->charset = null;

		$this->unbuffered = $config['unbuffered'];
		$this->persistent = $config['persistent'];
	}
10296
public function setDbConn($dbconfig = [])
    {
        if (empty($dbconfig)) {
            $this->dbconfig = config('database');
            //$this->dbconfig = Config::get('database');
        } else {
            $this->dbconfig = $dbconfig;
        }
        return $this;
    }
1324149
public static function start(&$config)
    {
        $config = array_merge(array(
        
            /* default language */
            'language'      => 'en',

            /* GET param to override the language */
            'lang_param'    => 'lang',
            
            /* autodetect browser language */
            'autodetect'    => true,
            
            /* directory where language files are stored */
            'dir'           => 'app/languages'
    
        ), $config);
        self::$config = &$config;

        Atomik::registerHelper('translate', 'Atomik\Translations::translate');
        Atomik::registerHelper('_', 'Atomik\Translations::translate');
    }
187027
public function init(array $config = [])
    {
        if (!extension_loaded('redis')) {
            return false;
        }

        if (!empty($config['host'])) {
            $config['server'] = $config['host'];
        }

        parent::init($config);

        return $this->_connect();
    }
1059780
public function setup(array $config = [])
    {
        unset($config['request_params'], $config['request_context']);

        if (isset($config['query'])) {
            throw new Exception(translate('{query} can not be initialized'), 500, Exception::BADARGUMENTS);
        }

        if (isset($config['search']) && !is_callable($config['search'])) {
            throw new Exception(translate('{search} must be a callable'), 500, Exception::BADARGUMENTS);
        }

        if (!isset($config['data_source'])) {
            throw new Exception(translate('{data_source} must be a ActiveRecord objetc'), 500, Exception::BADARGUMENTS);
        } elseif (isset($config['data_source']) && !($config['data_source'] instanceof ActiveRecordInterface)) {
            throw new Exception(translate('{data_source} must be a ActiveRecord objetc'), 500, Exception::BADARGUMENTS);
        }

        foreach ($config as $property => $data) {
            if (property_exists($this, '_'.$property)) {
                $this->{'_'.$property} = $data;
            } elseif (property_exists($this, $property)) {
                $this->{$property} = $data;
            }
        }
    }
417540
public function checkDbConfig() {
        if (!$this->dbConfig || !$this->db) {
            $dbConfigs = array_keys(get_class_vars('DATABASE_CONFIG'));

            $this->out('Available database configurations:');

            foreach ($dbConfigs as $i => $db) {
                $this->out(sprintf('[%s] <info>%s</info>', $i, $db));
            }

            $this->out();

            $answer = $this->in('Which database should the queries be executed in?', array_keys($dbConfigs));

            if (isset($dbConfigs[$answer])) {
                $this->setDbConfig($dbConfigs[$answer]);
            } else {
                $this->checkDbConfig();
            }
        }

        $this->out(sprintf('Database Config: <info>%s</info>', $this->dbConfig));

        $answer = strtoupper($this->in('Is this correct?', array('Y', 'N')));

        if ($answer === 'N') {
            $this->dbConfig = null;
            $this->checkDbConfig();
        }

        // Check that database is connected
        if (!$this->db->isConnected()) {
            $this->err(sprintf('<error>Database connection for %s failed</error>', $this->dbConfig));
            return false;
        }

        $this->out('<success>Database check successful, proceeding...</success>');
        return true;
    }
262167
public static function init($config, $collectionConfig = array())
    {
        $first = null;

        static::$collectionConfig = $collectionConfig;

        if (empty($config)) {
            return;
        }

        foreach ($config as $key => $value) {
            $value['name'] = $key;

            if (!isset($value['driver'])) {
                throw new Exception(
                    '[Norm] Cannot instantiate connection "'.$key.
                    '", Driver "'.@$value['driver'].'" not found!'
                );
            }

            $Driver = $value['driver'];

            static::$connections[$key] = new $Driver($value);

            if (!static::$connections[$key] instanceof Connection) {
                throw new Exception('Norm connection ['.$key.'] should be instance of Connection');
            }

            if (!$first) {
                $first = $key;
            }
        }

        if (!static::$defaultConnection) {
            static::$defaultConnection = $first;
        }
    }