Book a Demo

Author Topic: Get linked document  (Read 4671 times)

Virgil

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Get linked document
« on: March 11, 2010, 08:43:07 pm »
I am trying to read the informations in the EAP project file directly (like an access database) and i can't get the linked document associated to an element.

Does anybody know where the linked documents are stored in the EAP file (what table)?

Thank you!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Get linked document
« Reply #1 on: March 11, 2010, 09:21:54 pm »
have you tried t_document ?

Geert

Virgil

  • EA Novice
  • *
  • Posts: 8
  • Karma: +0/-0
    • View Profile
Re: Get linked document
« Reply #2 on: March 11, 2010, 10:09:19 pm »
Yes, it seems that the content of the linked document is kept binary in the table t_document, column BinContent. I was confused the first time I looked because I expected to see the document saved as text.

Thank you!

lubos

  • EA User
  • **
  • Posts: 101
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Get linked document
« Reply #3 on: March 12, 2010, 05:43:18 pm »
I have tried to play with this BinContent some time ago. I'm not sure but I think I have found out it is uuencoded zip file containing the RTF.

Hope it helps

fwoolz

  • EA User
  • **
  • Posts: 435
  • Karma: +0/-0
  • We have met the enemy, and he is us.<Pogo, 1970>
    • View Profile
Re: Get linked document
« Reply #4 on: March 12, 2010, 06:48:49 pm »
I did some poking around once in the EA.exe binary, and it definitely appears that the BinContent field in t_document is zipped. BTW, the StrContent field in the same table appears to be completely unused.

An alternative to direct database access is to use the AI methods to save and load a linked document to and from a file. You could use a randomly generated temporary file name, save the RTF in the temporary file, then load the contents of the file into whatever container you would use to manipulate the file using direct database access. Once done, you can do the same thing in reverse to get the RTF back into the linked document, then trash the temporary files you created as a housekeeping measure. Along the way you might have the need to make use of a FileSystemWatcher (or its non-.NET equivalent) and some judiciously selected time delays to allow file operations to complete. It ain't pretty, but I've done it (as have others in this forum before me - cheers Geert!) and it works.

I was once pretty gung-ho about getting at the data directly, but eventually became convinced after some back and forth on these forums to use the AI, imperfect and incomplete as it is, in order to avoid the possibility that Sparx might hack the database schema (again!) in future to add some new feature, making my add-ins incompatible.

Ultimately, Sparx should provide AI methods to permit direct manipulation of the RTF text in a linked document (I already sent in a feature request to that effect) as well as a whole bunch of other things not yet implemented.
Fred Woolsey
Interfleet Technology Inc.

Always be ready to laugh at yourself; that way, you beat everyone else to the punch.