#1 2013-04-08 06:07:40

dc
Member
Registered: 2012-11-16
Posts: 46

SynOleDB and UpdateCount

Hi, there is no overriden UpdateCount method in TOleDBStatement.
I've made a quick hack and it seams to work properly with SQLServer. Not sure though whether it is consistent with your vision. Here is patch made from WinMerge (file SynOleDB.pas based on leaf 672e31903b):

999a1000
>     function UpdateCount: integer; override;
1592c1593
<       OleDBConnection.OleDBCheck(fCommand.Execute(nil,DB_NULLGUID,fDBParams,nil,nil));
---
>       OleDBConnection.OleDBCheck(fCommand.Execute(nil,DB_NULLGUID,fDBParams,@fTotalRowsRetrieved,nil));
1675a1677,1683
> end;
> 
> function TOleDBStatement.UpdateCount: integer;
> begin
>   if not fExpectResults then
>     result := TotalRowsRetrieved
>   else result := 0;

regards
dc

Offline

#2 2013-04-08 07:42:37

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,240
Website

Re: SynOleDB and UpdateCount

I've added a TOleDBStatement.UpdateCount overriden method from your proposal.
http://synopse.info/fossil/info/1f0ccd0924

A new private field has been used instead of fTotalRowsRetrieved, since this one is used for the "Total" Rows inserted by the statement, even after a reset.

Note that our mORMot ORM does not use this method, so it was not mandatory to have our DB core to work.

Thanks a lot for the feedback, and code proposal!
smile

Offline

#3 2013-04-08 07:45:04

dc
Member
Registered: 2012-11-16
Posts: 46

Re: SynOleDB and UpdateCount

Glad I could contribute to your great project smile

Offline

Board footer

Powered by FluxBB