Commit 4cd373bf authored by Dries's avatar Dries

- Patch #509122 by Berdir: rest in peace db_affected_rows().

parent 293ea4c5
......@@ -183,16 +183,6 @@
*/
abstract class DatabaseConnection extends PDO {
/**
* Reference to the last statement that was executed.
*
* We only need this for the legacy db_affected_rows() call, which will be removed.
*
* @var DatabaseStatementInterface
* @todo Remove this variable.
*/
public $lastStatement;
/**
* The database target this connection is for.
*
......@@ -1681,7 +1671,6 @@ public function execute($args = array(), $options = array()) {
$this->setFetchMode($options['fetch']);
}
}
$this->dbh->lastStatement = $this;
$logger = $this->dbh->getLogger();
if (!empty($logger)) {
......@@ -2538,21 +2527,6 @@ function db_last_insert_id($table, $field) {
return Database::getConnection()->lastInsertId($sequence_name);
}
/**
* Determine the number of rows changed by the preceding query.
*
* This may not work, actually, without some tricky temp code.
*
* @todo Remove this function when all queries have been ported to db_update().
*/
function db_affected_rows() {
$statement = Database::getConnection()->lastStatement;
if (!$statement) {
return 0;
}
return $statement->rowCount();
}
/**
* Helper function for db_rewrite_sql.
*
......
......@@ -154,7 +154,6 @@ public function execute($args = array(), $options = array()) {
$this->setFetchMode($options['fetch']);
}
}
$this->dbh->lastStatement = $this;
$logger = $this->dbh->getLogger();
if (!empty($logger)) {
......
......@@ -522,11 +522,10 @@ function node_type_delete($type) {
* The number of nodes whose node type field was modified.
*/
function node_type_update_nodes($old_type, $type) {
db_update('node')
return db_update('node')
->fields(array('type' => $type))
->condition('type', $old_type)
->execute();
return db_affected_rows();
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment