[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

SQL Plugin for DIA



I've extended Andy Halper's c sql plugin for DIA (found from:
ftp://az.water.usgs.gov/pub/ashalper/src/dia/plug-ins/ off of
http://www.schemamania.org/ ) to support foreign keys using UML
Message lines.  I've attempted to contact him using the email address
in the README file, but it bounced. If anyone knows how to reach him
please let me know.

As my changes touch pretty much the entire sql-export.c file, I've put
it up at: http://www.stitt.org/code/dia-sql/ rather than make a
patch.  It compiles (for me at least) against both 0.88.1 and cvs.

I did this by recording the coords of the connection points while
creating the table, then comparing the end points of each UML Message
to see if they were in the same position.  If so, I add a 'alter table
XXX add constraint foreign key' statement at the end of the sql file.

Something is not quite right with this method, because if I load a
saved diagram and attempt to export, only about half off the UML
Messages will match.  This is apparently because their end points are
not in the 'exact' same location as the handles on the Class
attributes.  However if I select all objects on the diagram and move
them around a bit, then everything lines up ok.  Because of this bug,
I'm not sure if this is worth submitting, but figured it couldn't
hurt.  It works well enough for what I need to do at this point at
least.  A better solution would be to do 'fuzzy' locations so that if
a line was a few coords off, it would still match.  Of course the
*right* thing to do would be to recode Dia so that the info could be
easily retrieved. Perhaps this is possible already, and I've wasted my
time hacking this up, but I couldn't find a way to do it.. comments
are welcome!

I've also made the following changes that may be unwelcome, but suit
me better than the original:

Table name are no longer converted to uppercase, but are left the way
they were typed in.

Primary keys are indicated by clicking 'class scope' in the UML
Class dialog box, rather than typing {OID} in the column name.

Tables are created from each UML Class unless they are tagged as
'abstract' in the Dialog box. In the original they were not created if
they had {persistent} in the table (class) name.

Added drop table statements before the create table statement.

If these changes are not wanted, it should be fairly easy to put it back
the way it was.

If there is any interest in this I will, time permitting, make it
stand alone with autconf support for easier installation.  At the
present it still uses Andy's method of untaring in the dia source
tree and compiling.

Regards,
Nathan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] Mail converted by Mofo Magic and the Flying D

 
All trademarks and copyrights are the property of their respective owners.

Other Directory Sites: SeekWonder | Directory Owners Forum

GuideSMACK