System.out.println("all rows successfully fetched");
    public Object[] isc_dsql_fetch(isc_stmt_handle stmt_handle,                              int da_version,                              XSQLDA xsqlda) throws GDSException {                                          isc_stmt_handle_impl stmt = (isc_stmt_handle_impl) stmt_handle;        isc_db_handle_impl db = stmt.rsr_rdb;                                            if (stmt_handle == null) {            throw new GDSException(isc_bad_req_handle);        }        if (xsqlda == null) {            throw new GDSException(isc_dsql_sqlda_err);        }        if (!stmt.allRowsFetched && stmt.rows.size() == 0) {            //Fetch next batch of rows            try {                System.out.print("op_fetch ");                db.out.writeInt(op_fetch);                db.out.writeInt(stmt.rsr_id);                writeBLR(db, xsqlda);                db.out.writeInt(0);     // p_sqldata_message_number                db.out.writeInt(1);     // p_sqldata_messages                System.out.println("sent");                            if (nextOperation(db) == op_fetch_response) {                    int sqldata_status;                    int sqldata_messages;                    do {                        int op = readOperation(db);                        sqldata_status = db.in.readInt();                        sqldata_messages = db.in.readInt();                                                if (sqldata_messages > 0 && sqldata_status == 0) {                            stmt.rows.add(readSQLData(db, xsqlda));                            /*                            XSQLDA batch_xsqlda = new XSQLDA(xsqlda.sqln);                            for (int i = 0; i < xsqlda.sqln; i++) {                                batch_xsqlda.sqlvar[i] =                                    new XSQLVAR(xsqlda.sqlvar[i].sqldata);                                xsqlda.sqlvar[i].sqldata = null;                            }                                            stmt.rows.addElement(batch_xsqlda);*/                        }                    } while (sqldata_messages > 0 && sqldata_status == 0);                                        if (sqldata_status == 100) {                        stmt.allRowsFetched = true;                    }                                    }                else {                    receiveResponse(db);                }            } catch (IOException ex) {                throw new GDSException(isc_net_read_err);            }        }                if (stmt.rows.size() > 0) {            //Return next row from cache.            Object[] row = (Object[])stmt.rows.remove(0);            for (int i = 0; i < xsqlda.sqld; i++) {                xsqlda.sqlvar[i].sqldata = row[i];            }            for (int i = xsqlda.sqld; i< xsqlda.sqln; i++) {                //is this really necessary?                xsqlda.sqlvar[i].sqldata = null;            }            return row;/*            XSQLDA out_xsqlda = (XSQLDA) stmt.rows.elementAt(0);            stmt.rows.removeElementAt(0);            for (int i = 0; i < xsqlda.sqln; i++) {                xsqlda.sqlvar[i].sqldata = out_xsqlda.sqlvar[i].sqldata;            }*/        }        else {            for (int i = 0; i< xsqlda.sqln; i++) {                xsqlda.sqlvar[i].sqldata = null;            }            return null; //no rows fetched        }                                      }