protected void checkOffset(long offset) throws SQLException { if (offset < 0) { throw ThriftExceptionUtil.newSQLException(SQLState.BLOB_BAD_POSITION, null, offset + 1); } else if (offset >= Integer.MAX_VALUE) { throw ThriftExceptionUtil.newSQLException( SQLState.BLOB_POSITION_TOO_LARGE, null, offset + 1); } }
@Override public final ResultSet executeQuery(String sql) throws SQLException { throw ThriftExceptionUtil.newSQLException( SQLState.NOT_FOR_PREPARED_STATEMENT, null, "executeQuery(String)"); }
final SQLException nullRowException() { if (this.rowSet == null) { return ThriftExceptionUtil .newSQLException(SQLState.CLIENT_RESULT_SET_NOT_OPEN); } else { return ThriftExceptionUtil.newSQLException(SQLState.NO_CURRENT_ROW); } }
/** * {@inheritDoc} */ @Override public Struct createStruct(String typeName, Object[] attributes) throws SQLException { throw ThriftExceptionUtil.newSQLException(SQLState.NOT_IMPLEMENTED, null, "createStruct(String,Object[])"); }
public static SQLException newOutOfRangeException( String type, int column, Throwable cause) { return ThriftExceptionUtil.newSQLException( SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE, cause, type, column); }
public static SQLException newFormatException(String type, int column, Throwable cause) { return ThriftExceptionUtil.newSQLException(SQLState.LANG_FORMAT_EXCEPTION, cause, type, column); }
protected void checkLength(long length) throws SQLException { if (length < 0) { throw ThriftExceptionUtil.newSQLException( SQLState.BLOB_NONPOSITIVE_LENGTH, null, length); } else if (length > Integer.MAX_VALUE) { throw ThriftExceptionUtil.newSQLException( SQLState.BLOB_LENGTH_TOO_LONG, null, length); } }
@Override public long position(String searchstr, long start) throws SQLException { // TODO: implement throw ThriftExceptionUtil.newSQLException( SQLState.NOT_IMPLEMENTED, null, "Clob.position"); }
protected final void checkValidParameterIndex(int parameterIndex) throws SQLException { if (parameterIndex < 1 || parameterIndex > this.numParams) { throw ThriftExceptionUtil.newSQLException( SQLState.LANG_INVALID_COLUMN_POSITION, null, parameterIndex, this.numParams); } }
@Override public final int executeUpdate(String sql) throws SQLException { throw ThriftExceptionUtil.newSQLException( SQLState.NOT_FOR_PREPARED_STATEMENT, null, "executeUpdate(String)"); }
@Override public final int executeUpdate(String sql, String[] columnNames) throws SQLException { throw ThriftExceptionUtil.newSQLException( SQLState.NOT_FOR_PREPARED_STATEMENT, null, "executeUpdate(String, String[])"); }
@Override public void closeOnCompletion() throws SQLException { throw ThriftExceptionUtil.newSQLException(SQLState.NOT_IMPLEMENTED, null, "Statement.closeOnCompletion()"); }
public final void checkClosedConnection() throws SQLException { if (this.isClosed) { throw ThriftExceptionUtil.newSQLException( SQLState.NO_CURRENT_CONNECTION, null); } } }
/** * {@inheritDoc} */ @Override public long position(Blob pattern, long start) throws SQLException { // TODO: implement throw ThriftExceptionUtil.newSQLException( SQLState.NOT_IMPLEMENTED, null, "Blob.position"); }
/** check if 1-based index of column is valid one */ final void checkForValidColumn(int column) throws SQLException { final int numColumns = this.descriptors.size(); if (column < 1 || column > numColumns) { throw ThriftExceptionUtil.newSQLException( SQLState.LANG_INVALID_COLUMN_POSITION, null, column, numColumns); } }
/** * {@inheritDoc} */ @Override public <T> T unwrap(Class<T> iface) throws SQLException { try { return iface.cast(this); } catch (ClassCastException cce) { throw ThriftExceptionUtil.newSQLException(SQLState.UNABLE_TO_UNWRAP, cce, iface); } }
public void setClob(OptimizedElementArray row, int columnPosition, Clob x) throws SQLException { long len = x.length(); if (len <= Integer.MAX_VALUE) { setString(row, columnPosition, x.getSubString(1, (int)len)); } else { throw ThriftExceptionUtil.newSQLException( SQLState.BLOB_TOO_LARGE_FOR_CLIENT, null, len, Integer.MAX_VALUE); } }
private XAException newXAException(int xaCode, String sqlState, Object... args) { XAException xae = new XAException(xaCode); if (sqlState != null) { xae.initCause(ThriftExceptionUtil.newSQLException(sqlState, null, args)); } return xae; }
public void setAsciiStream(OptimizedElementArray row, int columnPosition, InputStream stream, long length, LobService lobService) throws SQLException { if (length <= Integer.MAX_VALUE) { setClob(row, columnPosition, lobService.createClob(stream, length)); } else { throw ThriftExceptionUtil.newSQLException( SQLState.BLOB_TOO_LARGE_FOR_CLIENT, null, length, Integer.MAX_VALUE); } }
protected final int prepare() throws SQLException { this.attrs.setPoolable(true); try { PrepareResult pr = this.service.prepareStatement(this.preparedSQL, null, getAttributes()); clearPendingTransactionAttrs(); return setPrepareResult(pr); } catch (SnappyException se) { throw ThriftExceptionUtil.newSQLException(se); } }