? dblog_dbtng-2.patch
? dblog_dbtng.patch
Index: modules/dblog/dblog.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/dblog/dblog.admin.inc,v
retrieving revision 1.13
diff -u -p -r1.13 dblog.admin.inc
--- modules/dblog/dblog.admin.inc	26 Feb 2009 07:30:26 -0000	1.13
+++ modules/dblog/dblog.admin.inc	7 Mar 2009 19:02:54 -0000
@@ -72,7 +72,7 @@ function dblog_overview() {
     $result = pager_query($sql . $tablesort, 50);
   }
 
-  while ($dblog = db_fetch_object($result)) {
+  foreach ($result as $dblog) {
     $rows[] = array('data' =>
       array(
         // Cells
@@ -112,7 +112,7 @@ function dblog_top($type) {
   $result = pager_query("SELECT COUNT(wid) AS count, message, variables FROM {watchdog} WHERE type = '%s' GROUP BY message, variables " . tablesort_sql($header), 30, 0, "SELECT COUNT(DISTINCT(message)) FROM {watchdog} WHERE type = '%s'", $type);
 
   $rows = array();
-  while ($dblog = db_fetch_object($result)) {
+  foreach ($result as $dblog) {
     $rows[] = array($dblog->count, truncate_utf8(_dblog_format_message($dblog), 56, TRUE, TRUE));
   }
 
@@ -132,8 +132,8 @@ function dblog_top($type) {
 function dblog_event($id) {
   $severity = watchdog_severity_levels();
   $output = '';
-  $result = db_query('SELECT w.*, u.name, u.uid FROM {watchdog} w INNER JOIN {users} u ON w.uid = u.uid WHERE w.wid = %d', $id);
-  if ($dblog = db_fetch_object($result)) {
+  $result = db_query('SELECT w.*, u.name, u.uid FROM {watchdog} w INNER JOIN {users} u ON w.uid = u.uid WHERE w.wid = :id', array(':id' => $id))->fetchObject();
+  if ($dblog = $result) {
     $rows = array(
       array(
         array('data' => t('Type'), 'header' => TRUE),
Index: modules/dblog/dblog.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/dblog/dblog.module,v
retrieving revision 1.35
diff -u -p -r1.35 dblog.module
--- modules/dblog/dblog.module	25 Jan 2009 12:19:31 -0000	1.35
+++ modules/dblog/dblog.module	7 Mar 2009 19:02:54 -0000
@@ -97,8 +97,10 @@ function dblog_init() {
  */
 function dblog_cron() {
   // Cleanup the watchdog table
-  $max = db_result(db_query('SELECT MAX(wid) FROM {watchdog}'));
-  db_query('DELETE FROM {watchdog} WHERE wid <= %d', $max - variable_get('dblog_row_limit', 1000));
+  $max = db_query('SELECT MAX(wid) FROM {watchdog}')->fetchField();
+  db_delete('watchdog')
+    ->condition('wid', $max - variable_get('dblog_row_limit', 1000, '<='))
+    ->execute();
 }
 
 /**
@@ -107,11 +109,16 @@ function dblog_cron() {
 function dblog_user_cancel($edit, $account, $method) {
   switch ($method) {
     case 'user_cancel_reassign':
-      db_update('watchdog')->fields(array('uid' => 0))->condition('uid', $account->uid)->execute();
+      db_update('watchdog')
+        ->fields(array('uid' => 0))
+        ->condition('uid', $account->uid)
+        ->execute();
       break;
 
     case 'user_cancel_delete':
-      db_delete('watchdog')->condition('uid', $account->uid)->execute();
+      db_delete('watchdog')
+        ->condition('uid', $account->uid)
+        ->execute();
       break;
   }
 }
@@ -120,7 +127,7 @@ function _dblog_get_message_types() {
   $types = array();
 
   $result = db_query('SELECT DISTINCT(type) FROM {watchdog} ORDER BY type');
-  while ($object = db_fetch_object($result)) {
+  foreach ($result as $object) {
     $types[] = $object->type;
   }
 
