db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Xavier Maysonnave <xav...@omondo.com>
Subject ODBC Bug
Date Fri, 22 Aug 2003 08:10:59 GMT
Hi All,

I found a small bug while testing an ODBC source, MySQL with ODBC driver.
I didn't get this problem with other JDBC drivers.

In the class TorqueJDBCTranformTask, in the procedure getForeignKeys :

             while (foreignKeys.next()) {
                 String fkName = foreignKeys.getString(12);
                 String refTableName = foreignKeys.getString(3);
                 // if FK has no name - make it up (use tablename instead)
                 if (fkName == null) {
                     fkName = refTableName;
                     //fkName = foreignKeys.getString(3);->Bug ODBC-1
                 Object[] fk = (Object[]) fks.get(fkName);
                 List refs;
                 if (fk == null) {
                     fk = new Object[2];
                     fk[0] = refTableName; //referenced table name
                     //fk[0] = foreignKeys.getString(3);->Bug ODBC-2
                     refs = new ArrayList();
                     fk[1] = refs;
                     fks.put(fkName, fk);
                 } else {
                     refs = (ArrayList) fk[1];
                 String[] ref = new String[2];
                 ref[0] = foreignKeys.getString(8); //local column
                 ref[1] = foreignKeys.getString(4); //foreign column

The refTableName is called twice but it appears that the second time your try to access 
this value, you get a null.
As a simple workaround the refTableName should be set once.


To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org

View raw message