You are not logged in.
Pages: 1
I noticed the following when trying to retrieve orm instances:
I am using the Retrieve:
function Retrieve(const SqlWhere: RawUtf8; Value: TOrm; const aCustomFieldsCsv: RawUtf8 = ''): boolean;
When defining custom return of fileds in aCustomFieldsCsv, the RowID must be included in order to be returned.
In the following function, if RowID is included in CustomCsvFields then the update call fails:
function Update(Value: TOrm; const CustomCsvFields: RawUtf8; DoNotAutoComputeFields: boolean): boolean;
When using TFieldBits, ID/RowID is not included and it is manipulated separately.
The following function helps also not to have an error if included in the input string:
function FieldBitsFromCsv(const aFieldsCsv: RawUtf8; var Bits: TFieldBits; out withID: boolean): boolean;
I surely understand that in an update nobody will include the RowID to be updated, but in Retrieve this difference it is not clear in the documentation
My proposal, is not to change anything in the code. Just include in the Retrieve's comments (to be included in the future in the documentation) that as aCustomFieldsCsv is injected directly in the Select query, RowID must be included if needed.
Last edited by dcoun (2023-03-26 08:53:41)
Offline
Please check https://github.com/synopse/mORMot2/commit/688c4396
I hope it helps to resolve any such problem.
Offline
Pages: 1