summaryrefslogtreecommitdiff
path: root/modules/system
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2007-08-12 15:55:36 +0000
committerDries Buytaert <dries@buytaert.net>2007-08-12 15:55:36 +0000
commitb134b023e11902ceae12f3ab861da1f0a2fdbdbd (patch)
treefc0f0be2b23f047dd692e615e3671318f6d60f4d /modules/system
parent4e6068baf2c4dcb776efbdeb16621ffbdfa42c0f (diff)
downloadbrdo-b134b023e11902ceae12f3ab861da1f0a2fdbdbd.tar.gz
brdo-b134b023e11902ceae12f3ab861da1f0a2fdbdbd.tar.bz2
- Patch #163191 by hswong3i: removed db_num_rows() for compatibility with Oracle and DB2. Also a performance improvement.
Diffstat (limited to 'modules/system')
-rw-r--r--modules/system/system.install7
-rw-r--r--modules/system/system.module6
2 files changed, 7 insertions, 6 deletions
diff --git a/modules/system/system.install b/modules/system/system.install
index 37f67941c..a1ab612d2 100644
--- a/modules/system/system.install
+++ b/modules/system/system.install
@@ -1428,8 +1428,9 @@ function system_update_159() {
$ret = array();
$result = db_query_range("SELECT * FROM {old_revisions} WHERE done = 0 AND type IN ('page', 'story', 'poll', 'book', 'forum', 'blog') ORDER BY nid DESC", 0, 20);
+ $result_rows = db_result(db_query_range("SELECT COUNT(*) FROM {old_revisions} WHERE done = 0 AND type IN ('page', 'story', 'poll', 'book', 'forum', 'blog') ORDER BY nid DESC", 0, 20));
- if (db_num_rows($result)) {
+ if ($result_rows) {
$vid = db_next_id('{node_revisions}_vid');
while ($node = db_fetch_object($result)) {
$revisions = unserialize($node->revisions);
@@ -1519,7 +1520,7 @@ function system_update_159() {
}
}
- if (db_num_rows($result) < 20) {
+ if ($result_rows < 20) {
$ret[] = update_sql('ALTER TABLE {old_revisions} DROP done');
}
else {
@@ -2179,7 +2180,7 @@ function system_update_179() {
}
// Done?
- if (db_num_rows($result) == 0) {
+ if (!$field) {
unset($_SESSION['system_update_179_uid']);
unset($_SESSION['system_update_179_fid']);
unset($_SESSION['system_update_179_max']);
diff --git a/modules/system/system.module b/modules/system/system.module
index 681c520d7..db2d8712f 100644
--- a/modules/system/system.module
+++ b/modules/system/system.module
@@ -463,8 +463,8 @@ function system_admin_theme_settings() {
function system_admin_theme_submit($form, &$form_state) {
// If we're changing themes, make sure the theme has its blocks initialized.
if ($form_state['values']['admin_theme'] != variable_get('admin_theme', '0')) {
- $result = db_query("SELECT status FROM {blocks} WHERE theme = '%s'", $form_state['values']['admin_theme']);
- if (!db_num_rows($result)) {
+ $result = db_result(db_query("SELECT COUNT(*) FROM {blocks} WHERE theme = '%s'", $form_state['values']['admin_theme']));
+ if (!$result) {
system_initialize_theme_blocks($form_state['values']['admin_theme']);
}
}
@@ -1266,7 +1266,7 @@ function system_default_region($theme) {
*/
function system_initialize_theme_blocks($theme) {
// Initialize theme's blocks if none already registered.
- if (!(db_num_rows(db_query("SELECT module FROM {blocks} WHERE theme = '%s'", $theme)))) {
+ if (!(db_result(db_query("SELECT COUNT(*) FROM {blocks} WHERE theme = '%s'", $theme)))) {
$default_theme = variable_get('theme_default', 'garland');
$regions = system_region_list($theme);
$result = db_query("SELECT * FROM {blocks} WHERE theme = '%s'", $default_theme);