method __construct documentation in bbn\Db
Constructor
Example
$dbtest = new bbn\Db(['db_user' => 'test','db_engine' => 'mysql','db_host' => 'host','db_pass' => 't6pZDwRdfp4IM']);
// (void)
function(array $cfg = [])
{
if (!isset($cfg['engine']) && \defined('BBN_DB_ENGINE')) {
$cfg['engine'] = BBN_DB_ENGINE;
}
if (isset($cfg['engine'])) {
if ($cfg['engine'] instanceof Engines) {
$this->language = $cfg['engine'];
}
else {
$engine = $cfg['engine'];
$cls = '\\bbn\\Db\\Languages\\'.ucwords($engine);
if (!class_exists($cls)) {
throw new Exception(X::_("The database engine %s is not recognized", $engine));
}
$this->language = new $cls($cfg);
}
self::retrieverInit($this);
$this->cacheInit();
if ($cfg = $this->getCfg()) {
$this->postCreation();
$this->engine = (string)$cfg['engine'];
$this->startFancyStuff();
}
}
if (!$this->engine) {
$connection = $cfg['engine'] ?? 'No engine';
$connection .= '/'.($cfg['db'] ?? 'No DB');
$this->log(X::_("Impossible to create the connection for").' '.$connection);
throw new Exception(X::_("Impossible to create the connection for").' '.$connection);
}
}
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.
© 2011-2025
BBN Solutions