Page 1 of 1

TZAbstractDataset.CommitUpdates

Posted: 08.08.2014, 13:24
by rautgigi
Hi,

I think there is an error inside TZAbstractDataset.CommitUpdates in ZAbstractDataSet.pas. There should be a call to CachedResultSet.PostUpdates instead of CachedResultSet.CancelUpdates. PostUpdates call PostRowUpdates(OldRowAccessor, NewRowAccessor), which will copy buffer from NewRowAccessor. If we call CancelUpdates the buffer is copied from InitialRow to CurrentRow.

To fix it, we should modify:

procedure TZAbstractDataset.CommitUpdates;
begin
CheckBrowseMode;

if CachedResultSet <> nil then
CachedResultSet.CancelUpdates;
end;

Into :
procedure TZAbstractDataset.CommitUpdates;
begin
CheckBrowseMode;

if CachedResultSet <> nil then
CachedResultSet.PostUpdates;
end;

All the best,
Bogdan

Re: TZAbstractDataset.CommitUpdates

Posted: 10.08.2014, 21:23
by EgonHugeist
First i was thinking you are right, but:

http://docwiki.embarcadero.com/Librarie ... mitUpdates

Bogdan, something else:

Could you please recompile FreeTDS? With the bcp_functions(i'll implement the batch insartiation later) and it would be nice to get the three missing functions running:
function dbRetData(dbProc: PDBPROCESS; RetNum: DBINT): Pointer;
function dbRetLen(dbProc: PDBPROCESS; RetNum: DBINT): DBINT;
function dbRetType(dbProc: PDBPROCESS; RetNum: DBINT): DBINT;

We are still not able to execute stored-procedures with FreeTDS
Best practice for later "prepare refactoring" would be to have all of these http://technet.microsoft.com/en-us/libr ... 80%29.aspx function available.
Any ideas? Do you know why?

Re: TZAbstractDataset.CommitUpdates

Posted: 11.08.2014, 11:45
by rautgigi
Hi Michael,

Yes it's seems that PostUpdates is not the right direction, but also CancelUpdates is not ok, i think there should be DisposeCachedUpdates (in order to only free the cached rows). If you work in AutoCommit, than ApplyUpdates call PostUpdates which copy data and free cached rows. When you are not in AutoCommit only copy data from cache and doesn't free cached rows.

For FreeTDS i see that the functions are ok, i will try to export and recompile the library.

All the best,
Bogdan

Re: TZAbstractDataset.CommitUpdates

Posted: 12.08.2014, 10:44
by miab3
@rautgigi,
rautgigi wrote: For FreeTDS i see that the functions are ok, i will try to export and recompile the library.
Could you try it with the newer version of the source?
Maybe this?
http://fossies.org/linux/privat/
http://fossies.org/linux/privat/freetds ... 12.tar.gz/

Michal