Execute update table set field = field+1 like statement
438130
def update(self, **kwargs):
        
        if self.condition is not None:
            self.result = self.do_(self.model.table.update().where(self.condition).values(**kwargs))
        else:
            self.result = self.do_(self.model.table.update().values(**kwargs))
        return self.result
611280
def update(self,record,**kw):
        """"""
        vals = self._make_sql_params(kw)
        sql = "UPDATE %s SET %s WHERE rowid=?" %(self.name,
            ",".join(vals))
        self.cursor.execute(sql,kw.values()+[record['__id__']])
944369
function update($data,$param=[]) {
        if (empty($data)) return false;
        $setFields = '';
        $params = [];
        if (is_array($data)) {
            $comma = '';
            foreach ($data as $key => $value) {
                //add database real string
                if (is_array($value)) {
                    $setFields .= "{$comma} `{$key}`=" . current($value);
                }
                else {
                    $params[] = $value;
                    $setFields .= "{$comma} `{$key}`=?";
                }
                $comma = ',';
            }
        }
        else {
            $params = is_array($param)?$param:[$param];
            $setFields = $data;
        }
        $sql = "UPDATE `{$this->table}` set {$setFields}";
        if($this->where) {
            $sql .= ' '.$this->where;
            $params = array_merge($params,$this->params);
            //$params = array_merge($params, $this->autoarr($condition[1]));
        }
        $sql = str_replace('table.',$this->table.'.',$sql);
        $this->_reset();
        return $this->execute($sql, $params, false);
    }
516700
public function update($table, $set, $where, $bind = array())
    {
        $sql = "UPDATE " . $table . " SET ";

        if(is_array($set)) {
            foreach($set as $field => $value) {
                $sql .= $field ." = ". $value . ",";
            }

            $sql = rtrim($sql,",");

        }else{
            $sql .= $set;
        }


        $sql .= " WHERE " . $where . ";";

        $bind = $this->cleanup($bind);

        return $this->run($sql, $bind);
    }
897413
public function increment($key, $val = 1, $field = null, $tablePrefix = null)
    {
        list($tableName, $condition) = $this->parseKey($key, true);
        if (is_null($field) || empty($tableName) || empty($condition)) {
            return false;
        }
        $val = abs(intval($val));
        is_null($tablePrefix) && $tablePrefix = $this->tablePrefix;
        $tableName = $tablePrefix . $tableName;

        $bulk = new BulkWrite();
        $bulk->update($condition, ['$inc' => [$field => $val]], ['multi' => true]);
        $result = $this->runMongoBulkWrite($tableName, $bulk);

        Cml::$debug && $this->debugLogSql('BulkWrite INC', $tableName, $condition, ['$inc' => [$field => $val]]);

        return $result->getModifiedCount();
    }
1250876
def update_field(uid, post_id=None, tag_id=None, par_id=None):
        '''
        
        '''
        if post_id:
            entry = TabPost2Tag.update(
                post_id=post_id
            ).where(TabPost2Tag.uid == uid)
            entry.execute()

        if tag_id:
            entry2 = TabPost2Tag.update(
                par_id=tag_id[:2] + '00',
                tag_id=tag_id,
            ).where(TabPost2Tag.uid == uid)
            entry2.execute()
        if par_id:
            entry2 = TabPost2Tag.update(
                par_id=par_id
            ).where(TabPost2Tag.uid == uid)
            entry2.execute()
56178
function (i) {
                    if (i >= columns.length) {
                        insertIntoDB();
                        return;
                    }

                    var dbField = columns[i];
                    var field = dbField.Field;

                    //Check required fields
                    if (dbField.Null === 'NO' && 
                        dbField.Default === '' && 
                        dbField.Extra !== 'auto_increment' && 
                        dbField.Extra.search('on update')===-1) {

                        //Check if field not set
                        if (undefOrEmpty(req.body[field])) {
                            return sendError(res,"Field " + field + " is NOT NULL but not specified in this request");
                        } else {
                            //Check if the set values are roughly okay
                            value = checkIfSentvaluesAreSufficient(req,dbField);
                            console.log(value);
                            if(value !== false) {
                                //Value seems okay, go to the next field
                                insertJson[field] = value;
                                iterator(i + 1);
                            } else {
                                return sendError(res,'Value for field ' + field + ' is not sufficient. Expecting ' + dbField.Type + ' but got ' + typeof req.body[field] );
                            }
                        }
                    }  else {
                        //Check for not required fields
                        //Skip auto_incremented fields
                        if(dbField.Extra === 'auto_increment') {
                            iterator(i + 1);
                        } else {
                            //Check if the field was provided by the client
                            var defined = false;
                            if(dbField.Default == "FILE") {
                                if(req.files.hasOwnProperty(dbField.Field)) {
                                    defined = true;
                                }
                            } else {
                                if(typeof req.body[field] !== "undefined") {
                                    defined = true;
                                }
                            }

                            //If it was provided, check if the values are okay
                            if(defined) {
                                value = checkIfSentvaluesAreSufficient(req,dbField);
                                if(value !== false) {
                                    insertJson[field] = value;
                                    iterator(i + 1);
                                } else {
                                    if(dbField.Default == "FILE") {
                                        return sendError(res, 'Value for field ' + field + ' is not sufficient. Either the file is to large or an other error occured');
                                    } else {
                                        return sendError(res, 'Value for field ' + field + ' is not sufficient. Expecting ' + dbField.Type + ' but got ' + typeof req.body[field]);
                                    }
                                }
                            } else {
                                //If not, don't mind
                                iterator(i + 1);
                            }

                        }
                    }

                }
