function to build update SQL, and update current record in database, just write the dirty data into database.

@return bool|self if update success return current object, other wise return false.
175830
public function update()
    {
        if ($this->dirty === []) {
            return true;
        }

        $this->defaultTable();
        $this->sql['SET'] = $this->dirty;
        $this->eq($this->primary, $this->__get($this->primary));

        if (DB::update($this->sql)) {
            return $this->dirty()->reset();
        }

        return false;
    }
890010
private function update()
    {
        $db = new Db();

        //Insert into article table
        $row = $db->query('UPDATE article
                            SET   category = :category,
                                  author = :author,
                                  pubdate = :pubdate,
                                  editdate = :editdate,
                                  tags = :tags,
                                  status = :status,
                                  title = :title,
                                  media = :media,
                                  resume = :resume
                            WHERE id = :id',

                        [':id'=>$this->id,
                         ':category' => $this->category,
                         ':author' => $this->author,
                         ':pubdate' => $this->pubdate,
                         ':editdate' => $this->editdate,
                         ':tags' => $this->tags,
                         ':status' => $this->status,
                         ':title' => $this->title,
                         ':media' => $this->media,
                         ':resume' => $this->resume
                        ]);
        //check update
        if (!$row) {
            return false;
        }

        //Insert into content table
        $row = $db->query('UPDATE articlecontent
                            SET   editdate = :editdate,
                                  content = :content
                            WHERE article = :article',
                            
                        [':article' => $this->id,
                         ':editdate' => $this->editdate,
                         ':content' => $this->content]);
        return $row;

        
        $cols = '';
        $vals = [];
        foreach ($this as $k => $v) {
            if ($k == 'table' || $k == 'where') {
                continue;
            }echo '<br><b>'.$k.': </b>'.$v;
            if ($k !== 'id') {
                $cols .= $k.' = :'.$k.',';
            }
            $vals[':'.$k] = $v;
        }
        
        $cols = substr($cols, 0, -1); //tirando a ultima vírgula

        $where = ' WHERE id = :id ';
        if ($this->where != null) {
            $where .= ' and '.$this->where;
        }

        $db = new Db();
        return $db->query('UPDATE '.$this->table.' SET '.$cols.$where, $vals);
    }
136759
function update_field() {
        global $DB;

        $DB->update_record('data_fields', $this->field);

        // Trigger an event for updating this field.
        $event = \mod_data\event\field_updated::create(array(
            'objectid' => $this->field->id,
            'context' => $this->context,
            'other' => array(
                'fieldname' => $this->field->name,
                'dataid' => $this->data->id
            )
        ));
        $event->trigger();

        return true;
    }
756213
protected function update()
	{
		// New objects can't be updated, neither can frozen
		if ($this->is_new())
		{
			return false;
		}

		// Non changed objects don't have to be saved, but return true anyway (no reason to fail)
		if ( ! $this->is_changed(array_keys(static::properties())))
		{
			return true;
		}

		$this->observe('before_update');

		// Create the query and limit to primary key(s)
		$query       = Query::forge(get_called_class(), static::connection(true));
		$primary_key = static::primary_key();
		$properties  = array_keys(static::properties());
		//Add the primary keys to the where
		$this->add_primary_keys_to_where($query);

		// Set all current values
		foreach ($properties as $p)
		{
			if ( ! in_array($p, $primary_key) )
			{
				if (array_key_exists($p, $this->_original))
				{
					$this->{$p} !== $this->_original[$p] and $query->set($p, isset($this->_data[$p]) ? $this->_data[$p] : null);
				}
				else
				{
					array_key_exists($p, $this->_data) and $query->set($p, $this->_data[$p]);
				}
			}
		}

		// Return false when update fails
		if ( ! $query->update())
		{
			return false;
		}

		// update the original property on success
		$this->observe('after_update');

		return true;
	}
