PATCH/PUT /table_name/1
 PATCH/PUT /table_name/1.json
338010
def update
			@instance = get_model.find(params[:id])

			respond_to do |format|
				if @instance.update(instance_params)
					flash[:notice] = "#{get_model.name} was successfully updated."
					format.html { render 'quick_dry/show' }
					format.json { render json:@instance, status: :ok, location: get_url}
				else
					format.html { render 'quick_dry/edit' }
					format.json { render json: @instance.errors, status: :unprocessable_entity}
				end
			end
		end
334079
def patch_resource(self, path, body=None, json=None):
        
        url = '%s%s' % (path, self._param_list())
        headers = {
            'Accept': 'application/json;odata=minimalmetadata'
        }

        if json:
            headers['Content-Type'] = 'application/json'
            body = json_dumps(json)

        response = O365_DAO().patchURL(self._url(url), headers, body)

        if not (response.status == 200 or response.status == 201 or
                response.status == 204):
            raise DataFailureException(url, response.status, response.data)

        return json_loads(response.data) if len(response.data) else {}
1263861
function patch(node) {
    var data = node.data || {};

    data.stem = stemmer(nlcstToString(node));

    node.data = data;
}
720370
def update_install_json():
        """"""
        if not os.path.isfile('install.json'):
            return

        with open('install.json', 'r') as f:
            install_json = json.load(f)

        if install_json.get('programMain'):
            install_json['programMain'] = 'run'

        # update features
        install_json['features'] = ['aotExecutionEnabled', 'appBuilderCompliant', 'secureParams']

        with open('install.json', 'w') as f:
            json.dump(install_json, f, indent=2, sort_keys=True)
754611
def _api_model_patch_replace(conn, restApiId, modelName, path, value):
    '''
    
    '''
    response = conn.update_model(restApiId=restApiId, modelName=modelName,
                                 patchOperations=[{'op': 'replace', 'path': path, 'value': value}])
    return response
1086971
def update(self,table, sys_id, **kparams):
        
        result = self.table_api_put(table, sys_id, **kparams)
        return self.to_record(result, table)
574596
def replace data_hash = {}
    sql, *binds = SQLHelper.replace :table => name,
                                    :data => @query_default.merge(data_hash),
                                    :prepared => true
    pstmt = prepare :insert, sql
    pstmt.send @update_method, *binds
  end
249724
function addPatch(patches, patch) {
	var lastPatch = patches[patches.length -1];
	if(lastPatch) {
		// same number of deletes and counts as the index is back
		if(lastPatch.deleteCount === lastPatch.insert.length && (patch.index - lastPatch.index === lastPatch.deleteCount) ) {
			lastPatch.insert.push.apply(lastPatch.insert, patch.insert);
			lastPatch.deleteCount += patch.deleteCount;
			return;
		}
	}
	patches.push(patch);
}
658712
function ChangeTableSQL($tablename, $flds, $tableoptions = false, $dropOldFlds=false)
	{
	global $ADODB_FETCH_MODE;

		$save = $ADODB_FETCH_MODE;
		$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
		if ($this->connection->fetchMode !== false) $savem = $this->connection->SetFetchMode(false);

		// check table exists
		$save_handler = $this->connection->raiseErrorFn;
		$this->connection->raiseErrorFn = '';
		$cols = $this->MetaColumns($tablename);
		$this->connection->raiseErrorFn = $save_handler;

		if (isset($savem)) $this->connection->SetFetchMode($savem);
		$ADODB_FETCH_MODE = $save;

		if ( empty($cols)) {
			return $this->CreateTableSQL($tablename, $flds, $tableoptions);
		}

		if (is_array($flds)) {
		// Cycle through the update fields, comparing
		// existing fields to fields to update.
		// if the Metatype and size is exactly the
		// same, ignore - by Mark Newham
			$holdflds = array();
			foreach($flds as $k=>$v) {
				if ( isset($cols[$k]) && is_object($cols[$k]) ) {
					// If already not allowing nulls, then don't change
					$obj = $cols[$k];
					if (isset($obj->not_null) && $obj->not_null)
						$v = str_replace('NOT NULL','',$v);
					if (isset($obj->auto_increment) && $obj->auto_increment && empty($v['AUTOINCREMENT']))
					    $v = str_replace('AUTOINCREMENT','',$v);

					$c = $cols[$k];
					$ml = $c->max_length;
					$mt = $this->MetaType($c->type,$ml);

					if (isset($c->scale)) $sc = $c->scale;
					else $sc = 99; // always force change if scale not known.

					if ($sc == -1) $sc = false;
					list($fsize, $fprec) = $this->_getSizePrec($v['SIZE']);

					if ($ml == -1) $ml = '';
					if ($mt == 'X') $ml = $v['SIZE'];
					if (($mt != $v['TYPE']) || ($ml != $fsize || $sc != $fprec) || (isset($v['AUTOINCREMENT']) && $v['AUTOINCREMENT'] != $obj->auto_increment)) {
						$holdflds[$k] = $v;
					}
				} else {
					$holdflds[$k] = $v;
				}
			}
			$flds = $holdflds;
		}


		// already exists, alter table instead
		list($lines,$pkey,$idxs) = $this->_GenFields($flds);
		// genfields can return FALSE at times
		if ($lines == null) $lines = array();
		$alter = 'ALTER TABLE ' . $this->TableName($tablename);
		$sql = array();

		foreach ( $lines as $id => $v ) {
			if ( isset($cols[$id]) && is_object($cols[$id]) ) {

				$flds = Lens_ParseArgs($v,',');

				//  We are trying to change the size of the field, if not allowed, simply ignore the request.
				// $flds[1] holds the type, $flds[2] holds the size -postnuke addition
				if ($flds && in_array(strtoupper(substr($flds[0][1],0,4)),$this->invalidResizeTypes4)
				 && (isset($flds[0][2]) && is_numeric($flds[0][2]))) {
					if ($this->debug) ADOConnection::outp(sprintf("<h3>%s cannot be changed to %s currently</h3>", $flds[0][0], $flds[0][1]));
					#echo "<h3>$this->alterCol cannot be changed to $flds currently</h3>";
					continue;
	 			}
				$sql[] = $alter . $this->alterCol . ' ' . $v;
			} else {
				$sql[] = $alter . $this->addCol . ' ' . $v;
			}
		}

		if ($dropOldFlds) {
			foreach ( $cols as $id => $v )
			    if ( !isset($lines[$id]) )
					$sql[] = $alter . $this->dropCol . ' ' . $v->name;
		}
		return $sql;
	}
