Index: helpers_database.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/helpers/helpers_database.module,v
retrieving revision 1.2.4.1.2.3
diff -u -p -r1.2.4.1.2.3 helpers_database.module
--- helpers_database.module	4 Nov 2008 18:16:42 -0000	1.2.4.1.2.3
+++ helpers_database.module	28 Dec 2008 06:06:32 -0000
@@ -254,3 +254,49 @@ function db_fetch_all_as_arrays($query) 
   }
   return $results;
 }
+
+/**
+ * Returns the first column of a query result as an array.
+ *
+ * Does not do a rewrite sql for you!
+ * Call similar to db_query().
+ */
+function db_fetch_column($query) {
+  $results = array();
+  $args = func_get_args();
+  array_shift($args);
+  if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax
+    $args = $args[0];
+  }
+  $res = db_query($query, $args);
+
+  while ($row = db_fetch_array($res)) {
+    $results[] = current($row);
+  }
+
+  return $results;
+}
+
+/**
+ * Returns an associative array, with the first column of the result set as the key and the second as the value.
+ *
+ * Does not do a rewrite sql for you!
+ * Call similar to db_query().
+ */
+function db_fetch_assoc($query) {
+  $results = array();
+  $args = func_get_args();
+  array_shift($args);
+  if (isset($args[0]) and is_array($args[0])) { // 'All arguments in one array' syntax
+    $args = $args[0];
+  }
+  $res = db_query($query, $args);
+
+  while ($row = db_fetch_array($res)) {
+    $keys = array_keys($row);
+    $results[$row[$keys[0]]] = $row[$keys[1]];
+  }
+
+  return $results;
+}
+
