Class: TMMUpdater
property UpdateColumns : TArray<string>;
Ordered list of MySQL column names to include in the operation.
Set before calling Prepare.
Default: empty array.
Empty (default) — all non-generated columns of the
target table are included.
Prepare adopts the server schema directly as the buffer
schema without filtering.
Non-empty — only the listed columns are included in
the buffer table and sent to the server.
Column matching is case-insensitive.
Generated columns (VIRTUAL or STORED) are
always excluded regardless of whether they appear in the list.
umInsert and
umUpsertOnly the listed columns are included. To insert or upsert rows
correctly, list every column that must carry data, including primary key
columns that are not AUTO_INCREMENT or
GENERATED.
umUpdatePrimary key columns are always force-included even
when absent from the list — Prepare needs them to build the
WHERE predicate. At least one non-PK column must remain
after filtering, otherwise Prepare fails with a log
message.
ColumnsUpdateColumns is a write-before-Prepare
input.
Columns is the
read-only output produced by Prepare — the resolved
metadata for the columns that were actually selected.
UpdateColumnsListAt design time the Object Inspector exposes
UpdateColumnsList (TStrings,
published) as a memo-style editor for the same column
list.
UpdateColumnsList is a mirror of
UpdateColumns: the getter rebuilds from the array; the
setter writes back to it.
At runtime always use UpdateColumns
(TArray<string>) directly — it is more efficient and
avoids the intermediate TStrings object:
// runtime — preferred
Updater.UpdateColumns := ['id', 'status', 'updated_at'];
// equivalent, but verbose; only needed when building the list dynamically
Updater.UpdateColumnsList.Clear;
Updater.UpdateColumnsList.Add('id');
Updater.UpdateColumnsList.Add('status');
Updater.UpdateColumnsList.Add('updated_at');
// setter is called automatically by the OI; call it explicitly at runtime:
Updater.UpdateColumnsList := Updater.UpdateColumnsList; // not needed with TArray assignment
Mutating the
TStringsobject returned by the getter in-place (e.g.Updater.UpdateColumnsList.Add(...)) does not updateUpdateColumns. Always assign via the property setter or useUpdateColumnsdirectly.
// Update status and updated_at only; leave large BLOB columns untouched.
// PK column 'id' is force-included by Prepare for umUpdate.
Updater.TargetTable := 'orders';
Updater.Mode := umUpdate;
Updater.UpdateColumns := ['status', 'updated_at'];
Updater.Prepare;
// Buffer table contains: id (PK, auto-added), status, updated_at