log.info("test- read bytes: " + readcount);
if (log!=null) log.info("test- read bytes: " + readcount);
    public void testCreateAndWriteBlobStreamInStreamPieces() throws Exception {        byte[] a = new String("a").getBytes();        byte[] testbuf = new byte[4096];//2030];        int reps = 10;//10000;        Arrays.fill(testbuf, a[0]);        log.info("test- testCreateAndWriteBlobInStreamPieces");        db1 = setupTable2();        t1 = startTransaction(db1);    isc_blob_handle_impl blob1 = (isc_blob_handle_impl)gds.get_new_isc_blob_handle();    Clumplet bpb = GDSFactory.newClumplet(GDS.isc_bpb_type, GDS.isc_bpb_type_stream);    //Clumplet bpb = GDSFactory.newClumplet(GDS.isc_bpb_type, GDS.isc_bpb_type_segmented);    gds.isc_create_blob2(db1, t1, blob1, bpb);    log.info("test- new blob_id: " + blob1.blob_id);    for (int i = 0; i< reps; i++) {        gds.isc_put_segment(blob1, testbuf);    }        log.info("test- wrote bytes: " + (100 * testbuf.length));        XSQLDA xsqlda = new XSQLDA(2);        XSQLVAR xsqlvar = new XSQLVAR();        xsqlvar.sqltype = GDS.SQL_SHORT;        xsqlvar.sqllen = 2;        xsqlvar.sqldata = new Short((short) 3);        xsqlda.sqlvar[0] = xsqlvar;        xsqlvar = new XSQLVAR();        xsqlvar.sqltype = GDS.SQL_BLOB;        xsqlvar.sqllen = 8;        xsqlvar.sqldata = new Long(blob1.blob_id);        xsqlda.sqlvar[1] = xsqlvar;    gds.isc_close_blob(blob1);        log.info("test- isc_dsql_exec_immed2");        gds.isc_dsql_exec_immed2(db1, t1, "INSERT INTO R2 VALUES (?, ?)",                                 GDS.SQL_DIALECT_CURRENT, xsqlda, null);        isc_stmt_handle stmt1 = gds.get_new_isc_stmt_handle();        log.info("test- isc_dsql_allocate_statement");        gds.isc_dsql_allocate_statement(db1, stmt1);        XSQLDA out_xsqlda = gds.isc_dsql_prepare(t1, stmt1, "SELECT COL1, COL2 FROM R2",                             GDS.SQL_DIALECT_CURRENT);        log.info("test- isc_dsql_execute2");        gds.isc_dsql_execute2(t1, stmt1, 1, null, null);        isc_blob_handle_impl blob2 = (isc_blob_handle_impl)gds.get_new_isc_blob_handle();        while (gds.isc_dsql_fetch(stmt1, 1, out_xsqlda) != null) {           String out = "";            for (int i = 0; i < out_xsqlda.sqld; i++) {                Object data =  out_xsqlda.sqlvar[i].sqldata;                out += "column: " + i + ", value: " + data;            }            log.info(out);            blob2.blob_id =((Long) out_xsqlda.sqlvar[1].sqldata).longValue();            // blob2.rbl_buffer_length = 10;//1024;            gds.isc_open_blob2(db1, t1, blob2, bpb);            int readcount = 0;            do {                byte[] answer = gds.isc_get_segment(blob2, 1052);// 1050)                readcount += answer.length;            } while (!blob2.isEof());            log.info("test- read bytes: " + readcount);            if (readcount != (reps * testbuf.length)) {                throw new Exception("Retrieved wrong size");            }        gds.isc_close_blob(blob2);        }        log.info("test- isc_dsql_free_statement");        gds.isc_dsql_free_statement(stmt1, GDS.DSQL_drop);    commit(t1);    teardownTable2(db1);    //        dropDatabase(db1);    }