public void DeleteWhere(TableName table, IWhereFragment @where) { if (table == null) throw new ArgumentNullException(nameof(table)); if (@where == null) throw new ArgumentNullException(nameof(@where)); var whereClause = @where.ToSql(_command); var call = new DeleteWhereCall(table, whereClause); _calls.Add(call); }
public static string AppendWhere(this string sql, IWhereFragment where, NpgsqlCommand command) { if (where == null) { return(sql); } return(sql + " where " + where.ToSql(command)); }
public void AddParameters(IBatchCommand batch) { var patchJson = batch.Serializer.ToCleanJson(_patch); var patchParam = batch.AddParameter(patchJson, NpgsqlDbType.Jsonb); var versionParam = batch.AddParameter(CombGuidIdGeneration.NewGuid(), NpgsqlDbType.Uuid); var where = _fragment.ToSql(batch.Command); _sql = $@" update {_document.Table.QualifiedName} as d set data = {_transform.Function.QualifiedName}(data, :{patchParam.ParameterName}), {DocumentMapping.LastModifiedColumn} = (now() at time zone 'utc'), {DocumentMapping.VersionColumn} = :{versionParam.ParameterName} where {where}"; }
public void RegisterUpdate(UpdateBatch batch) { batch.AddCall(cmd => { var patchJson = batch.Serializer.ToCleanJson(_patch); var patchParam = cmd.AddParameter(patchJson, NpgsqlDbType.Jsonb); var where = _fragment.ToSql(cmd.Command); _sql = $"update {_document.Table.QualifiedName} as d set data = {_transform.Function.QualifiedName}(data, :{patchParam.ParameterName}) where {where}"; return(this); }); }
public void DeleteWhere(TableName table, IWhereFragment @where) { if (table == null) { throw new ArgumentNullException(nameof(table)); } if (@where == null) { throw new ArgumentNullException(nameof(@where)); } var whereClause = @where.ToSql(Command); var call = new DeleteWhereCall(table, whereClause); AddCall(call); }
public string ToSql(NpgsqlCommand command) { return($"NOT({_inner.ToSql(command)})"); }
void IStorageOperation.AddParameters(IBatchCommand batch) { var whereClause = _where.ToSql(batch.Command); Sql = Sql.Replace("?", whereClause); }
public void DeleteWhere(string tableName, IWhereFragment @where) { var whereClause = @where.ToSql(_command); var call = new DeleteWhereCall(tableName, whereClause); _calls.Add(call); }