summaryrefslogtreecommitdiffstats
path: root/inc/database.inc.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/database.inc.php')
-rw-r--r--inc/database.inc.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/inc/database.inc.php b/inc/database.inc.php
index f3a90fe7..9153c688 100644
--- a/inc/database.inc.php
+++ b/inc/database.inc.php
@@ -53,6 +53,20 @@ class Database
return $res->fetch(PDO::FETCH_ASSOC);
}
+ /**
+ * If you need all rows for a query as plain array you can use this.
+ * Don't use this if you want to do further processing of the data, to save some
+ * memory.
+ *
+ * @return array|bool List of associative arrays representing rows, or false on error
+ */
+ public static function queryAll($query, $args = array(), $ignoreError = false)
+ {
+ $res = self::simpleQuery($query, $args, $ignoreError);
+ if ($res === false)
+ return false;
+ return $res->fetchAll(PDO::FETCH_ASSOC);
+ }
/**
* Execute the given query and return the number of rows affected.