@SuppressWarnings("unchecked") public <T> T getObject(int columnIndex, Class<T> type) throws SQLException { if (type == null) { throw SQLError.createSQLException("Type parameter can not be null", SQLError.SQL_STATE_ILLEGAL_ARGUMENT, getExceptionInterceptor()); } if (type.equals(Struct.class)) { throw new SQLFeatureNotSupportedException(); } else if (type.equals(RowId.class)) { return (T) getRowId(columnIndex); } else if (type.equals(NClob.class)) { return (T) getNClob(columnIndex); } else if (type.equals(SQLXML.class)) { return (T) getSQLXML(columnIndex); } return super.getObject(columnIndex, type); }
/** * JDBC 4.0 Get a NCLOB column. * * @param i * the first column is 1, the second is 2, ... * * @return an object representing a NCLOB * * @throws SQLException * if an error occurs */ public NClob getNClob(int columnIndex) throws SQLException { String fieldEncoding = this.fields[columnIndex - 1].getEncoding(); if (fieldEncoding == null || !fieldEncoding.equals("UTF-8")) { throw new SQLException("Can not call getNClob() when field's charset isn't UTF-8"); } if (!this.isBinaryEncoded) { String asString = getStringForNClob(columnIndex); if (asString == null) { return null; } return new com.mysql.jdbc.JDBC4NClob(asString, getExceptionInterceptor()); } return getNativeNClob(columnIndex); }
/** * @see ResultSet#updateNClob(int, NClob) */ public void updateNClob(int columnIndex, java.sql.NClob nClob) throws SQLException { String fieldEncoding = this.fields[columnIndex - 1].getEncoding(); if (fieldEncoding == null || !fieldEncoding.equals("UTF-8")) { throw new SQLException("Can not call updateNClob() when field's character set isn't UTF-8"); } if (nClob == null) { updateNull(columnIndex); } else { updateNCharacterStream(columnIndex, nClob.getCharacterStream(), (int) nClob.length()); } }
@SuppressWarnings({ "unchecked" }) public <X> X unwrap(final NClob value, Class<X> type, WrapperOptions options) { if ( value == null ) { return null; } try { if ( CharacterStream.class.isAssignableFrom( type ) ) { if ( NClobImplementer.class.isInstance( value ) ) { // if the incoming NClob is a wrapper, just pass along its BinaryStream return (X) ( (NClobImplementer) value ).getUnderlyingStream(); } else { // otherwise we need to build a BinaryStream... return (X) new CharacterStreamImpl( DataHelper.extractString( value.getCharacterStream() ) ); } } else if (NClob.class.isAssignableFrom( type )) { final NClob nclob = WrappedNClob.class.isInstance( value ) ? ( (WrappedNClob) value ).getWrappedNClob() : value; return (X) nclob; } } catch ( SQLException e ) { throw new HibernateException( "Unable to access nclob stream", e ); } throw unknownUnwrap( type ); }
@Override public NClob getNClob(int columnIndex) throws SQLException { checkColumnBounds(columnIndex); try { return new JDBC4NClob(table.getString(columnIndex - 1) .toCharArray()); } catch (Exception x) { throw SQLError.get(x); } }
public NClob getNClob(int parameterIndex) throws SQLException { try { if (this.wrappedStmt != null) { return ((CallableStatement) this.wrappedStmt).getNClob(parameterIndex); } else { throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); } } catch (SQLException sqlEx) { checkAndFireConnectionError(sqlEx); } return null; }
@Override public NClob createNClob(String string) { try { final NClob nclob = createNClob(); nclob.setString( 1, string ); return nclob; } catch ( SQLException e ) { throw new JDBCException( "Unable to set NCLOB string after creation", e ); } }
/** * @see java.sql.Connection#createNClob() */ public NClob createNClob() throws SQLException { checkClosed(); try { return ((java.sql.Connection) this.mc).createNClob(); } catch (SQLException sqlException) { checkAndFireConnectionError(sqlException); } return null; // never reached, but compiler can't tell }
public NClob createNClob() throws SQLException { try { return realConnection.createNClob(); } catch(SQLException s) { String methodCall = "createNClob()"; reportException(methodCall, s, null); throw s; } }
/** * @see java.sql.CallableStatement#getNClob(java.lang.String) */ public NClob getNClob(String parameterName) throws SQLException { try { if (this.wrappedStmt != null) { return ((CallableStatement) this.wrappedStmt).getNClob(parameterName); } else { throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); } } catch (SQLException sqlEx) { checkAndFireConnectionError(sqlEx); } return null; }
public void setNClob(String parameterName, NClob value) throws SQLException { try { if (this.wrappedStmt != null) { ((CallableStatement) this.wrappedStmt).setNClob(parameterName, value); } else { throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor); } } catch (SQLException sqlEx) { checkAndFireConnectionError(sqlEx); } }
@Override public void updateNClob(String columnLabel, NClob nClob) throws SQLException { throw new SQLFeatureNotSupportedException(); }
@Override public void updateNClob(String columnLabel, NClob nClob) throws SQLException { throw new UnsupportedOperationException("Not supported yet."); }
public NClob getNClob(String parameterName) throws SQLException { return realCallableStatement.getNClob(parameterName); }
@Override public NClob getNClob(String columnLabel) throws SQLException { throw new UnsupportedOperationException("Not supported yet."); }
@Override public NClob getNClob( String columnLabel ) throws SQLException { checkNotClosed(); return super.getNClob( columnLabel ); }
@Override default void updateNClob(int columnIndex, NClob nClob) throws SQLException { }
private final java.sql.NClob getNClobFromString(String stringVal, int columnIndex) throws SQLException { return new com.mysql.jdbc.JDBC4NClob(stringVal, getExceptionInterceptor()); }
@Override public NClob createNClob(Reader reader, long length) { return NClobProxy.generateProxy( reader, length ); }
void setNClob(int parameterIndex, NClob value) { parameters.ensureCapacity(parameterIndex+1); }
@Override public NClob getNClob(String columnLabel) throws SQLException { return this.getCurrentResultSet().getNClob(columnLabel); }
/** * @see ResultSet#updateClob(int, Clob) */ public void updateNClob(String columnName, java.sql.NClob nClob) throws SQLException { updateNClob(findColumn(columnName), nClob); }
@Override public void setNClob(String parameterName, NClob value) throws SQLException { throw new UnsupportedOperationException("Not supported yet."); }
/** * @see java.sql.Connection#createNClob() */ public NClob createNClob() { return new com.mysql.jdbc.JDBC4NClob(getExceptionInterceptor()); }
/** * @see java.sql.Connection#createNClob() */ public NClob createNClob() { return this.getJDBC4Connection().createNClob(); }
@Override public int extractHashCode(NClob value) { return System.identityHashCode( value ); }
@Override public void setNClob(int parameterIndex, NClob value) throws SQLException { throw new UnsupportedOperationException("Not supported yet."); }
@Override public NClob getNClob(String columnLabel) throws SQLException { return getNClob(findColumn(columnLabel)); }
@Override public NClob createNClob() throws SQLException { throw new UnsupportedOperationException("Not supported yet."); }
@Override public NClob getNClob(int parameterIndex) throws SQLException { return wrappedStatement.getNClob( parameterIndex ); }
@Override public NClob getNClob( int columnIndex ) throws SQLException { throwIfClosed(); return super.getNClob( columnIndex ); }
@Override public void updateNClob(int columnIndex, NClob nClob) throws SQLException { throw new UnsupportedOperationException("Not supported yet."); }
@Override public NClob createNClob(String string) { return lobCreator().createNClob( string ); }
@Override public void updateNClob(String columnLabel, NClob nClob) throws SQLException { throw SQLError.noSupport(); }