aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/database.php
diff options
context:
space:
mode:
authormarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-04-08 10:27:56 +0000
committermarcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-04-08 10:27:56 +0000
commit64c695a0fbd9b358a30e3aad3922399cc630dcd8 (patch)
tree5476c907a224713559986d33a7ad7f40ff5b06e5 /engine/lib/database.php
parent2c70709ddeb70f3c12e8ad03e79122a986d741c0 (diff)
downloadelgg-64c695a0fbd9b358a30e3aad3922399cc630dcd8.tar.gz
elgg-64c695a0fbd9b358a30e3aad3922399cc630dcd8.tar.bz2
Added callback support to get_data_row()
git-svn-id: https://code.elgg.org/elgg/trunk@3192 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/database.php')
-rw-r--r--engine/lib/database.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/engine/lib/database.php b/engine/lib/database.php
index 01767be39..5989f55c3 100644
--- a/engine/lib/database.php
+++ b/engine/lib/database.php
@@ -303,7 +303,7 @@
* @return object A single database result object
*/
- function get_data_row($query) {
+ function get_data_row($query, $callback = "") {
global $CONFIG, $DB_QUERY_CACHE;
@@ -329,6 +329,10 @@
if ((isset($CONFIG->debug)) && ($CONFIG->debug==true))
error_log("$query results cached");
$DB_QUERY_CACHE[$query] = $row;
+
+ if (!empty($callback) && is_callable($callback)) {
+ $row = $callback($row);
+ }
if ($row) return $row;
}