You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ddlutils-user@db.apache.org by Heng Chu <he...@hotmail.com> on 2008/11/26 17:30:33 UTC

excludetables problem and have a fix

First of all, thanks for this wonderful utility. Very useful w/ a lot of good
features. I recently found a problem in ddlutils (latest code in SVN) and
have a fix. I am not sure how I can contribute the fix back to the DdlUtils
project team. 

Here is the problem: I use excludetables in the DdlUtils Ant task
org.apache.ddlutils.task.DatabaseToDdlTask. Some of the tables listed have
foreigh keys to other tables in the DB. I got an error on writeSchemaToFile
complaining about this which should be ok. 

Here is the fix: In org.apache.ddlutils.task.DatabaseToDdlTask, the
readModel() method calls the
ModelHelper.checkForForeignKeysToAndFromTables() in both the exclude and
include cases. That method, as currently implemented, throws an exception if
(1) a table in the (exclude or include) list has a foreign key to a table
not on the list, OR, (2) a table not on the list has a foreign key into a
table in the (exclude or include) list. This is too strict a check and could
stop some legit cases -- my problem is actually due to chec (1) which is ok
in exclude case. This method should be split into two. For the include case,
just check (1) and for excluse case, just check (2). I made the
straightfoward change in my local copy and things went ok. I just want to
report this and hope it's fixed in the near future. Thanks!

Heng
-- 
View this message in context: http://www.nabble.com/excludetables-problem-and-have-a-fix-tp20704354p20704354.html
Sent from the Apache DdlUtils - User mailing list archive at Nabble.com.


Re: excludetables problem and have a fix

Posted by Thomas Dudziak <to...@gmail.com>.
Hi Heng,

please file an issue with DdlUtils JIRA
(http://issues.apache.org/jira/secure/BrowseProject.jspa?id=10731) for
this. If you have a patch or unit tests for this, please also attach
them to the JIRA issue.

thanks,
Tom

On Wed, Nov 26, 2008 at 8:30 AM, Heng Chu <he...@hotmail.com> wrote:
>
> First of all, thanks for this wonderful utility. Very useful w/ a lot of good
> features. I recently found a problem in ddlutils (latest code in SVN) and
> have a fix. I am not sure how I can contribute the fix back to the DdlUtils
> project team.
>
> Here is the problem: I use excludetables in the DdlUtils Ant task
> org.apache.ddlutils.task.DatabaseToDdlTask. Some of the tables listed have
> foreigh keys to other tables in the DB. I got an error on writeSchemaToFile
> complaining about this which should be ok.
>
> Here is the fix: In org.apache.ddlutils.task.DatabaseToDdlTask, the
> readModel() method calls the
> ModelHelper.checkForForeignKeysToAndFromTables() in both the exclude and
> include cases. That method, as currently implemented, throws an exception if
> (1) a table in the (exclude or include) list has a foreign key to a table
> not on the list, OR, (2) a table not on the list has a foreign key into a
> table in the (exclude or include) list. This is too strict a check and could
> stop some legit cases -- my problem is actually due to chec (1) which is ok
> in exclude case. This method should be split into two. For the include case,
> just check (1) and for excluse case, just check (2). I made the
> straightfoward change in my local copy and things went ok. I just want to
> report this and hope it's fixed in the near future. Thanks!
>
> Heng
> --
> View this message in context: http://www.nabble.com/excludetables-problem-and-have-a-fix-tp20704354p20704354.html
> Sent from the Apache DdlUtils - User mailing list archive at Nabble.com.
>
>