mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 07:53:39 +01:00
removing for some of our ADOdb patches
This commit is contained in:
parent
27fc9a48d2
commit
651be2a4cf
@ -1685,6 +1685,16 @@ class StreamWrapper implements Vfs\StreamWrapperIface
|
||||
}
|
||||
$pdo_available = true;
|
||||
}
|
||||
// set client charset of the connection
|
||||
switch(self::$pdo_type)
|
||||
{
|
||||
case 'mysql':
|
||||
$dsn .= ';charset=utf8';
|
||||
break;
|
||||
case 'pgsql':
|
||||
$query = "SET NAMES 'utf-8'";
|
||||
break;
|
||||
}
|
||||
try {
|
||||
self::$pdo = new \PDO($dsn,$egw_db->User,$egw_db->Password,array(
|
||||
\PDO::ATTR_ERRMODE=>\PDO::ERRMODE_EXCEPTION,
|
||||
@ -1696,17 +1706,6 @@ class StreamWrapper implements Vfs\StreamWrapperIface
|
||||
// Exception reveals password, so we ignore the exception and connect again without pw, to get the right exception without pw
|
||||
self::$pdo = new \PDO($dsn,$egw_db->User,'$egw_db->Password');
|
||||
}
|
||||
// set client charset of the connection
|
||||
$charset = translation::charset();
|
||||
switch(self::$pdo_type)
|
||||
{
|
||||
case 'mysql':
|
||||
if (isset($egw_db->Link_ID->charset2mysql[$charset])) $charset = $egw_db->Link_ID->charset2mysql[$charset];
|
||||
// fall throught
|
||||
case 'pgsql':
|
||||
$query = "SET NAMES '$charset'";
|
||||
break;
|
||||
}
|
||||
if ($query)
|
||||
{
|
||||
self::$pdo->exec($query);
|
||||
|
@ -7,7 +7,7 @@
|
||||
* @package api
|
||||
* @subpackage db
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2003-14 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2003-16 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
@ -487,7 +487,16 @@ class egw_db
|
||||
break;
|
||||
|
||||
case 'mysqlt':
|
||||
$php_extension = 'mysql'; // you can use $this->setupType to determine if it's mysqlt or mysql
|
||||
case 'mysql':
|
||||
// if mysqli is available silently switch to it, mysql extension is deprecated and no longer available in php7+
|
||||
if (check_load_extension('mysqli'))
|
||||
{
|
||||
$php_extension = $Type = 'mysqli';
|
||||
}
|
||||
else
|
||||
{
|
||||
$php_extension = 'mysql'; // you can use $this->setupType to determine if it's mysqlt or mysql
|
||||
}
|
||||
// fall through
|
||||
case 'mysqli':
|
||||
$this->Type = 'mysql'; // need to be "mysql", so apps can check just for "mysql"!
|
||||
@ -521,6 +530,11 @@ class egw_db
|
||||
{
|
||||
throw new egw_exception_db_connection("No ADOdb support for '$Type' ($this->Type) !!!");
|
||||
}
|
||||
if ($Type == 'mysqli')
|
||||
{
|
||||
// set a connection timeout of 1 second, to allow quicker failover to other db-nodes (default is 20s)
|
||||
$this->Link_ID->setConnectionParameter(MYSQLI_OPT_CONNECT_TIMEOUT, 1);
|
||||
}
|
||||
$connect = $GLOBALS['egw_info']['server']['db_persistent'] ? 'PConnect' : 'Connect';
|
||||
if (($Ok = $this->Link_ID->$connect($Host, $User, $Password, $Database)))
|
||||
{
|
||||
@ -549,7 +563,7 @@ class egw_db
|
||||
ini_set('mssql.sizelimit',2147483647);
|
||||
}
|
||||
// set our default charset
|
||||
$this->Link_ID->SetCharSet('utf-8');
|
||||
$this->Link_ID->SetCharSet($this->Type == 'mysql' ? 'utf8' : 'utf-8');
|
||||
|
||||
$new_connection = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user