Render Update object
@param  Query\Update $query
@return string
768444
public static function render(Query\Update $query)
    {
        return Compiler::withDb($query->getDb(), function () use ($query) {
            return Compiler::expression(array(
                'UPDATE',
                $query->getType(),
                Aliased::combine($query->getTable()),
                Join::combine($query->getJoin()),
                Compiler::word('SET', Set::combine($query->getSet())),
                Compiler::word('WHERE', Condition::combine($query->getWhere())),
                Compiler::word('ORDER BY', Direction::combine($query->getOrder())),
                Compiler::word('LIMIT', $query->getLimit()),
            ));
        });
    }
220162
protected function updateCollection($query, $update, $options)
    {
        return $this->getCollection()->replaceOne($query, $update, $options);
    }
943255
public static function render(Query\Delete $query)
    {
        return Compiler::withDb($query->getDb(), function () use ($query) {
            return Compiler::expression(array(
                'DELETE',
                $query->getType(),
                Aliased::combine($query->getTable()),
                Compiler::word('FROM', Aliased::combine($query->getFrom())),
                Join::combine($query->getJoin()),
                Compiler::word('WHERE', Condition::combine($query->getWhere())),
                Compiler::word('ORDER BY', Direction::combine($query->getOrder())),
                Compiler::word('LIMIT', $query->getLimit()),
            ));
        });
    }
887426
public function compileUpdate(Builder $query, $values) {
    $this->beforePut($values);
    $this->remapWheres($query);
    return $this->grammar->compileUpdate($query, $values);
  }
353431
public function interpret(Query $query)
    {
        switch ($query->getAction()) {
            case Query::ACTION_FIND:
                /** @var FindQuery $query */
                return $this->compileFindQuery($query);
            case Query::ACTION_INSERT:
                /** @var InsertQuery $query */
                return $this->compileInsertQuery($query);
            case Query::ACTION_UPDATE:
                /** @var UpdateQuery $query */
                return $this->compileUpdateQuery($query);
            case Query::ACTION_DELETE:
                /** @var DeleteQuery $query */
                return $this->compileDeleteQuery($query);
            default:
                throw new QueryException("Invalid query action: {$query->getAction()}");
        }
    }
782853
public function buildUpdateFragment(SQLUpdate $query, array &$parameters)
    {
        $table = $query->getTable();
        $text = "UPDATE $table";

        // Join SET components together, considering parameters
        $parts = array();
        foreach ($query->getAssignments() as $column => $assignment) {
            // Assigment is a single item array, expand with a loop here
            foreach ($assignment as $assignmentSQL => $assignmentParameters) {
                $parts[] = "$column = $assignmentSQL";
                $parameters = array_merge($parameters, $assignmentParameters);
                break;
            }
        }
        $nl = $this->getSeparator();
        $text .= "{$nl}SET " . implode(', ', $parts);
        return $text;
    }
