Author Topic: Import reference data  (Read 8885 times)

solenn

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Import reference data
« 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

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Import reference data
« Reply #1 on: January 18, 2012, 05:02:41 am »
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.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: Import reference data
« Reply #2 on: January 18, 2012, 09:06:40 am »
It will be something like this:

Code: [Select]
Repository.CustomCommand("Repository","ImportRefData",sXML)
The Sparx Team
[email protected]

dracip

  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: Import reference data
« Reply #3 on: January 18, 2012, 09:59:03 pm »
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.


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Import reference data
« Reply #4 on: January 18, 2012, 10:32:22 pm »
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.

solenn

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: Import reference data
« Reply #5 on: January 19, 2012, 09:30:47 pm »
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

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Import reference data
« Reply #6 on: January 20, 2012, 05:32:45 am »
In the DB its the raw data. Only in the XML its base64.

q.

solenn

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: Import reference data
« Reply #7 on: January 20, 2012, 06:56:45 am »
Hello,

What do you mean by "Raw data"?

Thanks a lot,
Solenn

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Import reference data
« Reply #8 on: January 20, 2012, 07:31:33 am »
Uncooked, raw, binary, blob. It's just the same bits as in the file. No conversion whatsoever.

q.

solenn

  • EA User
  • **
  • Posts: 24
  • Karma: +0/-0
    • View Profile
Re: Import reference data
« Reply #9 on: January 20, 2012, 09:57:35 pm »
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+xpFfZWd8m600MDzZvJNHaU9990l3439txzyr0Kpu4ez7VdtC+Ln30Bbp7OO3u3+vVsbW+P2929QrdiC26qb5KSXc2hlc/XYitXX0yuHvPhQgbjTryuyulrOv6Jjd3aaHvbEwdOWuwelIMkXcPHI/ZVwb7HMzB+FcGAzXVV2ypdyQHg1vW8+B/uJZ7z58GIxvvc2FDuysHepJa974Re4wLhOl78DWDu2LPC4nRN0lTfcbsQ6gPoT6E+hDqQwTom7bbLWYfRH0I9b2j6RuXCVEfQn0vOfJEoT6E+hDq2+fgWEB9CPUh1IdQH0J9O7jG5Tqn3r+pD6G+X5x99as+hPp+yLu2OT/XZmzUVwqY7VIfmimcXR+cZZ1aH5+hnldfyOx+gL4LH+N0J2plREz2jWUwcFXJdI03dkVOmL4hEjB8NVNk9iU3WGMlWIUz5luvVu/7plp7CiQxWPvDsCy7CNWgwVWs0vNmuAm2aQG1HlwyGGxA3UvUcduRNoW2yPBmPUn7q9WuYv9y04RGg7bat8Jej0rtxrz1DHZ8zOywh1Vgid23S+hw3UL2i+su7juMvtsfbgdnY0g0KMwQx6lUyuOuJNG3cXAf0zwBl1T6NmL316tNOn1jMd1cRyzqQ6gPoT6E+hDqQ6gPoT6E+hDqQ6gPoT6E+hDqQ6gPoT6E+hDqQ6gPoT6E+hDqQ6gPoT6E+hDqQ6gPoT6E+hDqQ6gP8QUouEe83B9NCQAAAABJRU5ErkJgggBlAF8ASQBEAD0ANwA5ACAAQQBOAEQAIAAoAFAAYQByAGUAbgB0AEkARAAgAGkAcwAgAG4AdQBsAGwAIABvAHIAIABQAGEAcgBlAG4AdABJAEQAPQAwACkAIAAgAE8AcgBkAGUAcgAgAGIAeQAgAFQAUABvAHMALAAgAE4AYQBtAGUAAAAAAAcAcwDPAQoGLDz0AQ4AAAAOAAAAAAAAADIAMAA6ADEAMAA6ADIANAA6ADQAOgA5ADMAOQAAAAAABgB6APYBDAYsPPQBCQAAAAkAAAAAAAAALQAmAEUAbgBhAHIAUwBwAHkAAABvAAAACACAAPwADgaY84EQAF9jGQgAAAAAAAAAUAByAG8AcABvAHMAZQBkAAAAcwAAAAAAAgAGAAAAAAbw2rMQyPOBEA==)


Thanks a lot,
Solenn

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Import reference data
« Reply #10 on: January 20, 2012, 10:26:27 pm »
Honestly, this is not an SQL tutorial here. You need to use some substation parameters like
Code: [Select]
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:
Code: [Select]
       $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.
« Last Edit: January 20, 2012, 10:27:43 pm by qwerty »

Michael Proske

  • EA User
  • **
  • Posts: 72
  • Karma: +0/-0
    • View Profile
Re: Import reference data
« Reply #11 on: March 14, 2012, 10:15:11 pm »
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.

Luis J. Lobo

  • EA User
  • **
  • Posts: 252
  • Karma: +0/-0
  • IT Consultant
    • View Profile
Re: Import reference data
« Reply #12 on: March 23, 2012, 09:43:37 am »
The "Repository.CustomCommand(Class, Method, Parameters)" appears to be a "very interesting", but undocummented method...

Any experiences using it?

Thanks!!

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Import reference data
« Reply #13 on: March 23, 2012, 12:17:43 pm »
Have you tried a search? (This might get you to sleep...) I remember this being mentioned here somewhere...

q.

Luis J. Lobo

  • EA User
  • **
  • Posts: 252
  • Karma: +0/-0
  • IT Consultant
    • View Profile
Re: Import reference data
« Reply #14 on: March 23, 2012, 12:31:02 pm »
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???