Commit 233040 by dries
- Patch #509122 by Berdir: rest in peace db_affected_rows().
--- includes/database/database.inc 2009/07/03 04:36:50 1.58
+++ includes/database/database.inc 2009/07/03 10:57:46 1.59
@@ -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 @@
$this->setFetchMode($options['fetch']);
}
}
- $this->dbh->lastStatement = $this;
$logger = $this->dbh->getLogger();
if (!empty($logger)) {
@@ -2539,21 +2528,6 @@
}
/**
- * 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()
--- includes/database/prefetch.inc 2009/04/20 20:02:30 1.5
+++ includes/database/prefetch.inc 2009/07/03 10:57:46 1.6
@@ -1,5 +1,5 @@
<?php
-// $Id$
+// $Id: prefetch.inc,v 1.5 2009/04/20 20:02:30 dries Exp $
/**
* @file
@@ -154,7 +154,6 @@
$this->setFetchMode($options['fetch']);
}
}
- $this->dbh->lastStatement = $this;
$logger = $this->dbh->getLogger();
if (!empty($logger)) {
--- modules/node/node.module 2009/07/02 04:27:23 1.1077
+++ modules/node/node.module 2009/07/03 10:57:46 1.1078
@@ -522,11 +522,10 @@
* 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();
}
/**
+++ includes/database/database.inc 2009/07/03 10:57:46 1.59
@@ -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 @@
$this->setFetchMode($options['fetch']);
}
}
- $this->dbh->lastStatement = $this;
$logger = $this->dbh->getLogger();
if (!empty($logger)) {
@@ -2539,21 +2528,6 @@
}
/**
- * 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()
--- includes/database/prefetch.inc 2009/04/20 20:02:30 1.5
+++ includes/database/prefetch.inc 2009/07/03 10:57:46 1.6
@@ -1,5 +1,5 @@
<?php
-// $Id$
+// $Id: prefetch.inc,v 1.5 2009/04/20 20:02:30 dries Exp $
/**
* @file
@@ -154,7 +154,6 @@
$this->setFetchMode($options['fetch']);
}
}
- $this->dbh->lastStatement = $this;
$logger = $this->dbh->getLogger();
if (!empty($logger)) {
--- modules/node/node.module 2009/07/02 04:27:23 1.1077
+++ modules/node/node.module 2009/07/03 10:57:46 1.1078
@@ -522,11 +522,10 @@
* 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();
}
/**