Subject | Re: [firebird-support] How SET AUTODDL works? |
---|---|
Author | Dmitry Kuzmenko |
Post date | 2013-06-23T18:10:33Z |
Hello, W!
Sunday, June 23, 2013, 9:47:54 PM, you wrote:
WO> I usually write a COMMIT or a ROLLBACK when want to finish a transaction.
WO> However in the documentation of ISQL said that SET AUTODDL ON finish the
WO> transaction with a COMMIT.
remember that ISQL is just a program, that can be rewritten by anyone,
so, you may design your own SET AUDODDL behavior.
WO> SET AUTODDL ON;
WO> INSERT INTO MyTable (Column1, Column2) VALUES (Value1, Value2);
WO> QUIT;
WO> When I return to ISQL the table has not recorded the INSERT. Of course, if
WO> I write EXIT instead of QUIT the INSERT is recorded but that is the
WO> standard behaviour of ISQL.
Yes, QUIT = ROLLBACK, EXIT = COMMIT.
And, consider that AUTODDL ON forces commit before NEXT sql statement.
So, the code here may be like that:
OnNewStatement
if InTransaction and AutoDDL then
Commit;
ExecuteNewStatement;
--
Dmitry Kuzmenko, www.ib-aid.com
Sunday, June 23, 2013, 9:47:54 PM, you wrote:
WO> I usually write a COMMIT or a ROLLBACK when want to finish a transaction.
WO> However in the documentation of ISQL said that SET AUTODDL ON finish the
WO> transaction with a COMMIT.
remember that ISQL is just a program, that can be rewritten by anyone,
so, you may design your own SET AUDODDL behavior.
WO> SET AUTODDL ON;
WO> INSERT INTO MyTable (Column1, Column2) VALUES (Value1, Value2);
WO> QUIT;
WO> When I return to ISQL the table has not recorded the INSERT. Of course, if
WO> I write EXIT instead of QUIT the INSERT is recorded but that is the
WO> standard behaviour of ISQL.
Yes, QUIT = ROLLBACK, EXIT = COMMIT.
And, consider that AUTODDL ON forces commit before NEXT sql statement.
So, the code here may be like that:
OnNewStatement
if InTransaction and AutoDDL then
Commit;
ExecuteNewStatement;
--
Dmitry Kuzmenko, www.ib-aid.com