summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2009-07-03 10:57:46 +0000
committerDries Buytaert <dries@buytaert.net>2009-07-03 10:57:46 +0000
commit4cd373bf2ccbcd4645d52e3e4b2a25d74ef5b905 (patch)
treeea4e918187a30d635836f39698436409f42900bf
parent293ea4c569154ad9b486d04168cf653d33dde558 (diff)
downloadbrdo-4cd373bf2ccbcd4645d52e3e4b2a25d74ef5b905.tar.gz
brdo-4cd373bf2ccbcd4645d52e3e4b2a25d74ef5b905.tar.bz2
- Patch #509122 by Berdir: rest in peace db_affected_rows().
-rw-r--r--includes/database/database.inc26
-rw-r--r--includes/database/prefetch.inc1
-rw-r--r--modules/node/node.module3
3 files changed, 1 insertions, 29 deletions
diff --git a/includes/database/database.inc b/includes/database/database.inc
index 7ac323a37..c66bb79af 100644
--- a/includes/database/database.inc
+++ b/includes/database/database.inc
@@ -184,16 +184,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.
*
* We need this information for later auditing and logging.
@@ -1681,7 +1671,6 @@ class DatabaseStatementBase extends PDOStatement implements DatabaseStatementInt
$this->setFetchMode($options['fetch']);
}
}
- $this->dbh->lastStatement = $this;
$logger = $this->dbh->getLogger();
if (!empty($logger)) {
@@ -2539,21 +2528,6 @@ function db_last_insert_id($table, $field) {
}
/**
- * 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.
*
* Collects JOIN and WHERE statements via hook_db_rewrite_sql()
diff --git a/includes/database/prefetch.inc b/includes/database/prefetch.inc
index e4db32464..73608b82e 100644
--- a/includes/database/prefetch.inc
+++ b/includes/database/prefetch.inc
@@ -154,7 +154,6 @@ class DatabaseStatementPrefetch implements Iterator, DatabaseStatementInterface
$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 9934fcc1e..28a476d14 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();
}
/**