TMyTable delete error if in state DSEdit

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
TobiasHo
Posts: 30
Joined: Thu 11 Jul 2019 09:12

TMyTable delete error if in state DSEdit

Post by TobiasHo » Thu 04 Mar 2021 09:19

Is that a bug or a feature:

I use a TMyTable
1. Insert a record
2. post
3. set the state to edit
4. delete the record

Behaviour: the record is not being deleted.
Is that the expected behaviour?

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: TMyTable delete error if in state DSEdit

Post by ViktorV » Thu 04 Mar 2021 15:46

Unfortunately, we are unable to reproduce the problem in our environment based on the information you provide.
In order for us to be able to give you a detailed answer, please compose a small sample demonstrating the described behavior and send it to us using the contact form https://devart.com/company/contactform.html including the scripts for creating database objects. Also specify the version of the MySQL server that you are using.

TobiasHo
Posts: 30
Joined: Thu 11 Jul 2019 09:12

Re: TMyTable delete error if in state DSEdit

Post by TobiasHo » Thu 04 Mar 2021 16:10

Sorry I don´t have the time at the moment.
We fixed the problem by adding a post to the table before we delete (berfore delete function) the row.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: TMyTable delete error if in state DSEdit

Post by ViktorV » Tue 09 Mar 2021 18:04

We've sucessfully deleted a row with the following code:

Code: Select all

  MyTable.TableName := 'DEPT';
  MyTable.Open;
  MyTable.Insert;
  MyTable.Fields[0].AsInteger := 1;
  MyTable.Post;
  MyTable.Edit;
  MyTable.Fields[0].AsInteger := 2;
  MyTable.Delete;
We couldn't reproduce the issue without a sample project, unfortunately. We would greatly appreciate it if you would send us a sample project.

TobiasHo
Posts: 30
Joined: Thu 11 Jul 2019 09:12

Re: TMyTable delete error if in state DSEdit

Post by TobiasHo » Thu 18 Mar 2021 09:37

Thanks for investigating .... then there might be a side issue in my code!

TobiasHo
Posts: 30
Joined: Thu 11 Jul 2019 09:12

Re: TMyTable delete error if in state DSEdit

Post by TobiasHo » Thu 18 Mar 2021 09:56

Code: Select all

 Kopf.Insert;
 KopfSumme.AsFloat:=10000;
 Kopf.Post;
 Kopf.Edit;
 KopfSumme.AsFloat:=20000;
 Kopf.Delete;
No, there is a problem ...
That is exactly what I am doing.
The row with the 10000 value stays in the table after the delete command. If I add a post before the delete - everything is fine !!!

TobiasHo
Posts: 30
Joined: Thu 11 Jul 2019 09:12

Re: TMyTable delete error if in state DSEdit

Post by TobiasHo » Thu 18 Mar 2021 09:58

My MySQL Setup:

Server: Localhost via UNIX socket
Server-Typ: MySQL
Server-Version: 5.5.62-0ubuntu0.14.04.1 - (Ubuntu)

TobiasHo
Posts: 30
Joined: Thu 11 Jul 2019 09:12

Re: TMyTable delete error if in state DSEdit

Post by TobiasHo » Thu 18 Mar 2021 10:08

I think this will help:
this works:
[img]htts://www.honscha.de/withpost.jpg[/img]
that fails:
[img]htts://www.honscha.de/withoutpost.jpg[/img]

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: TMyTable delete error if in state DSEdit

Post by ViktorV » Fri 19 Mar 2021 14:40

Unfortunately, we are unable to reproduce the issue in our environment based on the information you provide. Perhaps the reason is in the settings of the component or server.
In order for us to be able to give you a detailed answer, please compose a small sample demonstrating the described behavior and send it to us using the contact form https://devart.com/company/contactform.html

TobiasHo
Posts: 30
Joined: Thu 11 Jul 2019 09:12

Re: TMyTable delete error if in state DSEdit

Post by TobiasHo » Fri 19 Mar 2021 14:43

Did you check the DBMonitor output?

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: TMyTable delete error if in state DSEdit

Post by ViktorV » Fri 19 Mar 2021 14:46

Yes, they are different from your screenshots. Therefore, we asked to send an example to understand what properties you have set for our components.

TobiasHo
Posts: 30
Joined: Thu 11 Jul 2019 09:12

Re: TMyTable delete error if in state DSEdit

Post by TobiasHo » Sat 20 Mar 2021 16:52

Try this and you can reproduce the error:

Code: Select all


 Kopf.LockMode:=lmPessimistic;
 Kopf.RefreshOptions:=[roBeforeEdit];
 Kopf.Insert;
 KopfSumme.AsFloat:=10000;
 Kopf.Post;
 Kopf.Edit;
 KopfSumme.AsFloat:=20000;
// Kopf.Post;
 Kopf.Delete;
 

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: TMyTable delete error if in state DSEdit

Post by ViktorV » Mon 22 Mar 2021 13:51

Thank you for the information.
We've fixed the issue with transaction commiting when LockMode = lmPessimistic. The fix will be included in the next version MyDAC, which we're planning to release this week or early next week.

TobiasHo
Posts: 30
Joined: Thu 11 Jul 2019 09:12

Re: TMyTable delete error if in state DSEdit

Post by TobiasHo » Tue 23 Mar 2021 13:30

That is great news ... maybe you could release the code as soon as possible so I can patch my projects.

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: TMyTable delete error if in state DSEdit

Post by ViktorV » Wed 24 Mar 2021 15:08

If you need a night build for another IDE please provide the IDE version to us using contact form https://devart.com/company/contactform.html and we will send you a night build.

Post Reply