18228
public function save()
    {
        // Validate
        if (!$this->validates()) {
            return false;
        }

        // Run filter
        $this->runFilters('before', $this->_isNew ? 'create' : 'save');

        // Get data
        $data = static::data();

        // Create
        if ($this->_isNew) {
            $result = static::connection()
                ->insert($data)
                ->into(static::table())
                ->exec();

            $this->id = static::connection()->lastInsertId();
        }
        // Update
        else {
            $result = static::connection()
                ->update(static::table())
                ->set($data)
                ->where(static::$_primaryKey . ' = ?', $data[static::$_primaryKey])
                ->exec();
        }

        // Run filters
        $this->runFilters('after', $this->_isNew ? 'create' : 'save');

        return $result;
    }
1136221
public function update()
    {
        // copy the code into memory
        $backup = file($this->reflection->getFileName());

        list($preamble, $class) = $this->splitClassFile($backup);
        $preamble = $this->stripOutExistingDocBlock($preamble);
        $preamble .= $this->buildUpdatedDocBlock();

        if ($this->writeClassFile(implode(PHP_EOL, [$preamble, $class]))
            && $this->commandLineLint($this->reflection->getFileName())
        ) {
            return true;
        }

        $this->writeClassFile(implode('', $backup));
        return false;
    }
321877
public function save()
    {
        $sQuery = $this->_prepare();

        if (preg_match('/INSERT INTO/i', $sQuery)) {

            $oDb = self::connect();

            if (!$oDb->exec($sQuery)) {
                error_log($sQuery."\n".print_r($oDb->errorInfo(), true));
            }

            $this->flush();
            return $oDb->lastInsertId();
        }
        else {

            $this->flush();

            if ($this->_mWhere instanceof Where) { $this->_mWhere->flush(); }

            return self::connect()->exec($sQuery);
        }

    }
292843
public function update($sqlQuery = false)
    {
        $field = func_get_args();
        if(func_num_args() == 0) {
            echo 'no data to save'; //no argument
            exit;
        }
        elseif(func_num_args() == 1) {
            if(is_array($field[0])) {
                $data = $field[0]; //single array with all data
            }
            else {
                $data = $field[0]; //sql fraction
            }
        }
        else {
            echo 'invalid data';
            exit;
        }
        $sql = $this->buildQuery('update', $data);
        if($sqlQuery === true) {
            return $this->getQuery();
        }
        $result = $this->executeQuery($sql);
        return $result;
    }
644205
public function save() :bool {
		
		// if an id already exists
		if($this->_['id']) {
			// we can update and return the number of affected rows (0 on error, 1 on success)
			return (bool) self::_update()
				->set($this->__toArray(true, true))
				->where(['id'=>$this->_['id']])
				->execute();
		}
		// this is a new record
		else {
			// try to insert it
			$inserted_object = self::create($this->__toArray(true, true));
			// if insertion succeeded, return true
			if($inserted_object) {
				// clone ourselves with what the database returneds, a full fledged object
				$this->replicate($inserted_object);
				// return success
				return true;
			}
			// didnt insert
			else {
				// failure feedback
				return false;
			}
		}
		
	}
821231
public function updateDb()
    {
        $this->createUpdateTableIfNotExists();
        $this->getProcessedFiles();
        
        $path = leedch_resourceMysqlUpdateFolder;
        $files = $this->findNewFiles($path);
        
        $this->processNewFiles($files);
    }
