get_dsn_info and get_db_by_name doesnt support a connection to firebird because they firebird-connection-string is a little bit special (no host, everthing inside the dbname).
The solution contains also code for using params in the connectionstring.
function get_dsn_info($name) { $info = array(); $dsnsqlplugin = $this->get_dsn_by_name($name); $parsedsn = $dsnsqlplugin; $info['driver'] = strtok($parsedsn, ":"); $parsedsn = substr($parsedsn, strlen($info['driver']) + 3); $info['user'] = strtok($parsedsn, ":"); $parsedsn = substr($parsedsn, strlen($info['user']) + 1); $info['password'] = strtok($parsedsn, "@"); $parsedsn = substr($parsedsn, strlen($info['password']) + 1); if ($info['driver'] == 'firebird') { $info['host'] = null; } else { $info['host'] = strtok($parsedsn, "/"); $parsedsn = substr($parsedsn, strlen($info['host']) + 1); } $info['database'] = strtok($parsedsn, "?"); $parsedsn = substr($parsedsn, strlen($info['database']) + 1); $info['params'] = array(); while (strlen($parsedsn) > 0) { $param = strtok($parsedsn, "&"); $parsedsn = substr($parsedsn, strlen($param) + 1); $paramname = strtok($param, "="); $paramvalue = substr($param, strlen($paramname) + 1); $info['params'][$paramname] = $paramvalue; } return $info; }
function get_db_by_name( $name ) { include_once ('tiki-setup.php'); if ( $name == 'local' || empty($name) ) { return TikiDb::get(); } try { static $connectionMap = array(); if ( ! isset( $connectionMap[$name] ) ) { $connectionMap[$name] = false; $info = $this->get_dsn_info($name); $dbdriver = $info['driver']; $dbuserid = $info['user']; $dbpassword = $info['password']; $dbhost = $info['host']; $database = $info['database']; $params = $info['params']; $api_tiki = null; require 'db/local.php'; if (isset($api_tiki) && $api_tiki == 'adodb') { require_once ('lib/adodb/adodb.inc.php'); $dbsqlplugin = ADONewConnection($dbdriver); if ( $dbsqlplugin->NConnect($dbhost, $dbuserid, $dbpassword, $database) ) { $connectionMap[$name] = new TikiDb_AdoDb($dbsqlplugin); } } else { $connstr = $dbdriver.':'.(($dbhost)?'host='.$dbhost.';':'').'dbname='.$database; foreach($params as $name=>$value) $connstr .= ";$name=$value"; $dbsqlplugin = new PDO($connstr, $dbuserid, $dbpassword); $connectionMap[$name] = new TikiDb_Pdo($dbsqlplugin); } } return $connectionMap[$name]; } catch (Exception $e) { TikiLib::lib('errorreport')->report($e->getMessage()); } }
To help developers solve the bug, we kindly request that you demonstrate your bug on a show2.tiki.org instance. To start, simply select a version and click on "Create show2.tiki.org instance". Once the instance is ready (in a minute or two), as indicated in the status window below, you can then access that instance, login (the initial admin username/password is "admin") and configure the Tiki to demonstrate your bug. Priority will be given to bugs that have been demonstrated on show2.tiki.org.
To help developers solve the bug, we kindly request that you demonstrate your bug on a show.tikiwiki.org instance. To start, simply select a version and click on "Create show.tikiwiki.org instance". Once the instance is ready (in a minute or two), as indicated in the status window below, you can then access that instance, login (the initial admin username/password is "admin") and configure the Tiki to demonstrate your bug. Priority will be given to bugs that have been demonstrated on show.tikiwiki.org.
filename | created | hits | comment | version | filetype | ||
---|---|---|---|---|---|---|---|
No attachments for this item |