Skip to content

Commit e62abd4

Browse files
committed
Fix getting the proper dbname
1 parent a2ce94e commit e62abd4

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

includes/qi_functions.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -463,17 +463,19 @@ function db_connect($db_data = '')
463463

464464
if (empty($db_data))
465465
{
466-
list($dbms, $dbhost, $dbuser, $dbpasswd, $dbport) = $settings->get_db_data();
466+
list($dbms, $dbhost, $dbuser, $dbpasswd, $dbport, $db_prefix) = $settings->get_db_data();
467467
// When db_data is empty, it means the db does not exist yet, so for postgres
468468
// we need to set dbname to false so the driver can connect to the postgres db
469469
$dbname = ($dbms !== 'postgres') ? $settings->get_config('dbname') : false;
470470
}
471471
else
472472
{
473-
list($dbms, $dbhost, $dbuser, $dbpasswd, $dbport) = $db_data;
473+
list($dbms, $dbhost, $dbuser, $dbpasswd, $dbport, $db_prefix) = $db_data;
474474
$dbname = $settings->get_config('dbname');
475475
}
476476

477+
$dbname = $dbname ? $db_prefix . $dbname : $dbname;
478+
477479
// If we get here and the extension isn't loaded it should be safe to just go ahead and load it
478480
$available_dbms = qi_get_available_dbms($dbms);
479481

includes/settings.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,7 @@ public function get_db_data()
477477
$this->get_config('dbuser'),
478478
$this->get_config('dbpasswd'),
479479
$this->get_config('dbport'),
480+
$this->get_config('db_prefix'),
480481
];
481482
}
482483

0 commit comments

Comments
 (0)