Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2012-05

TBufDataSet: ApplyUpdates

7 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Marcos Douglas

Hi,

I saw the TBufDataSet.ApplyUpdates and it calls ApplyRecUpdate. The ApplyRecUpdate just raises an exception...

There is some implementation, in some place, to work with ApplyUpdates (like a Delphi's TClientDataSet)?

Thanks
Marcos Douglas

LacaK
to Marcos Douglas
I saw the TBufDataSet.ApplyUpdates and it calls ApplyRecUpdate. The ApplyRecUpdate just raises an exception...

Yes it is virtual method, which can be overriden by descendants

There is some implementation, in some place, to work with ApplyUpdates (like a Delphi's TClientDataSet)?

Yes, see in sqldb.pp at TCustomSQLQuery

L.

Marcos Douglas
to LacaK
LacaK wrote 14 lines
> > I saw the TBufDataSet.ApplyUpdates and it calls ApplyRecUpdate. > The ApplyRecUpdate just raises an exception... > Yes it is virtual method, which can be overriden by descendants > There is some implementation, in some place, to work with ApplyUpdates > (like a Delphi's TClientDataSet)? > Yes, see in sqldb.pp at TCustomSQLQuery

Yeah... I did not know that the TCustomSQLQuery descended of TCustomBufDataSet. Well, I tried to use ApplyUpdates with TSQLQuery and TMSSQLConnection (SQLServer).
I put a DBGrid, DataSource... blablabla... I edited the record on the Grid and click in Apply button (ApplyUpdates(0))

ERROR 20019:
"Attempt to initiate a new SQL Server operation with results pending."

On the internet I found this:
http://www.sybase.com.br/detail?id=897#1825

I don't have other SGBD now to test so, I would like to know if this is a problem in TMSSQLConnection or in ApplyUpdates?

Thanks,

Marcos Douglas

LacaK
to Marcos Douglas

Marcos Douglas wrote / napísal(a):

Show quoted text 33 lines
On Thu, May 3, 2012 at 2:52 AM, LacaK wrote: >> I saw the TBufDataSet.ApplyUpdates and it calls ApplyRecUpdate. >> The ApplyRecUpdate just raises an exception... >> >> > Yes it is virtual method, which can be overriden by descendants > > > >> There is some implementation, in some place, to work with ApplyUpdates >> (like a Delphi's TClientDataSet)? >> >> > Yes, see in sqldb.pp at TCustomSQLQuery > Yeah... I did not know that the TCustomSQLQuery descended of TCustomBufDataSet. Well, I tried to use ApplyUpdates with TSQLQuery and TMSSQLConnection (SQLServer). I put a DBGrid, DataSource... blablabla... I edited the record on the Grid and click in Apply button (ApplyUpdates(0)) ERROR 20019: "Attempt to initiate a new SQL Server operation with results pending." On the internet I found this: http://www.sybase.com.br/detail?id=897#1825 I don't have other SGBD now to test so, I would like to know if this is a problem in TMSSQLConnection or in ApplyUpdates?

Yes it is a known problem (also in ODBC), read also in sqldb/mssql/readme.txt:
- DB-Library error 10038 "Results Pending" - set
TSQLQuery.PacketRecords=-1 to fetch all pendings rows HTH
-Laco.

Marcos Douglas
to LacaK
LacaK wrote 47 lines
Marcos Douglas  wrote / napísal(a): On Thu, May 3, 2012 at 2:52 AM, LacaK wrote: I saw the TBufDataSet.ApplyUpdates and it calls ApplyRecUpdate. The ApplyRecUpdate just raises an exception... Yes it is virtual method, which can be overriden by descendants There is some implementation, in some place, to work with ApplyUpdates (like a Delphi's TClientDataSet)? Yes, see in sqldb.pp at TCustomSQLQuery Yeah... I did not know that the TCustomSQLQuery descended of TCustomBufDataSet. Well, I tried to use ApplyUpdates with TSQLQuery and TMSSQLConnection (SQLServer). I put a DBGrid, DataSource... blablabla... I edited the record on the Grid and click in Apply button (ApplyUpdates(0)) ERROR 20019: "Attempt to initiate a new SQL Server operation with results pending." On the internet I found this: http://www.sybase.com.br/detail?id=897#1825 I don't have other SGBD now to test so, I would like to know if this is a problem in TMSSQLConnection or in ApplyUpdates? Yes it is a known problem (also in ODBC), read also in sqldb/mssql/readme.txt: - DB-Library error 10038 "Results Pending" - set TSQLQuery.PacketRecords=-1 to fetch all pendings rows HTH -Laco.

You're right, but I have others problems:
I changed PacketRecords=-1 and test again. No errors, but didn't commited (I'm seeing the SQL Profiler).
So, I used:

  SQLQuery1.ApplyUpdates(0);
  SQLTransaction1.Commit;

Worked, using Commit, but the DataSet was closed (?)

The SQLQuery properties are:
UpdateMode = upWhereKeyOnly
UsePrimaryKeyAsKey = True

Maybe there is no problem and I just have to know how the SQLdb works. Could you help me on this?

Marcos Douglas

Sven Barth
to Marcos Douglas
Marcos Douglas wrote 64 lines
On Thu, May 3, 2012 at 10:01 AM, LacaK wrote: > Marcos Douglas wrote / napísal(a): > > On Thu, May 3, 2012 at 2:52 AM, LacaK wrote: > > > I saw the TBufDataSet.ApplyUpdates and it calls ApplyRecUpdate. > The ApplyRecUpdate just raises an exception... > > > > Yes it is virtual method, which can be overriden by descendants > > > > > There is some implementation, in some place, to work with ApplyUpdates > (like a Delphi's TClientDataSet)? > > > > Yes, see in sqldb.pp at TCustomSQLQuery > > > Yeah... I did not know that the TCustomSQLQuery descended of > TCustomBufDataSet. > Well, I tried to use ApplyUpdates with TSQLQuery and TMSSQLConnection > (SQLServer). > I put a DBGrid, DataSource... blablabla... I edited the record on the > Grid and click in Apply button (ApplyUpdates(0)) > > ERROR 20019: > "Attempt to initiate a new SQL Server operation with results pending." > > On the internet I found this: > http://www.sybase.com.br/detail?id=897#1825 > > I don't have other SGBD now to test so, I would like to know if this > is a problem in TMSSQLConnection or in ApplyUpdates? > > > > Yes it is a known problem (also in ODBC), read also in > sqldb/mssql/readme.txt: > - DB-Library error 10038 "Results Pending" - set TSQLQuery.PacketRecords=-1 > to fetch all pendings rows > HTH > -Laco. You're right, but I have others problems: I changed PacketRecords=-1 and test again. No errors, but didn't commited (I'm seeing the SQL Profiler). So, I used: SQLQuery1.ApplyUpdates(0); SQLTransaction1.Commit; Worked, using Commit, but the DataSet was closed (?) The SQLQuery properties are: UpdateMode = upWhereKeyOnly UsePrimaryKeyAsKey = True Maybe there is no problem and I just have to know how the SQLdb works. Could you help me on this?

If you don't want the dataset closed then you must use CommitRetaining (or RollbackRetaining for Rollback).

Regards,
Sven

Marcos Douglas
to Sven Barth
Sven Barth wrote 76 lines
On 03.05.2012 15:40, Marcos Douglas wrote: > > On Thu, May 3, 2012 at 10:01 AM, LacaK  wrote: >> >> Marcos Douglas  wrote / napísal(a): >> >> On Thu, May 3, 2012 at 2:52 AM, LacaK  wrote: >> >> >> I saw the TBufDataSet.ApplyUpdates and it calls ApplyRecUpdate. >> The ApplyRecUpdate just raises an exception... >> >> >> >> Yes it is virtual method, which can be overriden by descendants >> >> >> >> >> There is some implementation, in some place, to work with ApplyUpdates >> (like a Delphi's TClientDataSet)? >> >> >> >> Yes, see in sqldb.pp at TCustomSQLQuery >> >> >> Yeah... I did not know that the TCustomSQLQuery descended of >> TCustomBufDataSet. >> Well, I tried to use ApplyUpdates with TSQLQuery and TMSSQLConnection >> (SQLServer). >> I put a DBGrid, DataSource... blablabla... I edited the record on the >> Grid and click in Apply button (ApplyUpdates(0)) >> >> ERROR 20019: >> "Attempt to initiate a new SQL Server operation with results pending." >> >> On the internet I found this: >> http://www.sybase.com.br/detail?id=897#1825 >> >> I don't have other SGBD now to test so, I would like to know if this >> is a problem in TMSSQLConnection or in ApplyUpdates? >> >> >> >> Yes it is a known problem (also in ODBC), read also in >> sqldb/mssql/readme.txt: >> - DB-Library error 10038 "Results Pending" - set >> TSQLQuery.PacketRecords=-1 >> to fetch all pendings rows >> HTH >> -Laco. > > > You're right, but I have others problems: > I changed PacketRecords=-1 and test again. No errors, but didn't > commited (I'm seeing the SQL Profiler). > So, I used: >   SQLQuery1.ApplyUpdates(0); >   SQLTransaction1.Commit; > > Worked, using Commit, but the DataSet was closed (?) > > The SQLQuery properties are: > UpdateMode = upWhereKeyOnly > UsePrimaryKeyAsKey = True > > Maybe there is no problem and I just have to know how the SQLdb works. > Could you help me on this? If you don't want the dataset closed then you must use CommitRetaining (or RollbackRetaining for Rollback). Regards, Sven

Yeah, I remember now... =(
I already talked with Laco about this months ago (Laco, sorry my forgetfulness) Sven, thanks for the info.

BTW, worked perfectly.

Thanks.

Marcos Douglas