Comment:
When you assign database to a query, the default transaction is used. You don't to have to assign it again, unless you are going to use different transaction.
Your way has no problem. I'm asking simply from curiosity.
Not that i know of.
I always had to connect the 3 (or more) Objects as described in Wiki/Documentation:
Create Connection-Object
Create Transaction-Object (or as many as you need)
Assign Transaction-Object to Transaction-Property of Connection-Object (only one Transaction per Connection?)
Assign Connection-Object to Database-Property of Transaction(s)
Create Query-Object(s)
Assign Transaction-Object to Transaction-Property of Query
Assign Connection-Object to Database-Property of Query
Open Connection
Activate Transaction(s)
Open Query(s)
EDIT: I just looked into the Source-Code of sqlite3conn:
there is no "Default"-Transaction-Object for sqlite3connection, only the Inherited Transaction-Object of its Ancestor TSQLconnection.
and in sqldb (TSQLConnection) i found this snippet
procedure TSQLConnection.GetDBInfo(const ASchemaType : TSchemaType; const ASchemaObjectName, AReturnField : string; AList: TStrings);
var qry : TCustomSQLQuery;
begin
if not assigned(Transaction) then
DatabaseError(SErrConnTransactionnSet);
If transaction is not Assigned return what??