1235499
public function save()
    {
        if (isset($this->_pkValue)) {
            // Update
            $quests = [];
            $params = [];
            foreach ($this->_dirty as $field => $_) {
                if ($field != self::pkField()) {
                    $quests[] = '`' . $field . '`=?';
                    $params[] = $this->_data[$field];
                }
            }
            $sql = 'UPDATE `' . self::table() . '` SET ' . join(',', $quests) . ' WHERE `' . self::pkField() . '`=?;';
            $params[] = $this->_pkValue;
            $result = BLSql::exec($sql, $params)->rowCount();
            if ($result > 0) {
                $this->_dirty = [];
            }
            return $result;
        } else {
            // Insert
            $fields = [];
            $quests = [];
            $params = [];
            foreach ($this->_data as $field => $value) {
                $fields[] = '`' . $field . '`';
                $quests[] = '?';
                $params[] = $value;
            }
            $sql = 'INSERT INTO `' . self::table() . '` (' . join(',', $fields) . ') VALUES (' . join(',', $quests) . ');';
            if (BLSql::exec($sql, $params)->rowCount() <= 0) {
                return false;
            }
            $this->_dirty = [];
            // save pk value
            $this->_pkValue = BLSql::getHandle()->lastInsertId(self::pkField());
            $this->_data[self::pkField()] = $this->_pkValue;
            return $this->_pkValue;
        }
    }
842178
public function create () : bool
	{
        $dbObject 	= Database::getInstance();
		$attributes = $this->sanitizedAttributes();
		$sqlQuery	= "INSERT INTO ".static::$tableName." (";
		$sqlQuery  .= join(", ", array_keys($attributes));
	  	$sqlQuery  .= ") VALUES ('";
		$sqlQuery  .= join("', '", array_values($attributes));
		$sqlQuery  .= "')";
		$result 	= $dbObject->query($sqlQuery);
    	$this->id 	= $dbObject->insertId();
    	return ($result) ? TRUE : FALSE;
	}
1197567
public function update()
    {
        self::$instance->reset();
        $this->sql('UPDATE');

        $numargs = func_num_args();

        if ($numargs > 0) {
            $arg_list = func_get_args();

            $this->oosql_multiFlag = true;

            $this->oosql_multi = $arg_list;

            for ($i = 0; $i < $numargs; $i++) {
                if ($i != 0 && $numargs > $i) {
                    $this->sql(',');
                }
                $this->sql(' ' . $arg_list[$i]);
            }
        } else {
            $this->sql(" $this->oosql_table");
        }

        $this->sql(' SET ');
        $this->oosql_where = null;
        return $this;
    }
684870
function update() {
		$where = $this->criteria();
		$this->table->notify($this, "update", $where);
		$rowset = $this->table->update($where, $this->changes());
		if (!count($rowset)) {
			throw new \UnexpectedValueException("No row updated");
		}
		$this->data = $rowset->current()->data;
		$this->cell = array();
		return $this;
	}
1212334
protected function update_object() {
		// If the "prev_create" filter returns false we'll bail out of the update and return
		// false, indicating that the save failed. This provides a chance for any
		// hooks to cancel update operations if validations fail or whatever.
		if ( false === apply_filters( $this->prefix( 'prev_create' ), true ) ) {
			return false;
		}

		/**
		 * Fires updating action.
		 *
		 * @param static $wp_object Current object instance.
		 */
		do_action( $this->prefix( 'updating' ), $this );

		$dirty = $this->get_dirty();

		if ( count( $dirty ) > 0 ) {
			$updated = $this->perform_update( $dirty );

			if ( false === $updated ) {
				return false;
			}

			/**
			 * Fires updated action.
			 *
			 * @param static $wp_object Current object instance.
			 */
			do_action( $this->prefix( 'updated' ), $this );

			$this->sync_changes();
		}

		return true;
	}
628204
public function update()
    {
        $query = 'update '.$this->getTables($this->tables).' set ';
        //
        for ($i = 0; $i < Collection::count($this->sets); $i++) {
            if ($i < Collection::count($this->sets) - 1) {
                $query .= $this->sets[$i].',';
            } else {
                $query .= $this->sets[$i];
            }
        }
        //
        $query .= ' '.$this->where;
        //
        $this->reset();
        //
        return Database::exec($query);
    }
286933
public function updates($data)
    {
        $data = &$this->loadFilterData($data);
        if ( $data == false ) {
            return false;
        }
        $conditions = $this->sqlBuilder->buildCondition();
        return $this->db->update($this->table, $data, $conditions);
    }