mirror of
https://github.com/dg/dibi.git
synced 2025-08-07 22:56:35 +02:00
Updated DibiFirebirdDriver & DibiMsSql2005Driver
This commit is contained in:
@@ -333,7 +333,7 @@ class DibiFirebirdDriver extends DibiObject implements IDibiDriver
|
|||||||
public function fetch($assoc)
|
public function fetch($assoc)
|
||||||
{
|
{
|
||||||
DibiDriverException::tryError();
|
DibiDriverException::tryError();
|
||||||
$result = $assoc ? ibase_fetch_assoc($this->resultSet) : ibase_fetch_row($this->resultSet); // intentionally @
|
$result = $assoc ? ibase_fetch_assoc($this->resultSet, IBASE_TEXT) : ibase_fetch_row($this->resultSet, IBASE_TEXT); // intentionally @
|
||||||
|
|
||||||
if (DibiDriverException::catchError($msg)) {
|
if (DibiDriverException::catchError($msg)) {
|
||||||
if (ibase_errcode() == self::ERROR_EXCEPTION_THROWN) {
|
if (ibase_errcode() == self::ERROR_EXCEPTION_THROWN) {
|
||||||
|
@@ -40,9 +40,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver
|
|||||||
/** @var resource Resultset resource */
|
/** @var resource Resultset resource */
|
||||||
private $resultSet;
|
private $resultSet;
|
||||||
|
|
||||||
/** @var string character encoding */
|
|
||||||
private $charset;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -66,8 +63,10 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver
|
|||||||
{
|
{
|
||||||
if (isset($config['resource'])) {
|
if (isset($config['resource'])) {
|
||||||
$this->connection = $config['resource'];
|
$this->connection = $config['resource'];
|
||||||
|
|
||||||
} elseif (isset($config['options'])) {
|
} elseif (isset($config['options'])) {
|
||||||
$this->connection = sqlsrv_connect($config['host'], $config['options']);
|
$this->connection = sqlsrv_connect($config['host'], (array) $config['options']);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$this->connection = sqlsrv_connect($config['host']);
|
$this->connection = sqlsrv_connect($config['host']);
|
||||||
}
|
}
|
||||||
@@ -76,8 +75,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver
|
|||||||
$info = sqlsrv_errors();
|
$info = sqlsrv_errors();
|
||||||
throw new DibiDriverException($info[0]['message'], $info[0]['code']);
|
throw new DibiDriverException($info[0]['message'], $info[0]['code']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->charset = empty($config['charset']) ? 'UTF-8' : $config['charset'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -101,7 +98,6 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver
|
|||||||
*/
|
*/
|
||||||
public function query($sql)
|
public function query($sql)
|
||||||
{
|
{
|
||||||
$sql = iconv($this->charset, 'UTF-16LE', $sql);
|
|
||||||
$this->resultSet = sqlsrv_query($this->connection, $sql);
|
$this->resultSet = sqlsrv_query($this->connection, $sql);
|
||||||
|
|
||||||
if ($this->resultSet === FALSE) {
|
if ($this->resultSet === FALSE) {
|
||||||
@@ -291,13 +287,7 @@ class DibiMsSql2005Driver extends DibiObject implements IDibiDriver
|
|||||||
*/
|
*/
|
||||||
public function fetch($assoc)
|
public function fetch($assoc)
|
||||||
{
|
{
|
||||||
$row = sqlsrv_fetch_array($this->resultSet, $assoc ? SQLSRV_FETCH_ASSOC : SQLSRV_FETCH_NUMERIC);
|
return sqlsrv_fetch_array($this->resultSet, $assoc ? SQLSRV_FETCH_ASSOC : SQLSRV_FETCH_NUMERIC);
|
||||||
foreach ($row as $k => $v) {
|
|
||||||
if (is_string($v)) {
|
|
||||||
$row[$k] = iconv('UTF-16LE', $this->charset, $v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $row;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user