/** * Creates a savepoint with the given name in the current transaction * and returns the new <code>Savepoint</code> object that represents it. * * @param name a <code>String</code> containing the name of the savepoint * @return the new <code>Savepoint</code> object * @exception SQLException if a database access error occurs * or this <code>Connection</code> object is currently in * auto-commit mode * @see Savepoint * @since 1.4 */ public Savepoint setSavepoint(String name) throws SQLException { checkClosed(); if (!haveMinimumServerVersion("8.0")) throw new PSQLException(GT.tr("Server versions prior to 8.0 do not support savepoints."), PSQLState.NOT_IMPLEMENTED); if (getAutoCommit()) throw new PSQLException(GT.tr("Cannot establish a savepoint in auto-commit mode."), PSQLState.NO_ACTIVE_SQL_TRANSACTION); PSQLSavepoint savepoint = new PSQLSavepoint(name); // Note we can't use execSQLUpdate because we don't want // to suppress BEGIN. Statement stmt = createStatement(); stmt.executeUpdate("SAVEPOINT " + savepoint.getPGName()); stmt.close(); return savepoint; }
/** * Creates an unnamed savepoint in the current transaction and * returns the new <code>Savepoint</code> object that represents it. * * @return the new <code>Savepoint</code> object * @exception SQLException if a database access error occurs * or this <code>Connection</code> object is currently in * auto-commit mode * @see Savepoint * @since 1.4 */ public Savepoint setSavepoint() throws SQLException { checkClosed(); if (!haveMinimumServerVersion("8.0")) throw new PSQLException(GT.tr("Server versions prior to 8.0 do not support savepoints."), PSQLState.NOT_IMPLEMENTED); if (getAutoCommit()) throw new PSQLException(GT.tr("Cannot establish a savepoint in auto-commit mode."), PSQLState.NO_ACTIVE_SQL_TRANSACTION); PSQLSavepoint savepoint = new PSQLSavepoint(savepointId++); // Note we can't use execSQLUpdate because we don't want // to suppress BEGIN. Statement stmt = createStatement(); stmt.executeUpdate("SAVEPOINT " + savepoint.getPGName()); stmt.close(); return savepoint; }
/** * Creates a savepoint with the given name in the current transaction * and returns the new <code>Savepoint</code> object that represents it. * * @param name a <code>String</code> containing the name of the savepoint * @return the new <code>Savepoint</code> object * @exception SQLException if a database access error occurs * or this <code>Connection</code> object is currently in * auto-commit mode * @see Savepoint * @since 1.4 */ public Savepoint setSavepoint(String name) throws SQLException { if (!haveMinimumServerVersion("8.0")) throw new PSQLException(GT.tr("Server versions prior to 8.0 do not support savepoints."), PSQLState.NOT_IMPLEMENTED); if (getAutoCommit()) throw new PSQLException(GT.tr("Cannot establish a savepoint in auto-commit mode."), PSQLState.NO_ACTIVE_SQL_TRANSACTION); PSQLSavepoint savepoint = new PSQLSavepoint(name); // Note we can't use execSQLUpdate because we don't want // to suppress BEGIN. Statement stmt = createStatement(); stmt.executeUpdate("SAVEPOINT " + savepoint.getPGName()); stmt.close(); return savepoint; }
/** * Creates an unnamed savepoint in the current transaction and * returns the new <code>Savepoint</code> object that represents it. * * @return the new <code>Savepoint</code> object * @exception SQLException if a database access error occurs * or this <code>Connection</code> object is currently in * auto-commit mode * @see Savepoint * @since 1.4 */ public Savepoint setSavepoint() throws SQLException { if (!haveMinimumServerVersion("8.0")) throw new PSQLException(GT.tr("Server versions prior to 8.0 do not support savepoints."), PSQLState.NOT_IMPLEMENTED); if (getAutoCommit()) throw new PSQLException(GT.tr("Cannot establish a savepoint in auto-commit mode."), PSQLState.NO_ACTIVE_SQL_TRANSACTION); PSQLSavepoint savepoint = new PSQLSavepoint(savepointId++); // Note we can't use execSQLUpdate because we don't want // to suppress BEGIN. Statement stmt = createStatement(); stmt.executeUpdate("SAVEPOINT " + savepoint.getPGName()); stmt.close(); return savepoint; }
/** * Creates an unnamed savepoint in the current transaction and * returns the new <code>Savepoint</code> object that represents it. * * @return the new <code>Savepoint</code> object * @exception SQLException if a database access error occurs * or this <code>Connection</code> object is currently in * auto-commit mode * @see Savepoint * @since 1.4 */ public Savepoint setSavepoint() throws SQLException { checkClosed(); if (!haveMinimumServerVersion("8.0")) throw new PSQLException(GT.tr("Server versions prior to 8.0 do not support savepoints."), PSQLState.NOT_IMPLEMENTED); if (getAutoCommit()) throw new PSQLException(GT.tr("Cannot establish a savepoint in auto-commit mode."), PSQLState.NO_ACTIVE_SQL_TRANSACTION); PSQLSavepoint savepoint = new PSQLSavepoint(savepointId++); // Note we can't use execSQLUpdate because we don't want // to suppress BEGIN. Statement stmt = createStatement(); stmt.executeUpdate("SAVEPOINT " + savepoint.getPGName()); stmt.close(); return savepoint; }
/** * Creates a savepoint with the given name in the current transaction * and returns the new <code>Savepoint</code> object that represents it. * * @param name a <code>String</code> containing the name of the savepoint * @return the new <code>Savepoint</code> object * @exception SQLException if a database access error occurs * or this <code>Connection</code> object is currently in * auto-commit mode * @see Savepoint * @since 1.4 */ public Savepoint setSavepoint(String name) throws SQLException { checkClosed(); if (!haveMinimumServerVersion("8.0")) throw new PSQLException(GT.tr("Server versions prior to 8.0 do not support savepoints."), PSQLState.NOT_IMPLEMENTED); if (getAutoCommit()) throw new PSQLException(GT.tr("Cannot establish a savepoint in auto-commit mode."), PSQLState.NO_ACTIVE_SQL_TRANSACTION); PSQLSavepoint savepoint = new PSQLSavepoint(name); // Note we can't use execSQLUpdate because we don't want // to suppress BEGIN. Statement stmt = createStatement(); stmt.executeUpdate("SAVEPOINT " + savepoint.getPGName()); stmt.close(); return savepoint; }