public Collection flush(Collection states, JDBCStore store) { Connection conn = store.getConnection(); try { PreparedStatementManager psMgr = newPreparedStatementManager(store, conn); return flush(states, store, psMgr); } finally { try { conn.close(); } catch (SQLException se) {} } }
public Collection flush(Collection states, JDBCStore store) { Connection conn = store.getConnection(); try { PreparedStatementManager psMgr = newPreparedStatementManager(store, conn); return flush(states, store, psMgr); } finally { try { conn.close(); } catch (SQLException se) {} } }
public Collection flush(Collection states, JDBCStore store) { Connection conn = store.getConnection(); try { PreparedStatementManager psMgr = newPreparedStatementManager(store, conn); return flush(states, store, psMgr); } finally { try { conn.close(); } catch (SQLException se) {} } }
public Collection flush(Collection states, JDBCStore store) { Connection conn = store.getConnection(); try { PreparedStatementManager psMgr = newPreparedStatementManager(store, conn); return flush(states, store, psMgr); } finally { try { conn.close(); } catch (SQLException se) {} } }
public Collection flush(Collection states, JDBCStore store) { Connection conn = store.getConnection(); try { PreparedStatementManager psMgr = newPreparedStatementManager(store, conn); return flush(states, store, psMgr); } finally { try { conn.close(); } catch (SQLException se) {} } }
public InputStream getLOBStream(JDBCStore store, ResultSet rs, int column) throws SQLException { DelegatingConnection conn = (DelegatingConnection)store .getConnection(); conn.setAutoCommit(false); LargeObjectManager lom = getLargeObjectManager(conn); if (rs.getInt(column) != -1) { LargeObject lo = lom.open(rs.getInt(column)); return lo.getInputStream(); } else { return null; } }
public InputStream getLOBStream(JDBCStore store, ResultSet rs, int column) throws SQLException { DelegatingConnection conn = (DelegatingConnection)store .getConnection(); conn.setAutoCommit(false); LargeObjectManager lom = getLargeObjectManager(conn); if (rs.getInt(column) != -1) { LargeObject lo = lom.open(rs.getInt(column)); return lo.getInputStream(); } else { return null; } }
public InputStream getLOBStream(JDBCStore store, ResultSet rs, int column) throws SQLException { DelegatingConnection conn = (DelegatingConnection)store .getConnection(); conn.setAutoCommit(false); LargeObjectManager lom = getLargeObjectManager(conn); if (rs.getInt(column) != -1) { LargeObject lo = lom.open(rs.getInt(column)); return lo.getInputStream(); } else { return null; } }
/** * <P>Return the connection to use based on the type of sequence. This * connection will automatically be closed; do not close it.</P> * * @return If the sequence type is <code>TYPE_TRANSACTIONAL</code> or * <code>TYPE_CONTIGUOUS</code> the connection from the {@link StoreManager} * will be returned. * * <P>Otherwise a new connection will be obtained using DataSource2 from the * current configuration. In this case autocommit is set to false prior to * returning the connection.</P> */ protected Connection getConnection(JDBCStore store) throws SQLException { if (type == TYPE_TRANSACTIONAL || type == TYPE_CONTIGUOUS) { // Also increments ref count. return store.getConnection(); } else { JDBCConfiguration conf = store.getConfiguration(); DataSource ds = conf.getDataSource2(store.getContext()); Connection conn = ds.getConnection(); if (conn.getAutoCommit()) conn.setAutoCommit(false); return conn; } }
public InputStream getLOBStream(JDBCStore store, ResultSet rs, int column) throws SQLException { DelegatingConnection conn = (DelegatingConnection)store .getConnection(); conn.setAutoCommit(false); LargeObjectManager lom = getLargeObjectManager(conn); if (rs.getInt(column) != -1) { LargeObject lo = lom.open(rs.getInt(column)); return lo.getInputStream(); } else { return null; } }
/** * <P>Return the connection to use based on the type of sequence. This * connection will automatically be closed; do not close it.</P> * * @return If the sequence type is <code>TYPE_TRANSACTIONAL</code> or * <code>TYPE_CONTIGUOUS</code> the connection from the {@link StoreManager} * will be returned. * * <P>Otherwise a new connection will be obtained using DataSource2 from the * current configuration. In this case autocommit is set to false prior to * returning the connection.</P> */ protected Connection getConnection(JDBCStore store) throws SQLException { if (type == TYPE_TRANSACTIONAL || type == TYPE_CONTIGUOUS) { // Also increments ref count. return store.getConnection(); } else { JDBCConfiguration conf = store.getConfiguration(); DataSource ds = conf.getDataSource2(store.getContext()); Connection conn = ds.getConnection(); if (conn.getAutoCommit()) conn.setAutoCommit(false); return conn; } }
/** * <P>Return the connection to use based on the type of sequence. This * connection will automatically be closed; do not close it.</P> * * @return If the sequence type is <code>TYPE_TRANSACTIONAL</code> or * <code>TYPE_CONTIGUOUS</code> the connection from the {@link StoreManager} * will be returned. * * <P>Otherwise a new connection will be obtained using DataSource2 from the * current configuration. In this case autocommit is set to false prior to * returning the connection.</P> */ protected Connection getConnection(JDBCStore store) throws SQLException { if (type == TYPE_TRANSACTIONAL || type == TYPE_CONTIGUOUS) { // Also increments ref count. return store.getConnection(); } else { JDBCConfiguration conf = store.getConfiguration(); DataSource ds = conf.getDataSource2(store.getContext()); Connection conn = ds.getConnection(); if (conn.getAutoCommit()) conn.setAutoCommit(false); return conn; } }
public StoredProcedureQueryExecutor(StoredProcedureQuery q, List<QueryResultMapping> resultMapping, List<Class<?>> classes) { QueryContext ctx = q.getContext(); _resultMappings = resultMapping; _resultClasses = classes; // Look for the named Stored Procedure in the database String procName = ctx.getQueryString(); _proc = getStoredProcedure(_store.getConnection(), _store.getDBDictionary(), procName); if (_proc == null) { throw new RuntimeException("Can not find stored procedure " + procName); } }
public StoredProcedureQueryExecutor(StoredProcedureQuery q, List<QueryResultMapping> resultMapping, List<Class<?>> classes) { QueryContext ctx = q.getContext(); _resultMappings = resultMapping; _resultClasses = classes; // Look for the named Stored Procedure in the database String procName = ctx.getQueryString(); _proc = getStoredProcedure(_store.getConnection(), _store.getDBDictionary(), procName); if (_proc == null) { throw new RuntimeException("Can not find stored procedure " + procName); } }
public int getCount(JDBCStore store) throws SQLException { Connection conn = null; PreparedStatement stmnt = null; ResultSet rs = null; try { SQLBuffer sql = toSelectCount(); conn = store.getConnection(); stmnt = prepareStatement(conn, sql, null, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY, false); rs = executeQuery(conn, stmnt, sql, false, store); return getCount(rs); } finally { if (rs != null) try { rs.close(); } catch (SQLException se) {} if (stmnt != null) try { stmnt.close(); } catch (SQLException se) {} if (conn != null) try { conn.close(); } catch (SQLException se) {} } }
public InputStream getLOBStream(JDBCStore store, ResultSet rs, int column) throws SQLException { DelegatingConnection conn = (DelegatingConnection)store .getConnection(); conn.setAutoCommit(false); LargeObjectManager lom = ((PGConnection)conn.getInnermostDelegate()) .getLargeObjectAPI(); if (rs.getInt(column) != -1) { LargeObject lo = lom.open(rs.getInt(column)); return lo.getInputStream(); } else { return null; } }
/** * Return the connection to use based on the type of sequence. This * connection will automatically be closed; do not close it. */ protected Connection getConnection(JDBCStore store) throws SQLException { if (type == TYPE_TRANSACTIONAL || type == TYPE_CONTIGUOUS) return store.getConnection(); else if (suspendInJTA()) { try { TransactionManager tm = getConfiguration() .getManagedRuntimeInstance().getTransactionManager(); _outerTransaction.set(tm.suspend()); tm.begin(); return store.getConnection(); } catch (Exception e) { throw new StoreException(e); } } else { JDBCConfiguration conf = store.getConfiguration(); DataSource ds = conf.getDataSource2(store.getContext()); Connection conn = ds.getConnection(); if (conn.getAutoCommit()) conn.setAutoCommit(false); return conn; } }
private void insertPostgresBlob(Row row, Column col, JDBCStore store, Object ob) throws SQLException { if (ob != null) { col.setType(Types.INTEGER); DelegatingConnection conn = (DelegatingConnection)store .getConnection(); try { conn.setAutoCommit(false); LargeObjectManager lom = getLargeObjectManager(conn); // The create method is valid in versions previous to 8.3 // in 8.3 this method is deprecated, use createLO int oid = lom.create(); LargeObject lo = lom.open(oid, LargeObjectManager.WRITE); OutputStream os = lo.getOutputStream(); copy((InputStream)ob, os); lo.close(); row.setInt(col, oid); } catch (IOException ioe) { throw new StoreException(ioe); } finally { conn.close(); } } else { row.setInt(col, -1); } }
private void insertPostgresBlob(Row row, Column col, JDBCStore store, Object ob) throws SQLException { if (ob != null) { col.setType(Types.INTEGER); DelegatingConnection conn = (DelegatingConnection)store .getConnection(); try { conn.setAutoCommit(false); LargeObjectManager lom = getLargeObjectManager(conn); // The create method is valid in versions previous to 8.3 // in 8.3 this method is deprecated, use createLO int oid = lom.create(); LargeObject lo = lom.open(oid, LargeObjectManager.WRITE); OutputStream os = lo.getOutputStream(); copy((InputStream)ob, os); lo.close(); row.setInt(col, oid); } catch (IOException ioe) { throw new StoreException(ioe); } finally { conn.close(); } } else { row.setInt(col, -1); } }
private void insertPostgresBlob(Row row, Column col, JDBCStore store, Object ob) throws SQLException { if (ob != null) { col.setType(Types.INTEGER); DelegatingConnection conn = (DelegatingConnection)store .getConnection(); try { conn.setAutoCommit(false); LargeObjectManager lom = getLargeObjectManager(conn); // The create method is valid in versions previous to 8.3 // in 8.3 this method is deprecated, use createLO int oid = lom.create(); LargeObject lo = lom.open(oid, LargeObjectManager.WRITE); OutputStream os = lo.getOutputStream(); copy((InputStream)ob, os); lo.close(); row.setInt(col, oid); } catch (IOException ioe) { throw new StoreException(ioe); } finally { conn.close(); } } else { row.setInt(col, -1); } }