Use IBCQuery without transaction on FB 2.x
Use IBCQuery without transaction on FB 2.x
Hello,
Suppose with have an IBCQuery with autocommit to false and no transaction linked (it is )
Now i do
IBCQuery. SQL.Text:='Select* from....'
IBCQuery.Open
While not IBCQuery.eof do
...
When i call open i suppose a transaction is started? But which king of transaction? ReadOnly? ReadCommited?
Now what is about the end of the transaction if commit or rollback is not called?
Will it closed on the next open?At the end of the application?
Is it correct to do all the select statements like this or should i connect an IBCTransaction with ReadOnly... and manually close the transaction by commit or rollback when IBCQruery is at eof ?
Thank you for help and happy new year
Suppose with have an IBCQuery with autocommit to false and no transaction linked (it is )
Now i do
IBCQuery. SQL.Text:='Select* from....'
IBCQuery.Open
While not IBCQuery.eof do
...
When i call open i suppose a transaction is started? But which king of transaction? ReadOnly? ReadCommited?
Now what is about the end of the transaction if commit or rollback is not called?
Will it closed on the next open?At the end of the application?
Is it correct to do all the select statements like this or should i connect an IBCTransaction with ReadOnly... and manually close the transaction by commit or rollback when IBCQruery is at eof ?
Thank you for help and happy new year
When you call the Open method, the transaction that is selected in the DefaultTransaction property of TIBCConnection is started. You can change IsolationLevel of this transaction by clicking '+' to the left of the property name in Object Inspector, and editing properties of DefaultTransaction. You can also select another TIBCTransaction component for the DefaultTransaction property.
This transaction is rolled back when you close the connection. You can manually commit or rollback it by using the following code:
IBCConnection.DefaultTransaction.Commit;
Note that the TIBCQuery component is closed when you commit or rollback the transaction.
This transaction is rolled back when you close the connection. You can manually commit or rollback it by using the following code:
IBCConnection.DefaultTransaction.Commit;
Note that the TIBCQuery component is closed when you commit or rollback the transaction.
Hello,
Thank you for your answer
Now suppose i have an IBCTransaction liked with an IBCQuery
If i do
IBCQuery.Sql.Text:='select * from T1'
IBCQuery.Open;
...
IBCQuery.Sql.Text:='select * from T2'
IBCQuery.Open;
...
IBCQuery.Sql.Text:='select * from T3'
IBCQuery.Open;
...
If i do IBCTransaction.Commit, will it close the transactions on T1 and T2 and T3 or only T3?
Regards
Thank you for your answer
Now suppose i have an IBCTransaction liked with an IBCQuery
If i do
IBCQuery.Sql.Text:='select * from T1'
IBCQuery.Open;
...
IBCQuery.Sql.Text:='select * from T2'
IBCQuery.Open;
...
IBCQuery.Sql.Text:='select * from T3'
IBCQuery.Open;
...
If i do IBCTransaction.Commit, will it close the transactions on T1 and T2 and T3 or only T3?
Regards
Plash,
sorry to ask again.
I would like to know why a simple SELECT statement and a subsequent Query.Open opens a (default) transaction which is not automatically closed after using e.g. Query.Close.
Of course a Commit or Rollback will close the transaction after an Query.ExecSQL, but I don't need those commands when doing a simple SELECT and Query.Open.
sorry to ask again.
I would like to know why a simple SELECT statement and a subsequent Query.Open opens a (default) transaction which is not automatically closed after using e.g. Query.Close.
Of course a Commit or Rollback will close the transaction after an Query.ExecSQL, but I don't need those commands when doing a simple SELECT and Query.Open.