@Override public Value createBlob(InputStream in, long maxLength) { init(); return addLob(in, maxLength, Value.BLOB, null); }
@Override public Value createClob(Reader reader, long maxLength) { init(); long max = maxLength == -1 ? Long.MAX_VALUE : maxLength; CountingReaderInputStream in = new CountingReaderInputStream(reader, max); return addLob(in, Long.MAX_VALUE, Value.CLOB, in); }
@Override public void removeAllForTable(int tableId) { init(); try { String sql = "SELECT ID FROM " + LOBS + " WHERE TABLE = ?"; PreparedStatement prep = prepare(sql); prep.setInt(1, tableId); ResultSet rs = prep.executeQuery(); while (rs.next()) { removeLob(rs.getLong(1)); } reuse(sql, prep); } catch (SQLException e) { throw DbException.convert(e); } if (tableId == LobStorageFrontend.TABLE_ID_SESSION_VARIABLE) { removeAllForTable(LobStorageFrontend.TABLE_TEMP); removeAllForTable(LobStorageFrontend.TABLE_RESULT); } }
synchronized (conn.getSession()) { try { init(); ValueLobDb v = null; if (!old.isRecoveryReference()) {
@Override public InputStream getInputStream(ValueLobDb lob, byte[] hmac, long byteCount) throws IOException { try { init(); assertNotHolds(conn.getSession()); // see locking discussion at the top synchronized (database) { synchronized (conn.getSession()) { long lobId = lob.getLobId(); return new LobInputStream(lobId, byteCount); } } } catch (SQLException e) { throw DbException.convertToIOException(e); } }
@Override public Value createBlob(InputStream in, long maxLength) { init(); return addLob(in, maxLength, Value.BLOB, null); }
@Override public Value createBlob(InputStream in, long maxLength) { init(); return addLob(in, maxLength, Value.BLOB, null); }
@Override public Value createClob(Reader reader, long maxLength) { init(); long max = maxLength == -1 ? Long.MAX_VALUE : maxLength; CountingReaderInputStream in = new CountingReaderInputStream(reader, max); ValueLobDb lob = addLob(in, Long.MAX_VALUE, Value.CLOB, in); return lob; }
@Override public Value createClob(Reader reader, long maxLength) { init(); long max = maxLength == -1 ? Long.MAX_VALUE : maxLength; CountingReaderInputStream in = new CountingReaderInputStream(reader, max); ValueLobDb lob = addLob(in, Long.MAX_VALUE, Value.CLOB, in); return lob; }
@Override public void removeAllForTable(int tableId) { init(); try { String sql = "SELECT ID FROM " + LOBS + " WHERE TABLE = ?"; PreparedStatement prep = prepare(sql); prep.setInt(1, tableId); ResultSet rs = prep.executeQuery(); while (rs.next()) { removeLob(rs.getLong(1)); } reuse(sql, prep); } catch (SQLException e) { throw DbException.convert(e); } if (tableId == LobStorageFrontend.TABLE_ID_SESSION_VARIABLE) { removeAllForTable(LobStorageFrontend.TABLE_TEMP); removeAllForTable(LobStorageFrontend.TABLE_RESULT); } }
@Override public void removeAllForTable(int tableId) { init(); try { String sql = "SELECT ID FROM " + LOBS + " WHERE TABLE = ?"; PreparedStatement prep = prepare(sql); prep.setInt(1, tableId); ResultSet rs = prep.executeQuery(); while (rs.next()) { removeLob(rs.getLong(1)); } reuse(sql, prep); } catch (SQLException e) { throw DbException.convert(e); } if (tableId == LobStorageFrontend.TABLE_ID_SESSION_VARIABLE) { removeAllForTable(LobStorageFrontend.TABLE_TEMP); removeAllForTable(LobStorageFrontend.TABLE_RESULT); } }
@Override public void setTable(ValueLobDb lob, int table) { long lobId = lob.getLobId(); assertNotHolds(conn.getSession()); // see locking discussion at the top synchronized (database) { synchronized (conn.getSession()) { try { init(); String sql = "UPDATE " + LOBS + " SET TABLE = ? WHERE ID = ?"; PreparedStatement prep = prepare(sql); prep.setInt(1, table); prep.setLong(2, lobId); prep.executeUpdate(); reuse(sql, prep); } catch (SQLException e) { throw DbException.convert(e); } } } }
@Override public void setTable(ValueLobDb lob, int table) { long lobId = lob.getLobId(); assertNotHolds(conn.getSession()); // see locking discussion at the top synchronized (database) { synchronized (conn.getSession()) { try { init(); String sql = "UPDATE " + LOBS + " SET TABLE = ? WHERE ID = ?"; PreparedStatement prep = prepare(sql); prep.setInt(1, table); prep.setLong(2, lobId); prep.executeUpdate(); reuse(sql, prep); } catch (SQLException e) { throw DbException.convert(e); } } } }
synchronized (conn.getSession()) { try { init(); long lobId = getNextLobId(); String sql = "INSERT INTO " + LOB_MAP + "(LOB, SEQ, POS, HASH, BLOCK) " +
synchronized (conn.getSession()) { try { init(); ValueLobDb v = null; if(!old.isRecoveryReference()){
@Override public InputStream getInputStream(ValueLobDb lob, byte[] hmac, long byteCount) throws IOException { try { init(); assertNotHolds(conn.getSession()); // see locking discussion at the top synchronized (database) { synchronized (conn.getSession()) { long lobId = lob.getLobId(); return new LobInputStream(lobId, byteCount); } } } catch (SQLException e) { throw DbException.convertToIOException(e); } }
@Override public InputStream getInputStream(ValueLobDb lob, byte[] hmac, long byteCount) throws IOException { try { init(); assertNotHolds(conn.getSession()); // see locking discussion at the top synchronized (database) { synchronized (conn.getSession()) { long lobId = lob.getLobId(); return new LobInputStream(lobId, byteCount); } } } catch (SQLException e) { throw DbException.convertToIOException(e); } }