if (xsqlvar.sqldata == null) { log.debug("sqldata still null in writeSQLDatum: " + xsqlvar);
if (log != null) { if (xsqlvar.sqldata == null) { log.debug("sqldata still null in writeSQLDatum: " + xsqlvar); }
    private void writeSQLDatum(isc_db_handle_impl db,                                  XSQLVAR xsqlvar) throws GDSException {        byte[] buffer;        if (db.out == null)         {            log.debug("db.out null in writeSQLDatum");        }        if (xsqlvar.sqldata == null)         {            log.debug("sqldata null in writeSQLDatum: " + xsqlvar);        }        fixNull(xsqlvar);        if (xsqlvar.sqldata == null)         {            log.debug("sqldata still null in writeSQLDatum: " + xsqlvar);        }        try {            Object sqldata = xsqlvar.sqldata;            switch (xsqlvar.sqltype & ~1) {                case SQL_TEXT:                    //buffer =                    //fillString((String) sqldata, xsqlvar.sqllen).getBytes();                    if (((byte[])sqldata).length != xsqlvar.sqllen) {                        throw new GDSException(isc_rec_size_err);                    }                    db.out.writeOpaque((byte[])sqldata, xsqlvar.sqllen);                    //db.out.writeOpaque(buffer, buffer.length);                    break;                case SQL_VARYING:                    if (((byte[])sqldata).length > xsqlvar.sqllen) {                        throw new GDSException(isc_rec_size_err);                    }                    db.out.writeInt(((byte[])sqldata).length);                    db.out.writeOpaque((byte[])sqldata, ((byte[])sqldata).length);//                  int len = ((((String) sqldata).length()<xsqlvar.sqllen) //                  ? ((String) sqldata).length() : xsqlvar.sqllen);//                  db.out.writeInt(len);//                  buffer = ((String) sqldata).substring(0, len).getBytes();//                  db.out.writeOpaque(buffer, buffer.length);                    break;                case SQL_SHORT:                    db.out.writeInt(((Short) sqldata).shortValue());                    break;                case SQL_LONG:                    db.out.writeInt(((Integer) sqldata).intValue());                    break;                case SQL_FLOAT:                    db.out.writeFloat(((Float) sqldata).floatValue());                    break;                case SQL_DOUBLE:                    db.out.writeDouble(((Double) sqldata).doubleValue());                    break;//            case SQL_D_FLOAT://                break;                case SQL_TIMESTAMP:                    db.out.writeInt(encodeDate((java.sql.Timestamp) sqldata));                    db.out.writeInt(encodeTime((java.sql.Timestamp) sqldata));                    break;                case SQL_BLOB:                    db.out.writeLong(((Long) sqldata).longValue());                    break;                case SQL_ARRAY:                    db.out.writeLong(((Long) sqldata).longValue());                    break;                case SQL_QUAD:                    db.out.writeLong(((Long) sqldata).longValue());                    break;                case SQL_TYPE_TIME:                    db.out.writeInt(encodeTime((java.sql.Time) sqldata));                    break;                case SQL_TYPE_DATE:                    db.out.writeInt(encodeDate((java.sql.Date) sqldata));                    break;                case SQL_INT64:                    db.out.writeLong(((Long) sqldata).longValue());                    break;                default:                    throw new GDSException("Unknown sql data type: " + xsqlvar.sqltype);            }            db.out.writeInt(xsqlvar.sqlind);        } catch (IOException ex) {            throw new GDSException(isc_net_write_err);        }    }