auto commit property?

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
dragonstar
Posts: 19
Joined: Sat 18 Apr 2009 21:02

auto commit property?

Post by dragonstar » Tue 28 Apr 2009 20:30

I'm looking in the help file and it says both MyConnection and MyQuery are supposed to have an AutoCommit property.

They aren't listed in the object inspector and when I try and set them in code I get unknown identifier.

So which is right? There's is or isn't supposed to be such a property?

And if not where the help says, where is the mechanism for enabling auto commit for inserts, updates, deletes, etc.?


drc :)

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Thu 30 Apr 2009 10:11

TMyConnection and TMyQuery components don't have the AutoCommit property. If you change data (e.g., insert, update, delete), it is saved in a database automaticly on calling the Post method, unless you use transactions. But if you execute the StartTransaction method, then to save data to a database, execute the Commit method.

dragonstar
Posts: 19
Joined: Sat 18 Apr 2009 21:02

works for me...

Post by dragonstar » Thu 30 Apr 2009 17:13

Got it. But it'd be nice if the help was accurate, as in not mentioning properties that don't exist.

And what about a Query whose sql is an update statement? No Post method for that just Execute, anything else have to be called to get the changes to commit?


drc :)

swierzbicki
Posts: 451
Joined: Wed 19 Jan 2005 09:59

Post by swierzbicki » Thu 30 Apr 2009 18:37

And what about a Query whose sql is an update statement? No Post method for that just Execute, anything else have to be called to get the changes to commit?
It's the same !
All modifications done to the database will be saved when commit method will be called (or cancelled if rollback method is called).

Exemple :

Code: Select all

MyConnection.StartTransaction;
Try
//....(update, insert delete anything you want)
MyConnection.Commit;
Except
//...an error occured, rolling back modifications
MyConnection.Rollback;
End;

Post Reply