]> git.mxchange.org Git - friendica.git/commitdiff
dba:p and dba:e can now be called with a parameter array as well.
authorMichael <heluecht@pirati.ca>
Fri, 28 Apr 2017 04:47:28 +0000 (04:47 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 28 Apr 2017 04:47:28 +0000 (04:47 +0000)
include/dba.php

index 5a93338a1a61040da74fd1a9e428573e388fe71c..8686760eace6e25433a922aa1f1d7f68cf32a2a0 100644 (file)
@@ -482,6 +482,15 @@ class dba {
                $args = func_get_args();
                unset($args[0]);
 
+               // When the second function parameter is an array then use this as the parameter array
+               if ((count($args) == 1) AND (is_array($args[1]))) {
+                       $params = $args[1];
+                       $i = 0;
+                       foreach ($params AS $param) {
+                               $args[++$i] = $param;
+                       }
+               }
+
                if (!self::$dbo OR !self::$dbo->connected) {
                        return false;
                }
@@ -741,9 +750,7 @@ class dba {
                $sql = "INSERT INTO `".self::$dbo->escape($table)."` (`".implode("`, `", array_keys($param))."`) VALUES (".
                        substr(str_repeat("?, ", count($param)), 0, -2).");";
 
-               $sql = self::replace_parameters($sql, $param);
-
-               return self::e($sql);
+               return self::e($sql, $param);
        }
 
        /**