Code example for Clob

Methods: getSubString, length

0
            return -1; 
        } 
 
        final String ldata = data;
        final long   dlen  = ldata.length();
        final long   sslen = searchstr.length();
 
        start--;    //***** FOIRGOT THIS *******
 
// This is potentially much less expensive than materializing a large 
// substring from some other vendor's CLOB.  Indeed, we should probably 
// do the comparison piecewise, using an in-memory buffer (or temp-files 
// when available), if it is detected that the input CLOB is very long. 
        if (start > dlen - sslen) {
            return -1; 
        } 
 
        // by now, we know sslen and start are both < Integer.MAX_VALUE 
        String s;
 
        if (searchstr instanceof jdbcClob) {
            s = ((jdbcClob) searchstr).data;
        } else { 
            s = searchstr.getSubString(1L, (int) sslen);
        } 
 
        final int pos = ldata.indexOf(s, (int) start);
 
        return (pos < 0) ? -1