Flake\Core\Database::UPDATEquery PHP Метод

UPDATEquery() публичный Метод

public UPDATEquery ( $table, $where, $fields_values, $no_quote_fields = false )
    function UPDATEquery($table, $where, $fields_values, $no_quote_fields = false)
    {
        // Table and fieldnames should be "SQL-injection-safe" when supplied to this function (contrary to values in the arrays which may be insecure).
        if (is_string($where)) {
            if (is_array($fields_values) && count($fields_values)) {
                // quote and escape values
                $nArr = $this->fullQuoteArray($fields_values, $table, $no_quote_fields);
                $fields = [];
                foreach ($nArr as $k => $v) {
                    $fields[] = $k . '=' . $v;
                }
                // Build query:
                $query = 'UPDATE ' . $table . '
					SET
						' . implode(',
						', $fields) . (strlen($where) > 0 ? '
					WHERE
						' . $where : '');
                // Return query:
                if ($this->debugOutput || $this->store_lastBuiltQuery) {
                    $this->debug_lastBuiltQuery = $query;
                }
                return $query;
            }
        } else {
            die('<strong>Fatal Error:</strong> "Where" clause argument for UPDATE query was not a string in $this->UPDATEquery() !');
        }
    }