1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-04 21:28:02 +02:00

DibiMySqliDriver.php: fixes for HHVM

This commit is contained in:
David Grudl
2015-01-12 10:31:43 +01:00
parent 100f978b9b
commit 26b167fe13
2 changed files with 7 additions and 6 deletions

View File

@@ -402,7 +402,7 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver, IDibiResultD
/** /**
* Returns the result set resource. * Returns the result set resource.
* @return mysqli_result * @return resource
*/ */
public function getResultResource() public function getResultResource()
{ {

View File

@@ -79,7 +79,7 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver, IDibiResultDri
'timezone' => date('P'), 'timezone' => date('P'),
'username' => ini_get('mysqli.default_user'), 'username' => ini_get('mysqli.default_user'),
'password' => ini_get('mysqli.default_pw'), 'password' => ini_get('mysqli.default_pw'),
'socket' => ini_get('mysqli.default_socket'), 'socket' => (string) ini_get('mysqli.default_socket'),
'port' => NULL, 'port' => NULL,
); );
if (!isset($config['host'])) { if (!isset($config['host'])) {
@@ -420,9 +420,10 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver, IDibiResultDri
public function getResultColumns() public function getResultColumns()
{ {
static $types; static $types;
if (empty($types)) { if ($types === NULL) {
$consts = get_defined_constants(TRUE); $consts = get_defined_constants(TRUE);
foreach ($consts['mysqli'] as $key => $value) { $types = array();
foreach (isset($consts['mysqli']) ? $consts['mysqli'] : array() as $key => $value) {
if (strncmp($key, 'MYSQLI_TYPE_', 12) === 0) { if (strncmp($key, 'MYSQLI_TYPE_', 12) === 0) {
$types[$value] = substr($key, 12); $types[$value] = substr($key, 12);
} }
@@ -438,7 +439,7 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver, IDibiResultDri
'name' => $row['name'], 'name' => $row['name'],
'table' => $row['orgtable'], 'table' => $row['orgtable'],
'fullname' => $row['table'] ? $row['table'] . '.' . $row['name'] : $row['name'], 'fullname' => $row['table'] ? $row['table'] . '.' . $row['name'] : $row['name'],
'nativetype' => $types[$row['type']], 'nativetype' => isset($types[$row['type']]) ? $types[$row['type']] : $row['type'],
'vendor' => $row, 'vendor' => $row,
); );
} }
@@ -453,7 +454,7 @@ class DibiMySqliDriver extends DibiObject implements IDibiDriver, IDibiResultDri
public function getResultResource() public function getResultResource()
{ {
$this->autoFree = FALSE; $this->autoFree = FALSE;
return $this->resultSet === NULL || $this->resultSet->type === NULL ? NULL : $this->resultSet; return $this->resultSet;
} }
} }