mirror of
https://github.com/dg/dibi.git
synced 2025-08-12 00:54:11 +02:00
DibiDriver::doQuery returns TRUE or DibiResult
This commit is contained in:
@@ -74,10 +74,9 @@ class DibiMsSqlDriver extends DibiDriver
|
||||
|
||||
if ($res === FALSE) {
|
||||
throw new DibiDatabaseException('Query error', 0, $sql);
|
||||
|
||||
} elseif (is_resource($res)) {
|
||||
return new DibiMSSqlResult($res);
|
||||
}
|
||||
|
||||
return is_resource($res) ? new DibiMSSqlResult($res) : TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -105,10 +105,9 @@ class DibiMySqlDriver extends DibiDriver
|
||||
|
||||
if ($res === FALSE) {
|
||||
throw new DibiDatabaseException(mysql_error($connection), mysql_errno($connection), $sql);
|
||||
|
||||
} elseif (is_resource($res)) {
|
||||
return new DibiMySqlResult($res);
|
||||
}
|
||||
|
||||
return is_resource($res) ? new DibiMySqlResult($res) : TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -79,10 +79,9 @@ class DibiMySqliDriver extends DibiDriver
|
||||
|
||||
if ($res === FALSE) {
|
||||
throw new DibiDatabaseException(mysqli_error($connection), mysqli_errno($connection), $sql);
|
||||
|
||||
} elseif (is_object($res)) {
|
||||
return new DibiMySqliResult($res);
|
||||
}
|
||||
|
||||
return is_object($res) ? new DibiMySqliResult($res) : TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -105,10 +105,9 @@ class DibiOdbcDriver extends DibiDriver
|
||||
|
||||
if ($res === FALSE) {
|
||||
throw new DibiDatabaseException(odbc_errormsg($connection), odbc_error($connection), $sql);
|
||||
|
||||
} elseif (is_resource($res)) {
|
||||
return new DibiOdbcResult($res);
|
||||
}
|
||||
|
||||
return is_resource($res) ? new DibiOdbcResult($res) : TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -64,16 +64,14 @@ class DibiPdoDriver extends DibiDriver
|
||||
protected function doQuery($sql)
|
||||
{
|
||||
$res = $this->getConnection()->query($sql);
|
||||
if ($res instanceof PDOStatement) {
|
||||
return new DibiPdoResult($res);
|
||||
}
|
||||
return $res instanceof PDOStatement ? new DibiPdoResult($res) : TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function affectedRows()
|
||||
{
|
||||
// not implemented
|
||||
throw new DibiException(__METHOD__ . ' is not implemented');
|
||||
}
|
||||
|
||||
|
||||
|
@@ -99,10 +99,9 @@ class DibiPostgreDriver extends DibiDriver
|
||||
|
||||
if ($res === FALSE) {
|
||||
throw new DibiDatabaseException(pg_last_error($connection), 0, $sql);
|
||||
|
||||
} elseif (is_resource($res)) {
|
||||
return new DibiPostgreResult($res);
|
||||
}
|
||||
|
||||
return is_resource($res) ? new DibiPostgreResult($res) : TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -77,10 +77,9 @@ class DibiSqliteDriver extends DibiDriver
|
||||
if ($res === FALSE) {
|
||||
$code = sqlite_last_error($connection);
|
||||
throw new DibiDatabaseException(sqlite_error_string($code), $code, $sql);
|
||||
|
||||
} elseif (is_resource($res)) {
|
||||
return new DibiSqliteResult($res);
|
||||
}
|
||||
|
||||
return is_resource($res) ? new DibiSqliteResult($res) : TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user