summaryrefslogtreecommitdiffstats
path: root/inc
diff options
context:
space:
mode:
authorSimon Rettberg2017-04-24 15:46:01 +0200
committerSimon Rettberg2017-04-24 15:46:01 +0200
commitb68ef6e73547be686355e4c26037206c97162d51 (patch)
tree430d9ff75152d1b7ed7c8fe14f78600189dd4e0b /inc
parent[dozmod] Make images pending deletion an extra section (diff)
downloadslx-admin-b68ef6e73547be686355e4c26037206c97162d51.tar.gz
slx-admin-b68ef6e73547be686355e4c26037206c97162d51.tar.xz
slx-admin-b68ef6e73547be686355e4c26037206c97162d51.zip
[inc/Database] Add ::queryAll()
Diffstat (limited to 'inc')
-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.