method getConnection documentation in bbn\Db\Languages\Sqlite

function(array $cfg = []) { $cfg['engine'] = 'sqlite'; if (!isset($cfg['db']) && \defined('BBN_DATABASE')) { $cfg['db'] = BBN_DATABASE; } if (empty($cfg['db']) || !\is_string($cfg['db'])) { throw new \Exception('Database name is not specified'); } if (is_file($cfg['db'])) { $info = X::pathinfo($cfg['db']); $cfg['host'] = $info['dirname'].DIRECTORY_SEPARATOR; $cfg['db'] = $info['basename']; } elseif (\defined('BBN_DATA_PATH') && is_dir(BBN_DATA_PATH.'db') && (strpos($cfg['db'], '/') === false) ) { $cfg['host'] = BBN_DATA_PATH.'db'.DIRECTORY_SEPARATOR; if (!is_file(BBN_DATA_PATH.'db'.DIRECTORY_SEPARATOR.$cfg['db']) && (strpos($cfg['db'], '.') === false) ) { $cfg['db'] .= '.sqlite'; } } else{ $info = X::pathinfo($cfg['db']); if (is_writable($info['dirname'])) { $cfg['host'] = $info['dirname'].DIRECTORY_SEPARATOR; $cfg['db'] = isset($info['extension']) ? $info['basename'] : $info['basename'].'.sqlite'; } } if (!isset($cfg['host'])) { throw new \Exception('Db file could not be located'); } $cfg['args'] = ['sqlite:'.$cfg['host'].$cfg['db']]; $cfg['db'] = 'main'; return $cfg; }

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.