changeset 1105:0b0094db56da

Improve function stDBPrepareSQLUpdate() by adding new optional last argument to specify values array.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 16 May 2019 12:42:24 +0300
parents 0a2117349f46
children b3c1c5969a0b
files msitegen.inc.php
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/msitegen.inc.php	Tue May 14 14:45:36 2019 +0300
+++ b/msitegen.inc.php	Thu May 16 12:42:24 2019 +0300
@@ -579,12 +579,13 @@
 }
 
 
-function stDBPrepareSQLUpdate($dbh, $table, $cond, $pairs)
+function stDBPrepareSQLUpdate($dbh, $table, $cond, $pairs, $values = NULL)
 {
-  $sql = array();
+  $sql = [];
   foreach ($pairs as $name => $attr)
   {
-    $sql[] = $name."=".stDBGetSQLParam($dbh, $attr, $name);
+    $sql[] = $name."=".stDBGetSQLParam($dbh,
+      $attr, $values !== NULL ? $values[$name] : $name);
   }
   return
     "UPDATE ".$table." SET ".implode(",", $sql).