method __construct documentation in bbn\Db\Languages\Mysql

Constructor

function(array $cfg) { if (!\extension_loaded('pdo_mysql')) { throw new \Exception(X::_("The MySQL driver for PDO is not installed...")); } $cfg = $this->getConnection($cfg); try { $this->cacheInit(); $this->current = $cfg['db'] ?? null; $this->host = $cfg['host'] ?? '127.0.0.1'; $this->username = $cfg['user'] ?? null; $this->connection_code = $cfg['code_host']; $this->pdo = new \PDO(...$cfg['args']); $this->pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION); $this->cfg = $cfg; $this->setHash($cfg['args']); if (!empty($cfg['cache_length'])) { $this->cache_renewal = (int)$cfg['cache_length']; } if (isset($cfg['on_error'])) { $this->on_error = $cfg['on_error']; } unset($cfg['pass']); } catch (\PDOException $e) { $err = X::_("Impossible to create the connection") . " $cfg[engine] ".X::_("to")." {$this->host} " . X::_("with the following error") . " " . $e->getMessage(); X::log($cfg); throw new \Exception($err); } }

Constructor BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.