1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-05 05:37:39 +02:00

DibiFluent::execute(dibi::AFFECTED_ROWS) returns number of affected rows

This commit is contained in:
daliborcaja
2013-05-15 14:14:42 +03:00
committed by David Grudl
parent 5599dde525
commit f348828223
2 changed files with 10 additions and 2 deletions

View File

@@ -63,7 +63,8 @@ class dibi
DATETIME = 't', DATETIME = 't',
TIME = 't'; TIME = 't';
const IDENTIFIER = 'n'; const IDENTIFIER = 'n',
AFFECTED_ROWS = 'a';
/** @deprecated */ /** @deprecated */
const FIELD_TEXT = dibi::TEXT, const FIELD_TEXT = dibi::TEXT,

View File

@@ -309,7 +309,14 @@ class DibiFluent extends DibiObject implements IDataSource
public function execute($return = NULL) public function execute($return = NULL)
{ {
$res = $this->query($this->_export()); $res = $this->query($this->_export());
return $return === dibi::IDENTIFIER ? $this->connection->getInsertId() : $res; switch ($return) {
case dibi::IDENTIFIER:
return $this->connection->getInsertId();
case dibi::AFFECTED_ROWS:
return $this->connection->getAffectedRows();
default:
return $res;
}
} }