Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: mariusz on October 03, 2009, 04:18:00 pm
-
I'd like to create some model objects by using AI (C#).
How can I get next auto-sequence value, defined for this type of elements? Is it possible?
mario
-
Is it possible to make a native sql update operation on table t_trxtypes?
sth like this:
update t_trxtypes set Notes='prefix=SCR;active=1;active_a=0;count=50;' where trx='Class' and Description='Autocount'
It could resolve my problem...
-
I have found:
EA.Repository.Execute();
-
You did? Can't see that guy anywhere... is there any other way to fire SQL update statements?
-
He probably meant
Repository.SQLQuery (string SQL)
Geert
-
thanks geert, but just to clarify.... there is no way of doing an sql update with the api, right?!
Nick
-
thanks geert, but just to clarify.... there is no way of doing an sql update with the api, right?!
Nick
I don't know, I haven't tried. What happens if you pass an update query to the SQLQuery() operation?
Geert
-
Hi,
Recently i've tried to perform a similar task: to execute INSERT or UPDATE commands into the database. Executing the following line of code returned void and did not interact with the database:
Ea.Repository.SQLQuery(" <Update command>")
However if i execute, for instance, the following line of code:
Repository.SQLQuery("SELECT 1; <Update command>")
the records of my database are updated, but a weird message box appears in EA. I suppose it is not feasible to alter the information in the database by using the automation interface API?
EDIT:
The "weird message box" contains the following message:
---------------------------
EA
---------------------------
Error:
Code = 0x0
Source = Line : 0; Char : 0
Error Description = (null)
---------------------------
OK
---------------------------
Cheers,
Pedro Costa
-
I suppose it is not feasible to alter the information in the database by using the automation interface API?
No, it isn't. In my tools I never update the database directly. It's bad enough I have to resort to selecting stuff from the database from time to time for performance reasons.
Updating the database open a whole other can of worms IMHO.
But if you really want to you can get the connection string from the repository. Based on that you should be able to figure out how to connect to the database directly, and do your updates.
Geert
-
The problem is that the solution that i'm going to develop has it's own data tables. Thus, it is imperative to interact with the database.
I've already tried to use the property Repository.ConnectionString. But there is a major drawback. If the user decides to encrypt it, my addin cannot communicate with the database.
-
Hi Pedro,
The problem is that the solution that i'm going to develop has it's own data tables. Thus, it is imperative to interact with the database.
I think for this case, you should use your own DAL to manipulate the database, instead of the EA.Repository.SQLQuery() method.
HTH
Günther
-
The problem is that the solution that i'm going to develop has it's own data tables. Thus, it is imperative to interact with the database.
Then don't you think it would be wiser to create your own database all together? That migitates the need to update the database of EA. (if you were in my team I wouldn't allow you to touch the database of EA in any way, no updating, and certainly not changing it's structure ;))
Geert