Пример #1
0
 /**
  * Compiles an array of set values into an SQL partial. Used for UPDATE.
  *
  * @param   object $db Database instance
  * @param   array $values updated values
  * @return  string
  */
 protected function _compile_set(Database $db, array $values)
 {
     $set = [];
     foreach ($values as $group) {
         // Split the set
         list($column, $value) = $group;
         // Quote the column name
         $column = $db->quote_column($column);
         if ((is_string($value) and array_key_exists($value, $this->_parameters)) === false) {
             // Quote the value, it is not a parameter
             $value = $db->quote($value);
         }
         $set[$column] = $column . ' = ' . $value;
     }
     return implode(', ', $set);
 }