From 4cd373bf2ccbcd4645d52e3e4b2a25d74ef5b905 Mon Sep 17 00:00:00 2001 From: Dries Buytaert <dries@buytaert.net> Date: Fri, 3 Jul 2009 10:57:46 +0000 Subject: [PATCH] - Patch #509122 by Berdir: rest in peace db_affected_rows(). --- includes/database/database.inc | 26 -------------------------- includes/database/prefetch.inc | 1 - modules/node/node.module | 3 +-- 3 files changed, 1 insertion(+), 29 deletions(-) diff --git a/includes/database/database.inc b/includes/database/database.inc index 7ac323a37c96..c66bb79af230 100644 --- a/includes/database/database.inc +++ b/includes/database/database.inc @@ -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. * diff --git a/includes/database/prefetch.inc b/includes/database/prefetch.inc index e4db324645de..73608b82e78f 100644 --- a/includes/database/prefetch.inc +++ b/includes/database/prefetch.inc @@ -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)) { diff --git a/modules/node/node.module b/modules/node/node.module index 9934fcc1eef3..28a476d14b81 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -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(); } /** -- GitLab