Problem AutoCommit in SqlInsert in script with Execute Block
Posted: Thu 27 May 2010 14:52
Good evening support. I'm trying to use components of access to the DBMS FireBird By UniDac . And I have 2 problems that can not find any forum or in help files.
Baselines:
1. The table on the server D_MED_REASON
2. 3 procedures on the server implementing the operation changes the data without the use of transactions on the client level (AUTOCOMMIT = true)
Med_add_D_MED_REASON
Med_Edit_D_MED_REASON
Med_Del_D_MED_REASON
Client Delphi Code
QuD_MED_REASON: = TUniQuery.Create (Self);
QuD_MED_REASON.Options.RequiredFields: = False;
QuD_MED_REASON.Options.StrictUpdate: = False;
QuD_MED_REASON.Options.ReturnParams: = True;
QuD_MED_REASON.Connection: = DB;
QuD_MED_REASON.SQL.Clear;
QuD_MED_REASON.SQL.Add ('SELECT');
QuD_MED_REASON.SQL.Add ('a.ID,');
QuD_MED_REASON.SQL.Add ('a.NAME,');
QuD_MED_REASON.SQL.Add ('a.IS_DELETE');
QuD_MED_REASON.SQL.Add ('FROM D_MED_REASON a');
QuD_MED_REASON.Name: = 'QuD_MED_REASON';
QuD_MED_REASON.SQLInsert.Clear;
QuD_MED_REASON.SQLInsert.Add ('execute block (');
QuD_MED_REASON.SQLInsert.Add ('p_DEFINE_ID type of column D_MED_REASON.ID =: ID,');
QuD_MED_REASON.SQLInsert.Add ('p_NAME type of column D_MED_REASON.NAME =: NAME)');
QuD_MED_REASON.SQLInsert.Add ('returns (ID type of column D_MED_REASON.ID) as');
QuD_MED_REASON.SQLInsert.Add ('begin');
QuD_MED_REASON.SQLInsert.Add ('execute procedure Med_add_D_MED_REASON (');
QuD_MED_REASON.SQLInsert.Add ('p_DEFINE_ID,');
QuD_MED_REASON.SQLInsert.Add ('p_NAME');
QuD_MED_REASON.SQLInsert.Add (') returning_values ID;');
QuD_MED_REASON.SQLInsert.Add ('suspend;');
QuD_MED_REASON.SQLInsert.Add ('end;');
QuD_MED_REASON.SQLDelete.Clear;
QuD_MED_REASON.SQLDelete.Add ('execute procedure Med_del_D_MED_REASON (: ID)');
QuD_MED_REASON.SQLUpdate.Clear;
QuD_MED_REASON.SQLUpdate.Add ('execute procedure Med_edit_D_MED_REASON (: ID,: NAME,: IS_DELETE);');
I have 2 problems
1. Post DataSet after the insert (AutoCommit By default = true) does not occur Commit transaction script QuD_MED_REASON.SQLInsert (I see this the second session running to the database), although the SQLUpdate work correctly and fix transaction by update record. Perhaps the difference is that the Insert block contains "execute block". How do AutoCommit to occur in the case of Insert?
2. In the Server-specific features described
# Support for the Firebird 2 EXECUTE BLOCK syntax
# Support for the Firebird 2 RETURNING clause
Is it possible to return the output parameters in the field
QuD_MED_REASON.SQL? If yes, how? Judging by the example of an experienced value of returns (ID type of column D_MED_REASON.ID) does not return to the field ID
Thanks in advance. If this information is described in any part of the documentation, please indicate this source
Baselines:
1. The table on the server D_MED_REASON
2. 3 procedures on the server implementing the operation changes the data without the use of transactions on the client level (AUTOCOMMIT = true)
Med_add_D_MED_REASON
Med_Edit_D_MED_REASON
Med_Del_D_MED_REASON
Client Delphi Code
QuD_MED_REASON: = TUniQuery.Create (Self);
QuD_MED_REASON.Options.RequiredFields: = False;
QuD_MED_REASON.Options.StrictUpdate: = False;
QuD_MED_REASON.Options.ReturnParams: = True;
QuD_MED_REASON.Connection: = DB;
QuD_MED_REASON.SQL.Clear;
QuD_MED_REASON.SQL.Add ('SELECT');
QuD_MED_REASON.SQL.Add ('a.ID,');
QuD_MED_REASON.SQL.Add ('a.NAME,');
QuD_MED_REASON.SQL.Add ('a.IS_DELETE');
QuD_MED_REASON.SQL.Add ('FROM D_MED_REASON a');
QuD_MED_REASON.Name: = 'QuD_MED_REASON';
QuD_MED_REASON.SQLInsert.Clear;
QuD_MED_REASON.SQLInsert.Add ('execute block (');
QuD_MED_REASON.SQLInsert.Add ('p_DEFINE_ID type of column D_MED_REASON.ID =: ID,');
QuD_MED_REASON.SQLInsert.Add ('p_NAME type of column D_MED_REASON.NAME =: NAME)');
QuD_MED_REASON.SQLInsert.Add ('returns (ID type of column D_MED_REASON.ID) as');
QuD_MED_REASON.SQLInsert.Add ('begin');
QuD_MED_REASON.SQLInsert.Add ('execute procedure Med_add_D_MED_REASON (');
QuD_MED_REASON.SQLInsert.Add ('p_DEFINE_ID,');
QuD_MED_REASON.SQLInsert.Add ('p_NAME');
QuD_MED_REASON.SQLInsert.Add (') returning_values ID;');
QuD_MED_REASON.SQLInsert.Add ('suspend;');
QuD_MED_REASON.SQLInsert.Add ('end;');
QuD_MED_REASON.SQLDelete.Clear;
QuD_MED_REASON.SQLDelete.Add ('execute procedure Med_del_D_MED_REASON (: ID)');
QuD_MED_REASON.SQLUpdate.Clear;
QuD_MED_REASON.SQLUpdate.Add ('execute procedure Med_edit_D_MED_REASON (: ID,: NAME,: IS_DELETE);');
I have 2 problems
1. Post DataSet after the insert (AutoCommit By default = true) does not occur Commit transaction script QuD_MED_REASON.SQLInsert (I see this the second session running to the database), although the SQLUpdate work correctly and fix transaction by update record. Perhaps the difference is that the Insert block contains "execute block". How do AutoCommit to occur in the case of Insert?
2. In the Server-specific features described
# Support for the Firebird 2 EXECUTE BLOCK syntax
# Support for the Firebird 2 RETURNING clause
Is it possible to return the output parameters in the field
QuD_MED_REASON.SQL? If yes, how? Judging by the example of an experienced value of returns (ID type of column D_MED_REASON.ID) does not return to the field ID
Thanks in advance. If this information is described in any part of the documentation, please indicate this source