summaryrefslogtreecommitdiffstats
path: root/inc/database.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2017-12-21 13:52:00 +0100
committerSimon Rettberg2017-12-21 13:52:00 +0100
commit43aad7628a26079f12f2269ee906c6095c7bed67 (patch)
tree3d21030e4b088e16c14532f62f89c0476b1dc7ee /inc/database.inc.php
parent[statistics] Properly mark disconnected sceens as such if the output name cha... (diff)
downloadslx-admin-43aad7628a26079f12f2269ee906c6095c7bed67.tar.gz
slx-admin-43aad7628a26079f12f2269ee906c6095c7bed67.tar.xz
slx-admin-43aad7628a26079f12f2269ee906c6095c7bed67.zip
[inc/Database] Support nested arrays in query
Diffstat (limited to 'inc/database.inc.php')
-rw-r--r--inc/database.inc.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/inc/database.inc.php b/inc/database.inc.php
index 79c945b8..c1292cd8 100644
--- a/inc/database.inc.php
+++ b/inc/database.inc.php
@@ -213,6 +213,7 @@ class Database
*/
private static function handleArrayArgument(&$query, &$args)
{
+ $again = false;
foreach (array_keys($args) as $key) {
if (is_numeric($key) || $key === '?')
continue;
@@ -229,7 +230,12 @@ class Database
}
$new = array();
foreach ($args[$key] as $subIndex => $sub) {
- $new[] = $newkey . '_' . $subIndex;
+ if (is_array($sub)) {
+ $new[] = '(' . $newkey . '_' . $subIndex . ')';
+ $again = true;
+ } else {
+ $new[] = $newkey . '_' . $subIndex;
+ }
$args[$newkey . '_' . $subIndex] = $sub;
}
unset($args[$key]);
@@ -237,6 +243,9 @@ class Database
$query = preg_replace('/' . $newkey . '\b/', $new, $query);
}
}
+ if ($again) {
+ self::handleArrayArgument($query, $args);
+ }
}
/**