Am 01.07.2020 um 12:54 schrieb Michael Van Canneyt via lazarus:


On Wed, 1 Jul 2020, Luca Olivetti via lazarus wrote:

El 1/7/20 a les 0:40, R.Smith via lazarus ha escrit:
On 2020/06/30 22:52, Special via lazarus wrote:
Hi, Ryan,

I followed your advice and removed XTransaction and all references to it from TestButtonClick. But now I get an exception with the message "Transaction not set". Any hint?
Regards --  Joe

I'm sorry, the previous problem was SQLite-related, which I'm initimately familiar with, but this one seems to be a Lazarus DB component requirement which I'm not so much familiar with, but probably has an easy solution someone here might know about.

The question becomes:  How to execute a query, without a transaction being set, using SQLdb in Lazarus?

I use zeos instead of sqldb. Most probably it's my fault and it could be solved by doing what Michael said (use stoUseImplicit), but when I tried to use sqldb with sqlite, as long as I kept the dataset open (to show the data in a dbgrid) the table was locked and couldn't be modified by a different thread/process.

The stoUseImplicit is one way to solve this.

An alternative was to disable the need to keep an active transaction using
TSQLQuery.Options : add sqoKeepOpenOnCommit.

see
https://www.freepascal.org/docs-html/current/fcl/sqldb/tsqlqueryoptions.html

Then you can do

Dataset.open;
MyTransaction.Commit;

And the table will not be locked.

Michael.


Hi, Ryan, Luca, Michael and all others,

to Transaction.Options I added 'stoUseImplicit'. Now I can get and set 'PRAGMA locking_mode' and 'PRAGMA  synchronize'.
Thank you. Regards --  Joe



-- 
_______________________________________________
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus

Reply via email to