diff options
author | Mario <mario@mariovavti.com> | 2022-02-10 19:45:08 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2022-02-10 19:45:08 +0000 |
commit | 521c9eb5660df0a954f68499b905f8dc1958bbb3 (patch) | |
tree | e075212a0fcb3037b3b8b9a3fb409ea8172d40f4 /include | |
parent | 8e79a81b8879b38c06ce3f7a211b87e838773f60 (diff) | |
parent | 35877b13825b2c3db44ff89977344b84f8e21d9a (diff) | |
download | volse-hubzilla-521c9eb5660df0a954f68499b905f8dc1958bbb3.tar.gz volse-hubzilla-521c9eb5660df0a954f68499b905f8dc1958bbb3.tar.bz2 volse-hubzilla-521c9eb5660df0a954f68499b905f8dc1958bbb3.zip |
Merge branch 'dev'
Diffstat (limited to 'include')
-rw-r--r-- | include/dba/dba_driver.php | 12 | ||||
-rw-r--r-- | include/dba/dba_pdo.php | 6 |
2 files changed, 9 insertions, 9 deletions
diff --git a/include/dba/dba_driver.php b/include/dba/dba_driver.php index b96601fec..152be7f88 100644 --- a/include/dba/dba_driver.php +++ b/include/dba/dba_driver.php @@ -38,7 +38,7 @@ class DBA { * @param bool $install Defaults to false * @return null|dba_driver A database driver object (dba_pdo) or null if no driver found. */ - static public function dba_factory($server,$port,$user,$pass,$db,$dbtype,$install = false) { + static public function dba_factory($server,$port,$user,$pass,$db,$dbtype,$db_charset,$install = false) { self::$dba = null; self::$dbtype = intval($dbtype); @@ -65,7 +65,7 @@ class DBA { } require_once('include/dba/dba_pdo.php'); - self::$dba = new dba_pdo($server,self::$scheme,$port,$user,$pass,$db,$install); + self::$dba = new dba_pdo($server,self::$scheme,$port,$user,$pass,$db,$db_charset,$install); define('NULL_DATE', self::$null_date); define('ACTIVE_DBTYPE', self::$dbtype); @@ -105,7 +105,7 @@ abstract class dba_driver { * @param string $db database name * @return bool */ - abstract function connect($server, $scheme, $port, $user, $pass, $db); + abstract function connect($server, $scheme, $port, $user, $pass, $db, $db_charset); /** * @brief Perform a DB query with the SQL statement $sql. @@ -139,11 +139,11 @@ abstract class dba_driver { */ abstract function getdriver(); - function __construct($server, $scheme, $port, $user,$pass,$db,$install = false) { - if(($install) && (! $this->install($server, $scheme, $port, $user, $pass, $db))) { + function __construct($server, $scheme, $port, $user,$pass,$db,$db_charset,$install = false) { + if(($install) && (! $this->install($server, $scheme, $port, $user, $pass, $db, $db_charset))) { return; } - $this->connect($server, $scheme, $port, $user, $pass, $db); + $this->connect($server, $scheme, $port, $user, $pass, $db, $db_charset); } function get_null_date() { diff --git a/include/dba/dba_pdo.php b/include/dba/dba_pdo.php index 2137ca0cc..c8a1b6c85 100644 --- a/include/dba/dba_pdo.php +++ b/include/dba/dba_pdo.php @@ -14,7 +14,7 @@ class dba_pdo extends dba_driver { * {@inheritDoc} * @see dba_driver::connect() */ - function connect($server, $scheme, $port, $user, $pass, $db) { + function connect($server, $scheme, $port, $user, $pass, $db, $db_charset) { $this->driver_dbtype = $scheme; @@ -28,10 +28,10 @@ class dba_pdo extends dba_driver { $dsn .= ';dbname=' . $db; if ($this->driver_dbtype === 'mysql') { - $dsn .= ';charset=utf8mb4'; + $dsn .= ';charset=' . $db_charset; } else { - $dsn .= ";options='--client_encoding=UTF8'"; + $dsn .= ";options='--client_encoding=" . $db_charset . "'"; } try { |