[fpc-pascal] SqlDB TSQLQuery sqoAutoApplyUpdates does not work with ExecSQL
Michael Van Canneyt
michael at freepascal.org
Fri Dec 16 08:50:39 CET 2022
On Fri, 16 Dec 2022, Andi Friess via fpc-pascal wrote:
> Am 15.12.2022 um 14:59 schrieb Michael Van Canneyt via fpc-pascal:
>>
>>
>> On Thu, 15 Dec 2022, Andreas Frieß via fpc-pascal wrote:
>>
>>>> Post operation.
>>>
>>> No, if you use a stored procedure on the MSSQL Server there can be
>>> changes on tables. Without the ApplyUpdates these changes are not
>>> persitent. If you close and reopen the connection ALL is lost. With
>>> ApplyUpdates it works.
>>
>> Yes, but the reason is a side effect of using ApplyUpdates. See below.
>>
>> ApplyUpdates as you use it, is not the correct solution.
>> Once more: ApplyUpdates ONLY makes sense after changing data and doing a
>> Post. Any other use does not make any sense.
>>
> Data is changed by the SP. But this is done in a simpy open in the
> query. No insert or delete of the Query is activated. It must be done
> with open, because a resultset is returned. This can not be handled by
> ExecSQL (maybe ia wrong).
"after changing data" must be understood as 'you change data in the
dataset', i.e. a post or delete operation on the dataset.
TDataset cannot know what happens behind the scenes in a stored procedure.
Since you are not doing a Post(), ApplyUpdates does not apply, nor does
sqoAutoCommit. Both are relevant only afer a Post() or Delete.
I will add some remarks to the documentation to make this more clear.
Michael.
More information about the fpc-pascal
mailing list