public Clob createClob() throws SQLException { return new MockClob(""); }
public Reader getCharacterStream(long pos, long length) throws SQLException { if(wasFreeCalled) { throw new SQLException("free() was called"); } length = verifyAndFixLength(pos, (int)length); return new StringReader(getSubString(pos, (int)length)); }
public long position(Clob searchClob, long start) throws SQLException { return position(searchClob.getSubString(1, (int)searchClob.length()), start); }
public int setString(long pos, String str) throws SQLException { return setString(pos, str, 0, str.length()); }
public boolean equals(Object obj) { if(null == obj) return false; if(!obj.getClass().equals(this.getClass())) return false; MockClob other = (MockClob)obj; if(wasFreeCalled != other.wasFreeCalled()) return false; return clobData.toString().equals(other.clobData.toString()); }
public String getSubString(long pos, int length) throws SQLException { if(wasFreeCalled) { throw new SQLException("free() was called"); } length = verifyAndFixLength(pos, length); return clobData.substring((int)(pos - 1), (int)(pos - 1) + length); }
public int setString(long pos, String str) throws SQLException { return setString(pos, str, 0, str.length()); }
public boolean equals(Object obj) { if(null == obj) return false; if(!obj.getClass().equals(this.getClass())) return false; MockClob other = (MockClob)obj; if(wasFreeCalled != other.wasFreeCalled()) return false; return clobData.toString().equals(other.clobData.toString()); }
public String getSubString(long pos, int length) throws SQLException { if(wasFreeCalled) { throw new SQLException("free() was called"); } length = verifyAndFixLength(pos, length); return clobData.substring((int)(pos - 1), (int)(pos - 1) + length); }
public Clob createClob() throws SQLException { return new MockClob(""); }
public Reader getCharacterStream(long pos, long length) throws SQLException { if(wasFreeCalled) { throw new SQLException("free() was called"); } length = verifyAndFixLength(pos, (int)length); return new StringReader(getSubString(pos, (int)length)); }
public int setString(long pos, String str) throws SQLException { return setString(pos, str, 0, str.length()); }
public boolean equals(Object obj) { if(null == obj) return false; if(!obj.getClass().equals(this.getClass())) return false; MockClob other = (MockClob)obj; if(wasFreeCalled != other.wasFreeCalled()) return false; return clobData.toString().equals(other.clobData.toString()); }
public String getSubString(long pos, int length) throws SQLException { if(wasFreeCalled) { throw new SQLException("free() was called"); } length = verifyAndFixLength(pos, length); return clobData.substring((int)(pos - 1), (int)(pos - 1) + length); }
public long position(Clob searchClob, long start) throws SQLException { return position(searchClob.getSubString(1, (int)searchClob.length()), start); }
public Clob createClob() throws SQLException { return new MockClob(""); }
public Reader getCharacterStream(long pos, long length) throws SQLException { if(wasFreeCalled) { throw new SQLException("free() was called"); } length = verifyAndFixLength(pos, (int)length); return new StringReader(getSubString(pos, (int)length)); }
public void write(char[] cbuf, int off, int len) throws IOException { try { setString(index + 1, new String(cbuf, off, len)); } catch(SQLException exc) { throw new IOException(exc.getMessage()); } index++; } }
public long position(Clob searchClob, long start) throws SQLException { return position(searchClob.getSubString(1, (int)searchClob.length()), start); }
public void updateClob(int columnIndex, Reader reader) throws SQLException { String data = StreamUtil.getReaderAsString(reader); updateClob(columnIndex, new MockClob(data)); }