Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: solenn on January 18, 2012, 02:22:36 am
-
Hello,
I would like to know how to import reference data with c# code?
Thanks a lot,
Solenn
-
Directly move the data into the according tables. I did that once since the import image ref-data had (has) a bug. It's fairly simple.
q.
-
It will be something like this:
Repository.CustomCommand("Repository","ImportRefData",sXML)
-
Hi,
I work with Solenn. Tanks for your response.
Actually, we import image reference data with the custom Command.
the size of the file reference data is important (40Mb - 250 images), so EA generate an exception error (System.Runtime.InteropServices.SEHException: Un composant externe a levé une exception. à EA.RepositoryClass.CustomCommand(String ClassName, String MethodName, String Parameters)).
The custom Command has not documentation in EA 8.0.
To avoid this error , must be :
+ read xml refernce data
+ and move each image in t_image table ?
Thanks for you return.
-
I'm not sure since when Rep.CustomCommand is available in EA (I was not aware of it so far). However, the import of image ref-data was definitely broken in 8.0 in so far as the images were imported but the reference to the diagram usage was broken as they got a new id upon import. For that reason I wrote a direct SQL import restoring the correct image ids. Not sure whether a recent release corrected that, but my import still works.
q.
-
Hello,
I would like to know how to save in database the image.
We try to save it but it doesn't work.
We have transform png image (base 64) in byte[].
Could you tell me how to do?
Thanks a lot,
Solenn
-
In the DB its the raw data. Only in the XML its base64.
q.
-
Hello,
What do you mean by "Raw data"?
Thanks a lot,
Solenn
-
Uncooked, raw, binary, blob. It's just the same bits as in the file. No conversion whatsoever.
q.
-
Hello,
We try this request but she doesn't work.
I take the image data from xml file.
Could you tell me if you do like that?
INSERT INTO t_image (Name, Type, Image) VALUES ("Test2", "Bitmap", iVBORw0KGgoAAAANSUhEUgAAAGoAAACBCAIAAACnwLiBAAACmElEQVR4nO2c0XKDIBAAsdP//2X7YCdNE5Oqe8BRdp+cZirHeogIsqzrWuQqH70DGBv1IdSHUB9CfQj1IdSHUB9CfQj1IdSHUB9CfQj1IdSHUB9CfQj1IdSHUB9CfQj1IdSHUB/is3cA3yzLcjseaOZ+yRDrsvyEce+xpFfZWd8m600MDzZvJNHaU9990l3439txzyr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AAAAAUAByAG8AcABvAHMAZQBkAAAAcwAAAAAAAgAGAAAAAAbw2rMQyPOBEA==)
Thanks a lot,
Solenn
-
Honestly, this is not an SQL tutorial here. You need to use some substation parameters like
INSERT INTO t_image (Name, Type, Image) VALUES ("Test2", "Bitmap", ?).
Depends on whatever you use to send your SQL. In my Perl script it looks like this: $sth->bind_param($param, MIME::Base64::decode($row->{$col}->{'content'}), DBI::SQL_BLOB);
Btw: your above example still uses the base64 and not the decoded value which actually is "‰PNG ...." (a hand drawn circle formed cloud)
q.
-
Thanks qwerty for the input. I tried to write my own image loader that imports in database as well as generating xml to use the RepoitoryCommand Method. Because the Repository command is slow i have instead created a standard ref export file. I have added the source as a community ressource. If the code is reviewed and online i will post the link here. If you are interested before in the code send me a personal message.
-
The "Repository.CustomCommand(Class, Method, Parameters)" appears to be a "very interesting", but undocummented method...
Any experiences using it?
Thanks!!
-
Have you tried a search? (This might get you to sleep...) I remember this being mentioned here somewhere...
q.
-
Mmm... search only returns 2 or 3 call samples, but no documentation...
Are people doing reverse engineering??? ;)
Where are class names, methods and parameters published???
-
They aren't published, they aren't supported and they may be subject to change without notice.
In short, it's considered an internal function.
-
Here is the link to the community resource with the proposed source code.
http://community.sparxsystems.com/resources/scripts/creating-image-reference-file-based-directory-scan-well-direct-import-database