private void analyzeForLinking(ResultSet rs, String cmd) throws SQLException {
        if (rs == null) {
            return;
        }
        Statement stmt = rs.getStatement();
        if (stmt == null) {
            return;
        }
        Connection conn = stmt.getConnection();
        if (conn == null) {
            return;
        }
        this.conn = conn;
        if (conn.isReadOnly()) {
            return;
        }
        final String tableName = findTableName(cmd);
        if (tableName.length() == 0) {
            return;
        }
        this.tableName = tableName;
        this.updatable = true;
        List<String> pkList = findPrimaryKeys(conn, tableName);
        if (pkList.isEmpty()) {
            return;
        }
        @SuppressWarnings("unchecked")
        final Collection<Object> columnIdentifiers = this.columnIdentifiers;
        if (!columnIdentifiers.containsAll(pkList)) {
            return;
        }
        if (findUnion(cmd)) {
            return;
        }
        this.primaryKeys = pkList.toArray(new String[pkList.size()]);
        this.linkable = true;
    }