summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2004-02-26 17:55:14 +0000
committerDries Buytaert <dries@buytaert.net>2004-02-26 17:55:14 +0000
commitdf2c03372906df166daccbbeb4cfd4540d798160 (patch)
tree9638d38009aa2eb77a0aa562fb1aa732c06eb03a
parentf54aab6a3eff4d917e1768f340b4774aec5bef61 (diff)
downloadbrdo-df2c03372906df166daccbbeb4cfd4540d798160.tar.gz
brdo-df2c03372906df166daccbbeb4cfd4540d798160.tar.bz2
- Patch 6066 by Adrian: PostgreSQL does not return 'affected rows' when doing
a select statement. Even though PEAR supports this functionality, it fails silently when using PostgreSQL. We use the db_num_rows() function instead to return the amount of rows returned. (According to Killes, the MySQL manual also states that it should not return affected rows on a 'select' statement.)
-rw-r--r--modules/node.module2
-rw-r--r--modules/node/node.module2
-rw-r--r--modules/user.module2
-rw-r--r--modules/user/user.module2
4 files changed, 4 insertions, 4 deletions
diff --git a/modules/node.module b/modules/node.module
index 7a15ef9ea..ed300212a 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -1491,7 +1491,7 @@ function node_delete($edit) {
function node_page_default() {
$result = pager_query('SELECT nid, type FROM {node} WHERE promote = 1 AND status = 1 ORDER BY static DESC, created DESC', variable_get('default_nodes_main', 10));
- if (db_affected_rows($result)) {
+ if (db_num_rows($result)) {
drupal_set_html_head('<link rel="alternate" type="application/rss+xml" title="RSS" href="'. url('node/feed') .'" />');
$output = '';
diff --git a/modules/node/node.module b/modules/node/node.module
index 7a15ef9ea..ed300212a 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -1491,7 +1491,7 @@ function node_delete($edit) {
function node_page_default() {
$result = pager_query('SELECT nid, type FROM {node} WHERE promote = 1 AND status = 1 ORDER BY static DESC, created DESC', variable_get('default_nodes_main', 10));
- if (db_affected_rows($result)) {
+ if (db_num_rows($result)) {
drupal_set_html_head('<link rel="alternate" type="application/rss+xml" title="RSS" href="'. url('node/feed') .'" />');
$output = '';
diff --git a/modules/user.module b/modules/user.module
index 4208d369f..52a396b07 100644
--- a/modules/user.module
+++ b/modules/user.module
@@ -391,7 +391,7 @@ function user_block($op = "list", $delta = 0) {
/* perform database queries to gather online user lists */
$guests = db_fetch_object(db_query("SELECT COUNT(DISTINCT sid) AS count FROM {sessions} WHERE timestamp >= %d AND uid = 0", time() - $time_period));
$users = db_query("SELECT DISTINCT uid, MAX(timestamp) AS max_timestamp FROM {sessions} WHERE timestamp >= %d AND uid != 0 GROUP BY uid ORDER BY max_timestamp DESC", time() - $time_period );
- $total_users = db_affected_rows();
+ $total_users = db_num_rows($users);
/* format the output with proper grammar */
if ($total_users == 1 && $guests->count == 1) {
diff --git a/modules/user/user.module b/modules/user/user.module
index 4208d369f..52a396b07 100644
--- a/modules/user/user.module
+++ b/modules/user/user.module
@@ -391,7 +391,7 @@ function user_block($op = "list", $delta = 0) {
/* perform database queries to gather online user lists */
$guests = db_fetch_object(db_query("SELECT COUNT(DISTINCT sid) AS count FROM {sessions} WHERE timestamp >= %d AND uid = 0", time() - $time_period));
$users = db_query("SELECT DISTINCT uid, MAX(timestamp) AS max_timestamp FROM {sessions} WHERE timestamp >= %d AND uid != 0 GROUP BY uid ORDER BY max_timestamp DESC", time() - $time_period );
- $total_users = db_affected_rows();
+ $total_users = db_num_rows($users);
/* format the output with proper grammar */
if ($total_users == 1 && $guests->count == 1) {