107384
def find_by_field(self, table, field, field_value):
        '''
        
        '''
        sql = "select * from {} where {} = '{}'".format(
            table, field, field_value)
        res = self.query(sql)
        return res
978827
public SqlInfo buildLikeSql(String fieldText, Object value) {
        // 由于默认配置的suffix的值只是" LIKE "和" NOT LIKE "两个关键字，生成的LIKE SQL片段需要加上" ? "占位符.
        this.suffix = StringHelper.isBlank(this.suffix) ? ZealotConst.LIKE_KEY : this.suffix;
        join.append(prefix).append(fieldText).append(suffix).append("? ");
        params.add("%" + value + "%");
        return sqlInfo.setJoin(join).setParams(params);
    }
671629
private PreparedStatement prepareUpdate(String tableName, Update update) {
        StringBuilder cql = new StringBuilder();
        switch (update) {
        case INSERT_ROW:
            // INSERT INTO <keyspace>.<table> (key,column1,value) VALUES (<key>, <colname>, <colvalue>);
            cql.append("INSERT INTO ");
            cql.append(m_keyspace);
            cql.append(".");
            cql.append(tableName);
            cql.append(" (key,column1,value) VALUES (?, ?, ?);");
            break;
        case INSERT_ROW_TS:
            // INSERT INTO <keyspace>.<table> (key,column1,value) VALUES (<key>, <colname>, <colvalue>) USING TIMESTAMP <timestamp>;
            // Note timestamp is the last parameter
            cql.append("INSERT INTO ");
            cql.append(m_keyspace);
            cql.append(".");
            cql.append(tableName);
            cql.append(" (key,column1,value) VALUES (?, ?, ?) USING TIMESTAMP ?;");
            break;
        case DELETE_COLUMN:
            // DELETE FROM <keyspace>.<table> WHERE key=<key> AND column1=<column name>;
            cql.append("DELETE FROM ");
            cql.append(m_keyspace);
            cql.append(".");
            cql.append(tableName);
            cql.append(" WHERE key=? AND column1=?;");
            break;
        case DELETE_COLUMN_TS:
            // DELETE FROM <keyspace>.<table> USING TIMESTAMP <timestamp> WHERE key=<key> AND column1=<column name>;
            // Note timestamp is the first parameter
            cql.append("DELETE FROM ");
            cql.append(m_keyspace);
            cql.append(".");
            cql.append(tableName);
            cql.append(" USING TIMESTAMP ? WHERE key=? AND column1=?;");
            break;
        case DELETE_ROW:
            // DELETE FROM <keyspace>.<table> WHERE key='key';
            cql.append("DELETE FROM ");
            cql.append(m_keyspace);
            cql.append(".");
            cql.append(tableName);
            cql.append(" WHERE key=?;");
            break;
        case DELETE_ROW_TS:
            // DELETE FROM <keyspace>.<table> USING TIMESTAMP <timestamp> WHERE key='key';
            // Note timestamp is the first parameter
            cql.append("DELETE FROM ");
            cql.append(m_keyspace);
            cql.append(".");
            cql.append(tableName);
            cql.append(" USING TIMESTAMP ? WHERE key=?;");
            break;
        }
        m_logger.debug("Preparing update statement: {}", cql);
        return ((CQLService)DBService.instance(m_tenant)).getSession().prepare(cql.toString());
    }
445481
public void execute(boolean update) {
		if (update) {
			final String sql = getSql().replace("DELETE", "SELECT " + Model._ID);
			final List<T> results = QueryUtils.rawQuery(mTable, sql, getArgs());
			for (T result : results) {
				result.id = null;
			}
		}
		super.execute();
	}
