row[9] = new Short((short) DatabaseMetaData.importedKeyCascade);
row[9] = XSQLVAR.encodeShort((short) DatabaseMetaData.importedKeyCascade);
    public ResultSet getCrossReference(        String primaryCatalog, String primarySchema, String primaryTable,        String foreignCatalog, String foreignSchema, String foreignTable        ) throws SQLException {        checkCatalogAndSchema(primaryCatalog, primarySchema);        checkCatalogAndSchema(foreignCatalog, foreignSchema);        Clause primaryTableClause = new Clause("PK.RDB$RELATION_NAME", primaryTable);        Clause foreignTableClause = new Clause("FK.RDB$RELATION_NAME", foreignTable);        String sql = GET_CROSS_KEYS_START;        sql += primaryTableClause.getCondition();        sql += foreignTableClause.getCondition();        sql += GET_CROSS_KEYS_END;        ArrayList params = new ArrayList();        if (!primaryTableClause.getCondition().equals("")) {            params.add(primaryTableClause.getValue());        }        if (!foreignTableClause.getCondition().equals("")) {            params.add(foreignTableClause.getValue());        }        ResultSet rs = c.doQuery(sql, params, statements);        XSQLVAR[] xsqlvars = new XSQLVAR[14];        xsqlvars[0] = new XSQLVAR();        xsqlvars[0].sqltype = GDS.SQL_VARYING;        xsqlvars[0].sqllen = 31;        xsqlvars[0].sqlname = "PKTABLE_CAT";        xsqlvars[0].relname = "COLUMNINFO";        xsqlvars[1] = new XSQLVAR();        xsqlvars[1].sqltype = GDS.SQL_VARYING;        xsqlvars[1].sqllen = 31;        xsqlvars[1].sqlname = "PKTABLE_SCHEM";        xsqlvars[1].relname = "COLUMNINFO";        xsqlvars[2] = new XSQLVAR();        xsqlvars[2].sqltype = GDS.SQL_VARYING;        xsqlvars[2].sqllen = 31;        xsqlvars[2].sqlname = "PKTABLE_NAME";        xsqlvars[2].relname = "COLUMNINFO";        xsqlvars[3] = new XSQLVAR();        xsqlvars[3].sqltype = GDS.SQL_VARYING;        xsqlvars[3].sqllen = 31;        xsqlvars[3].sqlname = "PKCOLUMN_NAME";        xsqlvars[3].relname = "COLUMNINFO";        xsqlvars[4] = new XSQLVAR();        xsqlvars[4].sqltype = GDS.SQL_VARYING;        xsqlvars[4].sqllen = 31;        xsqlvars[4].sqlname = "FKTABLE_CAT";        xsqlvars[4].relname = "COLUMNINFO";        xsqlvars[5] = new XSQLVAR();        xsqlvars[5].sqltype = GDS.SQL_VARYING;        xsqlvars[5].sqllen = 31;        xsqlvars[5].sqlname = "FKTABLE_SCHEM";        xsqlvars[5].relname = "COLUMNINFO";        xsqlvars[6] = new XSQLVAR();        xsqlvars[6].sqltype = GDS.SQL_VARYING;        xsqlvars[6].sqllen = 31;        xsqlvars[6].sqlname = "FKTABLE_NAME";        xsqlvars[6].relname = "COLUMNINFO";        xsqlvars[7] = new XSQLVAR();        xsqlvars[7].sqltype = GDS.SQL_VARYING;        xsqlvars[7].sqllen = 31;        xsqlvars[7].sqlname = "FKCOLUMN_NAME";        xsqlvars[7].relname = "COLUMNINFO";        xsqlvars[8] = new XSQLVAR();        xsqlvars[8].sqltype = GDS.SQL_SHORT;        xsqlvars[8].sqlname = "KEY_SEQ";        xsqlvars[8].relname = "COLUMNINFO";        xsqlvars[9] = new XSQLVAR();        xsqlvars[9].sqltype = GDS.SQL_SHORT;        xsqlvars[9].sqlname = "UPDATE_RULE";        xsqlvars[9].relname = "COLUMNINFO";        xsqlvars[10] = new XSQLVAR();        xsqlvars[10].sqltype = GDS.SQL_SHORT;        xsqlvars[10].sqlname = "DELETE_RULE";        xsqlvars[10].relname = "COLUMNINFO";        xsqlvars[11] = new XSQLVAR();        xsqlvars[11].sqltype = GDS.SQL_VARYING;        xsqlvars[11].sqllen = 31;        xsqlvars[11].sqlname = "FK_NAME";        xsqlvars[11].relname = "COLUMNINFO";        xsqlvars[12] = new XSQLVAR();        xsqlvars[12].sqltype = GDS.SQL_VARYING;        xsqlvars[12].sqllen = 31;        xsqlvars[12].sqlname = "PK_NAME";        xsqlvars[12].relname = "COLUMNINFO";        xsqlvars[13] = new XSQLVAR();        xsqlvars[13].sqltype = GDS.SQL_SHORT;        xsqlvars[13].sqlname = "DEFERRABILITY";        xsqlvars[13].relname = "COLUMNINFO";        ArrayList rows = new ArrayList();        while (rs.next()) {            Object[] row = new Object[14];            row[0] = null;            row[1] = null;            row[2] = getBytes(rs.getString("PKTABLE_NAME").trim());            row[3] = getBytes(rs.getString("PKCOLUMN_NAME").trim());            row[4] = null;            row[5] = null;            row[6] = getBytes(rs.getString("PKTABLE_NAME").trim());            row[7] = getBytes(rs.getString("PKCOLUMN_NAME").trim());            row[8] = new Short(rs.getShort("KEY_SEQ"));            String updateRule = rs.getString("UPDATE_RULE");            if (updateRule.equals("NO ACTION") || updateRule.equals("RESTRICT"))                row[9] = new Short((short) DatabaseMetaData.importedKeyNoAction);            else if (updateRule.equals("CASCADE"))                row[9] = new Short((short) DatabaseMetaData.importedKeyCascade);            else if (updateRule.equals("SET NULL"))                row[9] = new Short((short) DatabaseMetaData.importedKeySetNull);            else if (updateRule.equals("SET DEFAULT"))                row[9] = new Short((short) DatabaseMetaData.importedKeySetDefault);            String deleteRule = rs.getString("DELETE_RULE");            if (updateRule.equals("NO ACTION") || updateRule.equals("RESTRICT"))                row[10] = new Short((short) DatabaseMetaData.importedKeyNoAction);            else if (deleteRule.equals("CASCADE"))                row[10] = new Short((short) DatabaseMetaData.importedKeyCascade);            else if (deleteRule.equals("SET NULL"))                row[10] = new Short((short) DatabaseMetaData.importedKeySetNull);            else if (deleteRule.equals("SET DEFAULT"))                row[10] = new Short((short) DatabaseMetaData.importedKeySetDefault);            row[11] = getBytes(rs.getString("FK_NAME"));            row[12] = getBytes(rs.getString("PK_NAME"));            row[13] = new Short((short) DatabaseMetaData.importedKeyNotDeferrable);            rows.add(row);        }        return new FBResultSet(xsqlvars, rows);    }