Hi,
I’m trying to use OrmLite’s ToUpdateStatement overload that accepts updateFields, but it looks like the parameter is ignored.
Expected: when I pass updateFields, the generated SQL should include only those fields in the SET clause.
However, in the current implementation, ToUpdateStatement calls PrepareParameterizedUpdateStatement<T>(dbCmd) without passing updateFields, so it appears the optional parameter is never applied:
public virtual string ToUpdateStatement<T>(IDbCommand dbCmd, T item, ICollection<string> updateFields = null)
{
dbCmd.Parameters.Clear();
var dialectProvider = dbCmd.GetDialectProvider();
// updateFields is not passed here
dialectProvider.PrepareParameterizedUpdateStatement<T>(dbCmd);
if (string.IsNullOrEmpty(dbCmd.CommandText))
return null;
dialectProvider.SetParameterValues<T>(dbCmd, item);
return MergeParamsIntoSql(dbCmd.CommandText, ToArray(dbCmd.Parameters));
}
Is this by design (i.e., updateFields is only supported elsewhere), or is this a bug and the call should be something like PrepareParameterizedUpdateStatement<T>(dbCmd, updateFields) (or equivalent) so the generated statement respects the provided field list?
Thanks.