Book a Demo

Author Topic: INSERT records directly in EA db t_operationparams table  (Read 2870 times)

vladap

  • EA User
  • **
  • Posts: 79
  • Karma: +0/-0
    • View Profile
INSERT records directly in EA db t_operationparams table
« on: July 15, 2022, 07:15:02 pm »
Hello,
I have a lot of diagrams stored in Enterprise Architect packages. I use Features - Operations for diagram objects. Each Operation can have Parameters. I add these Parameters via Properties window. There is a lot of these parameters - that I take from excel sheets and Word documents and rewrite to EA. System keeps Parameters in t_operationparams database table from which I am able to select them with an SQL command:

SELECT    operpar.OperationID
             , operpar.Name
             , operpar.Type
             , operpar.Default
             , operpar.Notes
             , operpar.Pos
             , operpar.Const
             , operpar.Style
             , operpar.Kind
             , operpar.Classifier
             , operpar.ea_guid
             , operpar.StyleEx
          FROM t_operationparams operpar
        WHERE operpar.OperationID = 1164

My question is:

Can I insert records in this table directly with an INSERT command? (It would be much more quicker for me)

INSERT INTO t_operationparams (OperationID, Name, Type, Default, Notes, Pos, Const, Kind) VALUES (1164,'command_id','num(4)','Identification of SasGwyOneCAS_specification command pattern','Fix value',0,0,1);

The ea_guid field value I don't know, it is created on system level. Can I treat somehow it?

As far as JScript and VB script in EA - I don't know very much about this program method.

Thank You for Your kind advice

R. Heyduk

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: INSERT records directly in EA db t_operationparams table
« Reply #1 on: July 15, 2022, 07:48:06 pm »
GUIDs can be created with any GUID generator (depending on your language there should be a lib that provides one).

Try it on a test DB first. Run a consistency check after your insertion and look at diagrams. Since the size of class frames my change your diagrams might need layout.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: INSERT records directly in EA db t_operationparams table
« Reply #2 on: July 15, 2022, 08:10:13 pm »
You shouldn't do that, that's asking for problems.

You can simply use EA.Operation.Parameters.AddNew() to create a new parameter.

Geert

PS. or is it EA.Method.Parameters,... I don't remember exactly.

wivel

  • EA User
  • **
  • Posts: 243
  • Karma: +12/-1
  • Driven by Models
    • View Profile
Re: INSERT records directly in EA db t_operationparams table
« Reply #3 on: July 15, 2022, 10:50:55 pm »
Hi

Agree with Geert. You can read the database directly, but never update tables using SQL. No one except Sparxians knows hot the metamodel is EA organized and if more than one table needs to be updated for a given use case.

Henrik