[Lazarus] SQLDB - Can't attach second SQLite database because transaction
Michael Van Canneyt
michael at freepascal.org
Mon Jan 7 14:35:07 CET 2013
On Mon, 7 Jan 2013, Krzysztof wrote:
> I want attach second databse to sqlite connection by command:
> DBConnection.ExecuteDirect('attach database '+QuotedStr(GetConfigDir+'second.db')+' as mydb2');
> But I get error that cannot attach database when on transaction. Even If I commit transaction first, then ExecuteDirect start new one. How to get around this?
There is currently no way.
> BTW: Why SQLDB has logic "always in transaction"? Is it really perform in large and complex ERP systems? What I was always taught that the transaction should
> be used only in specific situtations (importing, converting documents, FIFO, stock status etc) but whole time? Is not dangerous? One programmer's mistake (e.g
> forget commit somewhere, or transaction conflict etc.) and client can loose bunch of data.
This is the world upside down :)
A transaction is a basic cornerstone of any RDBMS. You must always take care of them.
Many RDBMS toolkits try to 'simplify' your life by adding some automated transaction
handling which hides the details from you.
(whether this is good or not is another debate)
SQLDB currently does not do this. You must take full responsability for the transactions.
More information about the Lazarus