Package org.h2.jdbc
Class JdbcSavepoint
- java.lang.Object
-
- org.h2.message.TraceObject
-
- org.h2.jdbc.JdbcSavepoint
-
- All Implemented Interfaces:
java.sql.Savepoint
public final class JdbcSavepoint extends TraceObject implements java.sql.Savepoint
A savepoint is a point inside a transaction to where a transaction can be rolled back. The tasks that where done before the savepoint are not rolled back in this case.
-
-
Field Summary
Fields Modifier and Type Field Description private JdbcConnection
conn
private java.lang.String
name
private int
savepointId
private static java.lang.String
SYSTEM_SAVEPOINT_PREFIX
-
Fields inherited from class org.h2.message.TraceObject
ARRAY, BLOB, CALLABLE_STATEMENT, CLOB, CONNECTION, DATA_SOURCE, DATABASE_META_DATA, PARAMETER_META_DATA, PREPARED_STATEMENT, RESULT_SET, RESULT_SET_META_DATA, SAVEPOINT, SQLXML, STATEMENT, trace, XA_DATA_SOURCE, XID
-
-
Constructor Summary
Constructors Constructor Description JdbcSavepoint(JdbcConnection conn, int savepointId, java.lang.String name, Trace trace, int id)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkValid()
(package private) static java.lang.String
getName(java.lang.String name, int id)
Get the savepoint name for this name or id.int
getSavepointId()
Get the generated id of this savepoint.java.lang.String
getSavepointName()
Get the name of this savepoint.(package private) void
release()
Release this savepoint.(package private) void
rollback()
Roll back to this savepoint.java.lang.String
toString()
INTERNAL-
Methods inherited from class org.h2.message.TraceObject
debugCode, debugCodeAssign, debugCodeCall, debugCodeCall, debugCodeCall, getNextId, getTraceId, getTraceObjectName, isDebugEnabled, isInfoEnabled, logAndConvert, quote, quoteArray, quoteBigDecimal, quoteBytes, quoteDate, quoteIntArray, quoteMap, quoteTime, quoteTimestamp, setTrace, unsupported
-
-
-
-
Field Detail
-
SYSTEM_SAVEPOINT_PREFIX
private static final java.lang.String SYSTEM_SAVEPOINT_PREFIX
- See Also:
- Constant Field Values
-
savepointId
private final int savepointId
-
name
private final java.lang.String name
-
conn
private JdbcConnection conn
-
-
Constructor Detail
-
JdbcSavepoint
JdbcSavepoint(JdbcConnection conn, int savepointId, java.lang.String name, Trace trace, int id)
-
-
Method Detail
-
release
void release()
Release this savepoint. This method only set the connection to null and does not execute a statement.
-
getName
static java.lang.String getName(java.lang.String name, int id)
Get the savepoint name for this name or id. If the name is null, the id is used.- Parameters:
name
- the name (may be null)id
- the id- Returns:
- the savepoint name
-
rollback
void rollback()
Roll back to this savepoint.
-
checkValid
private void checkValid()
-
getSavepointId
public int getSavepointId() throws java.sql.SQLException
Get the generated id of this savepoint.- Specified by:
getSavepointId
in interfacejava.sql.Savepoint
- Returns:
- the id
- Throws:
java.sql.SQLException
-
getSavepointName
public java.lang.String getSavepointName() throws java.sql.SQLException
Get the name of this savepoint.- Specified by:
getSavepointName
in interfacejava.sql.Savepoint
- Returns:
- the name
- Throws:
java.sql.SQLException
-
toString
public java.lang.String toString()
INTERNAL- Overrides:
toString
in classjava.lang.Object
-
-