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
                refs.add(ref);
            }

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.


Regards.


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to