1087704
public function output_html($data, $query='') {
        global $CFG, $OUTPUT, $DB, $PAGE;

        // Display strings.
        $strup        = get_string('up');
        $strdown      = get_string('down');
        $strsettings  = get_string('settings');
        $strenable    = get_string('enable');
        $strdisable   = get_string('disable');
        $struninstall = get_string('uninstallplugin', 'core_admin');
        $strversion   = get_string('version');
        $strname      = get_string('name');
        $strsupports  = get_string('supports', 'core_media');

        $pluginmanager = core_plugin_manager::instance();

        $plugins = $this->get_sorted_plugins();
        $enabledplugins = $pluginmanager->get_enabled_plugins('media');

        $return = $OUTPUT->box_start('generalbox mediaplayersui');

        $table = new html_table();
        $table->head  = array($strname, $strsupports, $strversion,
            $strenable, $strup.'/'.$strdown, $strsettings, $struninstall);
        $table->colclasses = array('leftalign', 'leftalign', 'centeralign',
            'centeralign', 'centeralign', 'centeralign', 'centeralign');
        $table->id = 'mediaplayerplugins';
        $table->attributes['class'] = 'admintable generaltable';
        $table->data  = array();

        // Iterate through media plugins and add to the display table.
        $updowncount = 1;
        $url = new moodle_url('/admin/media.php', array('sesskey' => sesskey()));
        $printed = array();
        $spacer = $OUTPUT->pix_icon('spacer', '', 'moodle', array('class' => 'iconsmall'));

        $usedextensions = [];
        foreach ($plugins as $name => $plugin) {
            $url->param('media', $name);
            $plugininfo = $pluginmanager->get_plugin_info('media_'.$name);
            $version = $plugininfo->versiondb;
            $supports = $plugininfo->supports($usedextensions);

            // Hide/show links.
            $class = '';
            if (!$plugininfo->is_installed_and_upgraded()) {
                $hideshow = '';
                $enabled = false;
                $displayname = '<span class="notifyproblem">'.$name.'</span>';
            } else {
                $enabled = $plugininfo->is_enabled();
                if ($enabled) {
                    $hideshow = html_writer::link(new moodle_url($url, array('action' => 'disable')),
                        $OUTPUT->pix_icon('t/hide', $strdisable, 'moodle', array('class' => 'iconsmall')));
                } else {
                    $hideshow = html_writer::link(new moodle_url($url, array('action' => 'enable')),
                        $OUTPUT->pix_icon('t/show', $strenable, 'moodle', array('class' => 'iconsmall')));
                    $class = 'dimmed_text';
                }
                $displayname = $plugin->displayname;
                if (get_string_manager()->string_exists('pluginname_help', 'media_' . $name)) {
                    $displayname .= '&nbsp;' . $OUTPUT->help_icon('pluginname', 'media_' . $name);
                }
            }
            if ($PAGE->theme->resolve_image_location('icon', 'media_' . $name, false)) {
                $icon = $OUTPUT->pix_icon('icon', '', 'media_' . $name, array('class' => 'icon pluginicon'));
            } else {
                $icon = $OUTPUT->pix_icon('spacer', '', 'moodle', array('class' => 'icon pluginicon noicon'));
            }

            // Up/down link (only if enrol is enabled).
            $updown = '';
            if ($enabled) {
                if ($updowncount > 1) {
                    $updown = html_writer::link(new moodle_url($url, array('action' => 'up')),
                        $OUTPUT->pix_icon('t/up', $strup, 'moodle', array('class' => 'iconsmall')));
                } else {
                    $updown = $spacer;
                }
                if ($updowncount < count($enabledplugins)) {
                    $updown .= html_writer::link(new moodle_url($url, array('action' => 'down')),
                        $OUTPUT->pix_icon('t/down', $strdown, 'moodle', array('class' => 'iconsmall')));
                } else {
                    $updown .= $spacer;
                }
                ++$updowncount;
            }

            $uninstall = '';
            $status = $plugininfo->get_status();
            if ($status === core_plugin_manager::PLUGIN_STATUS_MISSING) {
                $uninstall = get_string('status_missing', 'core_plugin') . '<br/>';
            }
            if ($status === core_plugin_manager::PLUGIN_STATUS_NEW) {
                $uninstall = get_string('status_new', 'core_plugin');
            } else if ($uninstallurl = $pluginmanager->get_uninstall_url('media_'.$name, 'manage')) {
                $uninstall .= html_writer::link($uninstallurl, $struninstall);
            }

            $settings = '';
            if ($plugininfo->get_settings_url()) {
                $settings = html_writer::link($plugininfo->get_settings_url(), $strsettings);
            }

            // Add a row to the table.
            $row = new html_table_row(array($icon.$displayname, $supports, $version, $hideshow, $updown, $settings, $uninstall));
            if ($class) {
                $row->attributes['class'] = $class;
            }
            $table->data[] = $row;

            $printed[$name] = true;
        }

        $return .= html_writer::table($table);
        $return .= $OUTPUT->box_end();
        return highlight($query, $return);
    }
1201336
public function modifyQuery(Query $query)
    {
        $query = $this->queryBuilder->startFrom($query)->useElevationFromTypoScript()->getQuery();
        return $query;
    }
1368512
public function update($query, array $options = []) {
		$params = compact('query', 'options');

		return Filters::run($this, __FUNCTION__, $params, function($params) {
			$query = $params['query'];
			$exportedQuery = $query->export($this);

			if ($exportedQuery['fields'] === null) {
				return true;
			}

			$sql = $this->renderCommand('update', $exportedQuery, $query);
			$result = (boolean) $this->_execute($sql);

			if ($result && is_object($query) && $query->entity()) {
				$query->entity()->sync();
			}
			return $result;
		});
	}
726567
public function rawUpdate(Update $update, Query $query = null)
        {
            if ($query === null) {
                $query = new Query($this);
            }
            $query->generateUpdateSQL($update);

            $value = Statement::getPreparedStatement($query)->execute();
            $this->clearB2DBCachedObjects();

            return $value;
        }