337543
function update() {
    var updateData = this._prepUpdate(this.single.update);
    var wheres = this.where();
    var returning = this.single.returning;
    return {
      sql: 'update ' + this.tableName + ' set ' + updateData.join(', ') + (wheres ? ' ' + wheres : '') + this._returning(returning),
      returning: returning
    };
  }
109894
function UpdateBlob($table,$column,$val,$where,$blobtype='image')
	{
		$sql = "UPDATE $table SET $column = ? WHERE $where";
		if( !($stmt = @odbtp_prepare($sql, $this->_connectionID)) )
			return false;
		if( !@odbtp_input( $stmt, 1, ODB_BINARY, 1000000, $blobtype ) )
			return false;
		if( !@odbtp_set( $stmt, 1, $val ) )
			return false;
		return @odbtp_execute( $stmt ) != false;
	}
511539
@Override
	public final int executeUpdate() throws SQLException {
		Split split = prepare();
		try {
			return stmt.executeUpdate();
		} finally {
			finish(split);
		}
	}
796053
def update(self, table, data_list, matched_field=None, return_cols='id'):
        
        data_list = copy.deepcopy(data_list)  # Create deepcopy so the original list does not get modified
        if matched_field is None:
            # Assume the id field
            logger.info("Matched field not defined, assuming the `id` field")
            matched_field = 'id'

        # Make sure that `data_list` is a list
        if not isinstance(data_list, list):
            data_list = [data_list]

        if len(data_list) == 0:
            # No need to continue
            return []

        # Make sure return_cols is a list
        if return_cols is None or len(return_cols) == 0 or return_cols[0] is None:
            return_cols = ''
        elif not isinstance(return_cols, list):
            return_cols = [return_cols]

        if len(return_cols) > 0:
            return_cols = 'RETURNING ' + ','.join(return_cols)

        # Data in the list must be dicts (just check the first one)
        if not isinstance(data_list[0], dict):
            logger.critical("Data must be a list of dicts")
            # Do not return here, let the exception handle the error that will be thrown when the query runs

        try:
            with self.getcursor() as cur:
                query_list = []
                # TODO: change to return data from the database, not just what you passed in
                return_list = []
                for row in data_list:
                    if row.get(matched_field) is None:
                        logger.debug("Cannot update row. Missing field {field} in data {data}"
                                     .format(field=matched_field, data=row))
                        logger.error("Cannot update row. Missing field {field} in data".format(field=matched_field))
                        continue

                    # Pull matched_value from data to be updated and remove that key
                    matched_value = row.get(matched_field)
                    del row[matched_field]

                    query = "UPDATE {table} SET {data} WHERE {matched_field}=%s {return_cols}"\
                            .format(table=table,
                                    data=','.join("%s=%%s" % u for u in row.keys()),
                                    matched_field=matched_field,
                                    return_cols=return_cols
                                    )
                    values = list(row.values())
                    values.append(matched_value)
                    values = _check_values(values)

                    query = cur.mogrify(query, values)
                    query_list.append(query)
                    return_list.append(matched_value)

                finial_query = b';'.join(query_list)
                cur.execute(finial_query)

                try:
                    return cur.fetchall()
                except Exception:
                    return None

        except Exception as e:
            logger.exception("Error updating data")
            logger.debug("Error updating data: {data}".format(data=data_list))
            raise e.with_traceback(sys.exc_info()[2])
828993
public function update($fields) {
        if (is_array($fields)) {
            foreach ($fields as $key => $value) {
                if (is_string($value)) {
                    array_push($this->_updates, $key . ' = \'' . addslashes($value) . '\'');
                } else {
                    array_push($this->_updates, $key . ' = ' . $value);
                }
            }
        } else {
            return false;
        }
        
        $sql_query = 'UPDATE ' . $this->_table . 
                     ' SET ' . implode($this->_updates, ', ');
        
        // Where statements
        if (count($this->_where)) {
            $sql_query .= ' WHERE ';
            $sql_query .= implode($this->_where, ' AND ');
            
            // or statements
            if (count($this->_or)) {
                $sql_query .= ' OR ';
                $sql_query .= implode($this->_or, ' AND ');
            }
        }
        
        // Set the query
        $this->_sql_query = $sql_query;
        
        return $this;
    }
739540
function updateIntoDB() {
                    //Yaaay, alle Tests bestanden gogo, insert!
                    lastQry = connection.query('UPDATE ?? SET ? WHERE ?? = ?', [req.params.table , updateJson, updateSelector.field, updateSelector.value] , function (err) {
                        if (err) return sendError(res,err.code);
                        sendSuccessAnswer(req.params.table , res, req.params.id, updateSelector.field);

                    });
                }