88328
function compile(patch) {
  var code = "";
  patch.forEach(function(op) {
    var o = "";
    switch (op.op) {
      case "remove":
        o += "delete " + pathToStatement(op.path);
        break;
      case "add":
        o += pathToStatement(op.path) + " = " + JSON.stringify(op.value);
        break;
      case "replace":
        o += pathToStatement(op.path) + " = " + JSON.stringify(op.value);
        break;
      case "move":
        var from = pathToStatement(op.from);
        o += pathToStatement(op.path) + " = " + from + ";\n";
        o += "delete " + from;
        break;
      case "copy":
        o += pathToStatement(op.path) + " = " + from;
        break;
      case "test":
        o +=
          "if (!oo.equal(" +
          pathToStatement(op.path) +
          ", " +
          JSON.stringify(op.value) +
          ") throw new Error()";
        break;
    }
    code += o + ";\n";
  });
  return code;
}
710839
def patches
      patch = {}
      loaded_headers.each do |header|
        header.patches.each do |key, val|
          patch[key + header.offset] = val
        end
      end
      patch
    end
1073867
function fixHttpMethod (fn, name) {
  if (fn.http && fn.http.verb && fn.http.verb.toLowerCase() === 'put') {
    fn.http.verb = 'patch'
  }
}
83736
def set_table_name
      [self.old_name, self.new_name].each do |name|
        # make sure this table exists
        if self.table_exists?(name)
          # return true if we are already using this table
          return true if self.klass.table_name == name.to_s
          # otherwise we can change the table name
          self.klass.table_name = name
          return true
        end
      end
      self.raise_no_table_error
    end
218514
private void updateDOTable() throws InstallationFailedException {
        if (_db.equals(InstallOptions.INCLUDED)) {
            return; // no need to update embedded
        }
        try {
            Connection conn = getConnection();
            DatabaseMetaData dmd = conn.getMetaData();
            ResultSet rs = dmd.getTables(null, null, "do%", null);
            while (rs.next()) {
                if (rs.getString("TABLE_NAME").equals("do")) {
                    Statement stmt = conn.createStatement();
                    stmt.execute("ALTER TABLE do RENAME TO dobj");
                    System.out.println("Renamed table 'do' to 'dobj'.");
                    stmt.close();
                }
            }
            rs.close();
        } catch (Exception e) {
            throw new InstallationFailedException(e.getMessage(), e);
        }
    }
82056
def rename_tables(db, table_mapping, reverse=False):
    
    from django.db import connection
    if reverse:
        table_mapping = [(dst, src) for src, dst in table_mapping]
    table_names = connection.introspection.table_names()
    for source, destination in table_mapping:
        if source in table_names and destination in table_names:
            print(u"    WARNING: not renaming {0} to {1}, because both tables already exist.".format(source, destination))
        elif source in table_names and destination not in table_names:
            print(u"     - renaming {0} to {1}".format(source, destination))
            db.rename_table(source, destination)
810548
def update(self, resource, resource_id, data):
        '''
        
        '''
        service_def, resource_def, path = self._get_service_information(
            resource)

        update_path = "{0}{1}/" . format(path, resource_id)
        return self.call(path=update_path, data=data, method='patch')
494307
def patch(self):
        
        from django.db.models.sql import compiler

        self._read_compilers = (
            compiler.SQLCompiler,
            compiler.SQLAggregateCompiler,
            compiler.SQLDateCompiler,
        )
        self._write_compilers = (
            compiler.SQLInsertCompiler,
            compiler.SQLDeleteCompiler,
            compiler.SQLUpdateCompiler,
        )
        if not self._patched:
            self._original = {}
            for reader in self._read_compilers:
                self._original[reader] = reader.execute_sql
                reader.execute_sql = self._monkey_select(reader.execute_sql)
            for updater in self._write_compilers:
                self._original[updater] = updater.execute_sql
                updater.execute_sql = self._monkey_write(updater.execute_sql)
            self._patched = True
            self.cache_backend.patch()
            self._handle_signals()