mirror of
https://github.com/dg/dibi.git
synced 2025-08-05 13:47:33 +02:00
- query returns DibiResult or number of affected rows now
This commit is contained in:
@@ -264,7 +264,7 @@ class dibi
|
|||||||
/**
|
/**
|
||||||
* Generates and executes SQL query - Monostate for DibiConnection::query().
|
* Generates and executes SQL query - Monostate for DibiConnection::query().
|
||||||
* @param array|mixed one or more arguments
|
* @param array|mixed one or more arguments
|
||||||
* @return DibiResult|NULL result set object (if any)
|
* @return DibiResult|int result set object (if any)
|
||||||
* @throws DibiException
|
* @throws DibiException
|
||||||
*/
|
*/
|
||||||
public static function query($args)
|
public static function query($args)
|
||||||
@@ -278,7 +278,7 @@ class dibi
|
|||||||
/**
|
/**
|
||||||
* Executes the SQL query - Monostate for DibiConnection::nativeQuery().
|
* Executes the SQL query - Monostate for DibiConnection::nativeQuery().
|
||||||
* @param string SQL statement.
|
* @param string SQL statement.
|
||||||
* @return DibiResult|NULL result set object (if any)
|
* @return DibiResult|int result set object (if any)
|
||||||
*/
|
*/
|
||||||
public static function nativeQuery($sql)
|
public static function nativeQuery($sql)
|
||||||
{
|
{
|
||||||
|
@@ -235,7 +235,7 @@ class DibiConnection extends DibiObject
|
|||||||
/**
|
/**
|
||||||
* Generates (translates) and executes SQL query.
|
* Generates (translates) and executes SQL query.
|
||||||
* @param array|mixed one or more arguments
|
* @param array|mixed one or more arguments
|
||||||
* @return DibiResult|NULL result set object (if any)
|
* @return DibiResult|int result set object (if any)
|
||||||
* @throws DibiException
|
* @throws DibiException
|
||||||
*/
|
*/
|
||||||
final public function query($args)
|
final public function query($args)
|
||||||
@@ -292,7 +292,7 @@ class DibiConnection extends DibiObject
|
|||||||
/**
|
/**
|
||||||
* Executes the SQL query.
|
* Executes the SQL query.
|
||||||
* @param string SQL statement.
|
* @param string SQL statement.
|
||||||
* @return DibiResult|NULL result set object (if any)
|
* @return DibiResult|int result set object (if any)
|
||||||
* @throws DibiException
|
* @throws DibiException
|
||||||
*/
|
*/
|
||||||
final public function nativeQuery($sql)
|
final public function nativeQuery($sql)
|
||||||
@@ -318,6 +318,8 @@ class DibiConnection extends DibiObject
|
|||||||
|
|
||||||
if ($res = $this->driver->query($sql)) { // intentionally =
|
if ($res = $this->driver->query($sql)) { // intentionally =
|
||||||
$res = new DibiResult($res, $this->config);
|
$res = new DibiResult($res, $this->config);
|
||||||
|
} else {
|
||||||
|
$res = $this->driver->affectedRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
$time += microtime(TRUE);
|
$time += microtime(TRUE);
|
||||||
|
@@ -240,12 +240,14 @@ class DibiFluent extends DibiObject implements Countable, IteratorAggregate
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Generates and executes SQL query.
|
* Generates and executes SQL query.
|
||||||
* @return DibiResult|NULL result set object (if any)
|
* @param mixed what to return?
|
||||||
|
* @return DibiResult|int result set object (if any)
|
||||||
* @throws DibiException
|
* @throws DibiException
|
||||||
*/
|
*/
|
||||||
public function execute()
|
public function execute($return = NULL)
|
||||||
{
|
{
|
||||||
return $this->connection->query($this->_export());
|
$res = $this->connection->query($this->_export());
|
||||||
|
return $return === dibi::IDENTIFIER ? $this->connection->insertId() : $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user