1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-11 16:44:30 +02:00

* new: DibiResult::fetchAssoc() supports "object" mode via @ descriptor

* fixed mysqli_set_charset in PHP < 5.1.5
This commit is contained in:
David Grudl
2007-12-07 16:51:17 +00:00
parent dfacb48449
commit 2c8906e7c4
2 changed files with 33 additions and 15 deletions

View File

@@ -108,8 +108,11 @@ class DibiMySqliDriver extends NObject implements DibiDriverInterface
}
if (isset($config['charset'])) {
// affects the character set used by mysql_real_escape_string() (was added in MySQL 5.0.7 and PHP 5.0.5)
$ok = @mysqli_set_charset($this->connection, $config['charset']);
$ok = FALSE;
if (version_compare(PHP_VERSION , '5.1.5', '>=')) {
// affects the character set used by mysql_real_escape_string() (was added in MySQL 5.0.7 and PHP 5.0.5, fixed in PHP 5.1.5)
$ok = @mysqli_set_charset($this->connection, $config['charset']);
}
if (!$ok) $ok = @mysqli_query($this->connection, "SET NAMES '$config[charset]'");
if (!$ok) $this->throwException();
}