Hi Leon,

I just generated all the classes using your JDBC OM generator task, but
I had to modify JDBCSchemaToDatabaseMap to get it to work with
Postgres.  First of all, the getTables method from pgsql doesn't return
the types, so it gives a null pointer exception when you check if the
type is "TABLE" on line 190.  I changed it so that instead of passing
null for the types, it passes {"TABLE"}, and then it doesn't do the
check.

Also, since postgres just got foreign keys in the latest version, the
JDBC metadata hasn't caught up so the getImportedKeys method returns
null.

Below is the patch.  If it looks ok to you, I can commit it later.

        -Nissim

Index: org/apache/turbine/tools/JDBCSchemaToDatabaseMap.java
===================================================================
RCS file:
/products/cvs/turbine/turbine/src/java/org/apache/turbine/tools/JDBCSchemaToDatabaseMap.java,v
retrieving revision 1.4
diff -r1.4 JDBCSchemaToDatabaseMap.java
184c184,185
<         ResultSet tableNames = dbMeta.getTables("",null,"%",null);
---
>         String[] types = {"TABLE"};
>         ResultSet tableNames = dbMeta.getTables("",null,"%",types);
190,191c191,192
<             if (type.equals("TABLE"))
<             {
---
>             //if (type.equals("TABLE"))
>             //{
193c194
<             }
---
>             //}
247c248
<         while (foreignKeys.next())
---
>         if (foreignKeys != null)
249,254c250,258
<             String table = foreignKeys.getString(3);
<             String column = foreignKeys.getString(4);
<             Vector v = new Vector();
<             v.addElement (table);
<             v.addElement (column);
<             keys.addElement (v);
---
>             while (foreignKeys.next())
>             {
>                 String table = foreignKeys.getString(3);
>                 String column = foreignKeys.getString(4);
>                 Vector v = new Vector();
>                 v.addElement (table);
>                 v.addElement (column);
>                 keys.addElement (v);
>             }


------------------------------------------------------------
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