ORM with UNIDAC and Firebird CreateOrUpgradeTable doesn’t commit transaction

Home Forums kbmMW ORM with UNIDAC and Firebird CreateOrUpgradeTable doesn’t commit transaction

Tagged: 

Viewing 4 reply threads
  • Author
    Posts
    • #55437
      VadimMest
      Participant

      Hi

      ORM with UNIDAC and Firebird

      Procedure orm.CreateOrUpgradeTable  doesn’t commit transaction.

    • #55438
      VadimMest
      Participant

      I try create new table by object TMRDOC (table MR_DOC)

      orm.CreateOrUpgradeTable(TMRDOC);

      How can I  turn on transaction commit?

      This is the SQL log:

      05.02.2021 22:24:30 n/a UniDAC monitoring is started Complete
      05.02.2021 22:24:36 0.109 Connect: SYSDBA@127.0.0.1 Complete
      05.02.2021 22:24:36 0.000 Start: Complete
      05.02.2021 22:24:36 0.000 Transaction ID = 78368 Complete
      05.02.2021 22:24:36 0.000 SQL Prepare: SELECT COUNT(RDB$RELATION_NAME) FROM RDB$RELATIONS
      WHERE ((RDB$SYSTEM_FLAG = 0) OR (RDB$SYSTEM_FLAG IS NULL)) AND
      (RDB$VIEW_SOURCE IS NULL) AND UPPER(RDB$RELATION_NAME)=’MR_DOC’
      Complete
      05.02.2021 22:24:36 0.000 SQL Execute: SELECT COUNT(RDB$RELATION_NAME) FROM RDB$RELATIONS
      WHERE ((RDB$SYSTEM_FLAG = 0) OR (RDB$SYSTEM_FLAG IS NULL)) AND
      (RDB$VIEW_SOURCE IS NULL) AND UPPER(RDB$RELATION_NAME)=’MR_DOC’
      Complete
      05.02.2021 22:24:36 0.000 SQL Unprepare: SELECT COUNT(RDB$RELATION_NAME) FROM RDB$RELATIONS
      WHERE ((RDB$SYSTEM_FLAG = 0) OR (RDB$SYSTEM_FLAG IS NULL)) AND
      (RDB$VIEW_SOURCE IS NULL) AND UPPER(RDB$RELATION_NAME)=’MR_DOC’
      Complete
      05.02.2021 22:24:36 0.000 SQL Prepare: SELECT COUNT(RDB$RELATION_NAME) FROM RDB$RELATIONS
      WHERE ((RDB$SYSTEM_FLAG = 0) OR (RDB$SYSTEM_FLAG IS NULL)) AND
      (RDB$VIEW_SOURCE IS NULL) AND UPPER(RDB$RELATION_NAME)=’MR_DOC’
      Complete
      05.02.2021 22:24:36 0.000 SQL Execute: SELECT COUNT(RDB$RELATION_NAME) FROM RDB$RELATIONS
      WHERE ((RDB$SYSTEM_FLAG = 0) OR (RDB$SYSTEM_FLAG IS NULL)) AND
      (RDB$VIEW_SOURCE IS NULL) AND UPPER(RDB$RELATION_NAME)=’MR_DOC’
      Complete
      05.02.2021 22:24:36 0.000 SQL Unprepare: SELECT COUNT(RDB$RELATION_NAME) FROM RDB$RELATIONS
      WHERE ((RDB$SYSTEM_FLAG = 0) OR (RDB$SYSTEM_FLAG IS NULL)) AND
      (RDB$VIEW_SOURCE IS NULL) AND UPPER(RDB$RELATION_NAME)=’MR_DOC’
      Complete
      05.02.2021 22:24:36 0.000 SQL Execute: CREATE TABLE MR_DOC ( DATEDOC TIMESTAMP,NDOC VARCHAR(20),IDSTATE INTEGER,GUID VARCHAR(36) PRIMARY KEY,ID INTEGER NOT NULL,IDOWNER INTEGER,IDINOWNER INTEGER,RECORDCOLOR VARCHAR(20),RECORDFONT VARCHAR(20),STATUS INTEGER )
      Complete

    • #55472
      kimbomadsen
      Keymaster

      Replied previously.
      DDL operations are usually not handled under transactional control in SQL.

    • #55482
      VadimMest
      Participant

      Hello

      >DDL operations are usually not handled under transactional control in SQL.

      Procedure  orm.CreateOrUpgradeTable(TMROWNER) doesn’t finish a creating table in Firebird 2.5 and Firebird 3.  The table does not exists in database.
      In Firebird Database “CREATE TABLE”, “ALTER TABLE”  definitely need a Commit. I can send test project with Firebird based on your demo.

      I solved this problem with patch (but very many transaction start and commit)

      procedure TForm76.Button1Click(Sender: TObject);

      procedure CreateTable(const AValue: TClass);
      begin
      kbmMWInterbaseMetaData.RunMetaUpdatesInTransaction := True;
      orm.CreateTable(AValue);
      kbmMWInterbaseMetaData.RunMetaUpdatesInTransaction := False;
      end;
      begin

      if not orm.ExistsTable(TMRDOC) then
      CreateTable(TMRDOC)
      else
      orm.UpgradeTable(TMRDOC);

       

    • #55486
      kimbomadsen
      Keymaster

      Try to set RunMetaUpdatesInTransaction to true in the metadata component you are using.

      best regards

      Kim/c4d

Viewing 4 reply threads
  • You must be logged in to reply to this topic.