From 64c695a0fbd9b358a30e3aad3922399cc630dcd8 Mon Sep 17 00:00:00 2001 From: marcus Date: Wed, 8 Apr 2009 10:27:56 +0000 Subject: Added callback support to get_data_row() git-svn-id: https://code.elgg.org/elgg/trunk@3192 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/database.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'engine/lib/database.php') 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; } -- cgit v1.2.3