public async Task <int> UpdateAsync(UpdateStatement updateStatement, dynamic vars) { Dict varsDict = updateStatement.ConvertParamsToDict(vars); Dict varsOverrides = this.database.GetOverrideValues(updateStatement.StatementFromRefs[0].table); varsDict.UpdateFrom(varsOverrides); this.database.PreprocessInput(updateStatement.StatementFromRefs[0].table.Name, varsDict); (var whereIndex, var setRefs, var whereRefs) = updateStatement.GetWhereIndexSetRefsAndWhereRefs(this.database, varsDict); (string executableSql, Dict executableParams) = updateStatement.GetExecutableSqlAndParams(varsDict, setRefs, whereRefs); object keyValue = await this.GetKeyValue(whereIndex, varsDict, executableParams, whereRefs, updateStatement.StatementFromRefs[0].table.Indexes[0], updateStatement.StatementFromRefs[0].table.Name); int count; if (keyValue == null) { count = 0; } else { count = await this.DoUpdateAsync(executableSql, executableParams); this.dataEvents.Add(new KeyValueDataEvent(DataEventType.Update, updateStatement.StatementFromRefs[0].table.Name, keyValue)); this.database.UpdateCount++; } return(count); }
// Update methods public async Task <int> UpdateAsync(string updateStatement, dynamic vars) { UpdateStatement statement = new UpdateStatement(this.database, updateStatement); return(await this.UpdateAsync(statement, vars)); }