1116464
public function compileUpdate(Builder $query, $values)
	{
		$table = $this->wrapTable($query->from);

		$columns = [];

		// Each one of the columns in the update statements needs to be wrapped in the
		// keyword identifiers, also a place-holder needs to be created for each of
		// the values in the list of bindings so we can make the sets statements.
		foreach ($values as $key => $value) {
			if ($this->isJsonSelector($key)) {
				$columns[] = $this->compileJsonUpdateColumn(
					$key, new JsonExpression($value)
				);
			} else {
				$columns[] = $this->wrap($key).' = '.$this->parameter($value);
			}
		}

		$columns = implode(', ', $columns);

		// If the query has any "join" clauses, we will setup the joins on the builder
		// and compile them so we can attach them to this update, as update queries
		// can get join statements to attach to other tables when they're needed.
		if (isset($query->joins)) {
			$joins = ' '.$this->compileJoins($query, $query->joins);
		} else {
			$joins = '';
		}

		// Of course, update queries may also be constrained by where clauses so we'll
		// need to compile the where clauses and attach it to the query so only the
		// intended records are updated by the SQL statements we generate to run.
		$where = $this->compileWheres($query);

		$sql = rtrim("update {$table}{$joins} set $columns $where");

		if (isset($query->orders)) {
			$sql .= ' '.$this->compileOrders($query, $query->orders);
		}

		if (isset($query->limit)) {
			$sql .= ' '.$this->compileLimit($query, $query->limit);
		}

		return rtrim($sql);
	}
736255
public function compileUpdate(Builder $query, $values)
    {
        $table = $this->wrapTable($query->from);

        // Each one of the columns in the update statements needs to be wrapped in the
        // keyword identifiers, also a place-holder needs to be created for each of
        // the values in the list of bindings so we can make the sets statements.
        $columns = collect($values)->map(function ($value, $key) {
            return $this->wrap($key).' = '.$this->parameter($value);
        })->implode(', ');

        // If the query has any "join" clauses, we will setup the joins on the builder
        // and compile them so we can attach them to this update, as update queries
        // can get join statements to attach to other tables when they're needed.
        $joins = '';

        if (isset($query->joins)) {
            $joins = ' '.$this->compileJoins($query, $query->joins);
        }

        // Of course, update queries may also be constrained by where clauses so we'll
        // need to compile the where clauses and attach it to the query so only the
        // intended records are updated by the SQL statements we generate to run.
        $wheres = $this->compileWheres($query);

        return trim("update {$table}{$joins} set $columns $wheres");
    }
687
public function update(Query $query)
    {
        $options = $query->getOptions();

        $table = $this->parseTable($query, $options['table']);
        $data  = $this->parseData($query, $options['data']);

        if (empty($data)) {
            return '';
        }

        foreach ($data as $key => $val) {
            $set[] = $key . ' = ' . $val;
        }

        return str_replace(
            ['%TABLE%', '%SET%', '%JOIN%', '%WHERE%', '%ORDER%', '%LIMIT%', '%LOCK%', '%COMMENT%'],
            [
                $this->parseTable($query, $options['table']),
                implode(' , ', $set),
                $this->parseJoin($query, $options['join']),
                $this->parseWhere($query, $options['where']),
                $this->parseOrder($query, $options['order']),
                $this->parseLimit($query, $options['limit']),
                $this->parseLock($query, $options['lock']),
                $this->parseComment($query, $options['comment']),
            ],
            $this->updateSql);
    }
706529
public static function render($query, array $bindings=[], $quoteChar="'")
    {

        if (!$bindings) {
            return "$query";
        }

        $keys = [];
        $values = [];

        # build a regular expression for each parameter
        foreach ($bindings as $key=>$value) {
            $keys[] = is_string($key) ? '/:'.$key.'/' : '/[?]/';
            $values[] = is_numeric($value) ? (int)$value : "$quoteChar$value$quoteChar";
        }

        $count=0;

        return preg_replace($keys, $values, "$query", 1, $count);

    }
783433
public function update(KDatabaseQueryUpdate $query)
    {
        $context = $this->getContext();
        $context->query = $query;

        //Execute the update operation
        if ($this->invokeCommand('before.update', $context) !== false)
        {
            if (!empty($context->query->values))
            {
                //Execute the query
                $context->result   = $this->execute($context->query);
                $context->affected = $this->_affected_rows;

                $this->invokeCommand('after.update', $context);
            }
            else $context->affected = false;
        }

        return $context->affected;
    }
571631
protected function compileUpdateFrom(Builder $query)
    {
        if (! isset($query->joins)) {
            return '';
        }

        // When using Postgres, updates with joins list the joined tables in the from
        // clause, which is different than other systems like MySQL. Here, we will
        // compile out the tables that are joined and add them to a from clause.
        $froms = collect($query->joins)->map(function ($join) {
            return $this->wrapTable($join->table);
        })->all();

        if (count($froms) > 0) {
            return ' from '.implode(', ', $froms);
        }
    }
501073
public function getUpdateSQL(Update $update)
        {
            if (!$this->query->getTable() instanceof Table) {
                throw new Exception('Trying to generate sql when no table is being used.');
            }
            $sql = $this->generateUpdateSQL($update);
            $sql .= $this->generateWhereSQL(true);

            return $sql;
        }