--- core\database.mysql.inc	2007-10-19 18:49:26.000000000 -0400
+++ database.mysql.inc	2008-01-05 22:37:46.953125000 -0500
@@ -240,6 +240,44 @@ function db_result($result, $row = 0) {
 }
 
 /**
+ * Return a result array from the previous query.
+ *
+ * @param $result
+ *   A database query result resource, as returned from db_query().
+ * @return
+ *   The resulting array or FALSE.
+ *   If the query contains -- the result array would be 
+ *        0 columns             (bool)FALSE
+ *        1 column              value => value
+ *        2 columns             1st value => 2nd value
+ *        3 or more             1st value => array(2nd value, 3rd value, ...)
+ */
+function db_result_array($result) {
+  $array = array();
+  while($row = mysql_fetch_array($result, MYSQL_NUM)) {
+    $y = count($row);
+    switch ($y) {
+      case 0:
+        drupal_set_message(t('Db_result_array found no columns in the result set.'), 'error');
+        return false;
+
+      case 1:
+        $array[$row[0]] = $row[0];
+        break;
+
+      case 2:
+        $array[$row[0]] = $row[1];
+        break;
+
+      default:
+        $array[$row[0]] = array_slice($row, 1);
+        break;
+    }
+  }
+  return $array;
+}
+
+/**
  * Determine whether the previous query caused an error.
  */
 function db_error() {
--- core\database.mysqli.inc	2007-10-19 18:49:26.000000000 -0400
+++ database.mysqli.inc	2008-01-05 22:37:46.953125000 -0500
@@ -220,6 +220,44 @@ function db_result($result, $row = 0) {
 }
 
 /**
+ * Return a result array from the previous query.
+ *
+ * @param $result
+ *   A database query result resource, as returned from db_query().
+ * @return
+ *   The resulting array or FALSE.
+ *   If the query contains -- the result array would be 
+ *        0 columns             (bool)FALSE
+ *        1 column              value => value
+ *        2 columns             1st value => 2nd value
+ *        3 or more             1st value => array(2nd value, 3rd value, ...)
+ */
+function db_result_array($result) {
+  $array = array();
+  while($row = mysqli_fetch_array($result, MYSQL_NUM)) {
+    $y = count($row);
+    switch ($y) {
+      case 0:
+        drupal_set_message(t('Db_result_array found no columns in the result set.'), 'error');
+        return false;
+
+      case 1:
+        $array[$row[0]] = $row[0];
+        break;
+
+      case 2:
+        $array[$row[0]] = $row[1];
+        break;
+
+      default:
+        $array[$row[0]] = array_slice($row, 1);
+        break;
+    }
+  }
+  return $array;
+}
+
+/**
  * Determine whether the previous query caused an error.
  */
 function db_error() {
--- core\database.pgsql.inc	2007-10-19 18:49:26.000000000 -0400
+++ database.pgsql.inc	2008-01-05 22:37:46.953125000 -0500
@@ -214,6 +214,44 @@ function db_result($result, $row = 0) {
 }
 
 /**
+ * Return a result array from the previous query.
+ *
+ * @param $result
+ *   A database query result resource, as returned from db_query().
+ * @return
+ *   The resulting array or FALSE.
+ *   If the query contains -- the result array would be 
+ *        0 columns             (bool)FALSE
+ *        1 column              value => value
+ *        2 columns             1st value => 2nd value
+ *        3 or more             1st value => array(2nd value, 3rd value, ...)
+ */
+function db_result_array($result) {
+  $array = array();
+  while($row = mysql_fetch_array($result, MYSQL_NUM)) {
+    $y = count($row);
+    switch ($y) {
+      case 0:
+        drupal_set_message(t('Db_result_array found no columns in the result set.'), 'error');
+        return false;
+
+      case 1:
+        $array[$row[0]] = $row[0];
+        break;
+
+      case 2:
+        $array[$row[0]] = $row[1];
+        break;
+
+      default:
+        $array[$row[0]] = array_slice($row, 1);
+        break;
+    }
+  }
+  return $array;
+}
+
+/**
  * Determine whether the previous query caused an error.
  */
 function db_error() {
