Sign in Join

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

Mailing lists / lazarus / 2009-08

SQLDb ApplyUpdates

4 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

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

JoshyFun

Hello,

Lazarus: SVN a week ago.
fpc: 2.2.3, 2.2.4
Database: Firebird 1.5 and 2.1

Does anybody known a reason why this code will crash:

SQLQuery1.Delete;
SQLQuery1.ApplyUpdates;
SQLTransaction1.CommitRetaining;
SQLQuery1.Next;
SQLQuery1.Delete;
SQLQuery1.ApplyUpdates;
SQLTransaction1.CommitRetaining;

The crash happends in the second ApplyUpdates. This is a simplified copy of the original code which crashes when trying to delete a second record in a dbgrid, no matter the order or the position of both deleted records. This code was working fine in 2.2.2 fpc version but no more using fcp 2.2.3 or 2.2.4.

The error is quite strange:

-----------------------------------------
IBConnection1: PrepareStatement
-Dynamic SQL error
-SQL Error code = @1
-Token unknown - line @1, column @2
- at 1
-----------------------------------------

Maybe I must use a different approach to get the same result which is basically delete records in a dbgrid.

Note that the SQLQuery1 has a SQLDelete statement which is:

DELETE from TABLE where IDTAG=:IDTAG

The code works fine if I use commit instead CommitRetaining but in that case I lost the current position in the dbgrid and I must re fetch all data from database.

Any hint ? Thank you.

Best regards, JoshyFun

Reply by email

Joost van der Sluis
to JoshyFun

Op vrijdag 07-08-2009 om 18:05 uur [tijdzone +0200], schreef JoshyFun:

Show quoted text 15 lines
Hello, Lazarus: SVN a week ago. fpc: 2.2.3, 2.2.4 Database: Firebird 1.5 and 2.1 Does anybody known a reason why this code will crash: SQLQuery1.Delete; SQLQuery1.ApplyUpdates; SQLTransaction1.CommitRetaining; SQLQuery1.Next; SQLQuery1.Delete; SQLQuery1.ApplyUpdates; SQLTransaction1.CommitRetaining;

Can you make a bug-report for this? (Maybe you could even re-format the code above in a testcase for the db-testsuite in fcl-db/tests)

Show quoted text 15 lines
The crash happends in the second ApplyUpdates. This is a simplified copy of the original code which crashes when trying to delete a second record in a dbgrid, no matter the order or the position of both deleted records. This code was working fine in 2.2.2 fpc version but no more using fcp 2.2.3 or 2.2.4. The error is quite strange: ----------------------------------------- IBConnection1: PrepareStatement -Dynamic SQL error -SQL Error code = @1 -Token unknown - line @1, column @2 - at 1 -----------------------------------------

Probably some old handle is used, which becme invalid after the commitretaining.

Reply by email

JoshyFun
to Joost van der Sluis

Hello Joost,

Sunday, August 16, 2009, 3:53:32 PM, you wrote:

JvdS> Can you make a bug-report for this? (Maybe you could even re-format the JvdS> code above in a testcase for the db-testsuite in fcl-db/tests)

Bug report has been filled a few days ago and a suggested patch.

Best regards, JoshyFun

Reply by email