Re: SQL Plugin for DIA

Andrew Halper <ashalper acm org> writes:

 -- snip

I'll try to take a look at it tonight.  I had planned to make a more
official patch once I got the import (and export) code working with
StdProp, but I haven't worked on it recently.

If you've downloaded it before around 10 pm CST, please do so again,
as I've expanded it a bit further to put index columns into the the
operations tab of the UML dialog.  I've attempted to toggle if it's a
unique index by whether or not 'class scope' is selected, but
something strange is going on and I can't get this to work.  Look
around line 245 or so for the code.

Also, It originally had a stupid bug where I was calling g_free rather
than g_list_free on a GList *.  This was sporadically causing core
dumps.  I fixed about an hour after I posted, so my apologies if
someone downloaded it before I got it fixed.  I attempted to look
through the web server logs to find out if anyone did, but they are
filled with scans from the latest IIS worm thing.  GRRRR!

Perhaps this is possible already, and I've wasted my
time hacking this up

I don't think so.

Thats a relief.  After I did all this I started to think I really
should have posted to the list asking if there was an easier way.  I
was half afraid someone would conk me over the head and say 'why in
the world did you do all that?' :)
Table name are no longer converted to uppercase, but are left the way
they were typed in.

This is Joe Celko/IDEF1X style.  I had planned to make it optional.

Yes optional on the most of the changes would be the best way to do
it, but to do that you somehow have to code a dialog box for the
worksheet, I'm not sure that's possible without extending Dia itself.

I actually like using upper case for table names as well, but I
figured it was best to use whatever the user types in.  If they want
uppercase, they can type it into the definition.

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

As long as it's kosher with the UML definition, it's fine with me.  I
just used "{OID}" tags because that's what they use in the book I had,
and I didn't know any better.

All I was attempting to do for this is get away from having to type
something specific into the definition and making the table display
wider than needs to be.  The project I did this for will probably have
around a hundred tables, and it's going to be tough to display them
all in an orderly fashion.  I would rather have a primary key
indicated by it being underlined, which is what happens when the
'class scope' is checked.  As to whether this is in accordance with
the UML specs, I have no idea, as I have only a passing familiarity
with UML.

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.

"Persistent" is legit (though annoying) UML.  I'm not familiar with

Added drop table statements before the create table statement.

Also should be optional.  Believe it or not some interpreters poop out
on the DROP TABLE statements if the table does not exist.

Agreed, however I can't figure out a good way to give the user the
option.  The project I'm planning to use this for is based on
postgres, and it will give an error on a drop table without a table
already existing, however it will continue, so is not fatal.  For
MySql and Oracle it would be better to do a DROP TABLE IF EXISTS
table_name, unfortunantly Postgres doesn't support this.

Yes, this is a pain.  I did it this way because 1) I didn't know any
better, 2) there wasn't much enthusiasm for adding it to CVS at the
time, and 3) I didn't think it should be put in CVS until I wrote the
import code and it was somewhat stable.

I agree it's a pain.  Ideally, I think part of the UML plugin should
be ripped off and a larger SQL plugin created using only the Class and
Message objects from it.  This way the Table properties box labels
could read stuff like 'Primary Key' rather than 'class scope'.  Once
this is done it seems like it might be worthy of inclusion into the
core dia package.. right now it's rather hackish in my opionion.  But
I'm still happy with it, as I can now do my sql table creation using a
visual tool.  I had been using powerbuilder on windows, but the
reboots were driving me mad.


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