Ok,

I made a fatal mistake when I wrote that .sql parser. Essentially it all
boils down to me not realizing that you can change the name of the foreign
key column that references to another table...for example:

FOREIGN KEY (OBSERVED_ID)
REFERENCES SCARAB_ISSUE(ISSUE_ID),

instead of what i thought was only possible:

FOREIGN KEY (ISSUE_ID)
REFERENCES SCARAB_ISSUE(ISSUE_ID),

I have figured out that this problem isn't easily fixable. It is easier to
fix by re-working the parser. Here is the details on how to do it. I think
it will actually turn out to be a much cleaner set of code as well.

First, read in the entire file into a Vector or String[], one line from the
file per entry in the Vector. The reason is that you will need to loop over
the data multiple times (3-4 i think).

Next, loop over the Vector and generate all of the TableMap's. Then, loop
over the Vector again and generate all of the ColumnMap's. Then, loop over
one last time and use the generated information to build up all the
relationships in the ColumnMap's.

The problem with the current approach is that it is a one pass parser and
prevents you from being able to make the above association because the data
for it may or may not exist yet.

That should be much cleaner code and will also allow you to more easily
handle the case above. You should use the existing parsing code to help you
loop over the lines.

Anyway, I'm pretty much documenting this as something I need to fix, but if
any one of you want to take this task on, please feel free. I don't have the
time right now to fix it, but will eventually.

thanks,

-jon
-- 
http://scarab.tigris.org/    | http://noodle.tigris.org/
http://java.apache.org/      | http://java.apache.org/turbine/
http://www.working-dogs.com/ | http://jakarta.apache.org/velocity/
http://www.collab.net/       | http://www.sourcexchange.com/




------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to