org.apache.derby.impl.jdbc
Class EmbedSavepoint30

java.lang.Object
  extended byorg.apache.derby.impl.jdbc.ConnectionChild
      extended byorg.apache.derby.impl.jdbc.EmbedSavepoint30
All Implemented Interfaces:
java.sql.Savepoint

final class EmbedSavepoint30
extends ConnectionChild
implements java.sql.Savepoint

This class implements the Savepoint interface from JDBC3.0 This allows to set, release, or rollback a transaction to designated Savepoints. Savepoints provide finer-grained control of transactions by marking intermediate points within a transaction. Once a savepoint has been set, the transaction can be rolled back to that savepoint without affecting preceding work.

Supports

See Also:
Savepoint

Field Summary
protected static boolean CLOSE
           
protected  InternalDriver factory
          Factory for JDBC objects to be created.
protected  EmbedConnection localConn
           
protected static boolean NOCLOSE
           
private  int savepointID
           
private  java.lang.String savepointName
           
 
Constructor Summary
(package private) EmbedSavepoint30(EmbedConnection conn, java.lang.String name)
           
 
Method Summary
protected  void commitIfAutoCommit()
          Perform a commit if autocommit is enabled.
protected  void commitIfNeeded()
          Perform a commit if one is needed.
protected  java.util.Calendar getCal()
          Get and save a unique calendar object for this JDBC object.
protected  java.lang.Object getConnectionSynchronization()
          Return an object to be used for connection synchronization.
 ContextManager getContextManager()
           
 Database getDatabase()
           
protected  EmbedConnection getEmbedConnection()
          Return a reference to the EmbedConnection
(package private)  java.lang.String getInternalName()
           
 int getSavepointId()
          Retrieves the generated ID for the savepoint that this Savepoint object represents.
 java.lang.String getSavepointName()
          Retrieves the name of the savepoint that this Savepoint object represents.
protected  java.sql.SQLException handleException(java.lang.Throwable t)
          Handle any exception.
protected  java.sql.SQLException handleException(java.lang.Throwable t, boolean close)
          Handle any exception.
protected  void needCommit()
          If Autocommit is on, note that a commit is needed.
protected  java.sql.SQLException newSQLException(java.lang.String messageId)
           
protected  java.sql.SQLException newSQLException(java.lang.String messageId, java.lang.Object arg1)
           
protected  java.sql.SQLException newSQLException(java.lang.String messageId, java.lang.Object arg1, java.lang.Object arg2)
           
protected  void restoreContextStack()
          Setup the context stack (a.k.a. context manager) for this connection.
(package private)  boolean sameConnection(EmbedConnection con)
           
protected  void setupContextStack()
          Setup the context stack (a.k.a. context manager) for this connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

savepointName

private final java.lang.String savepointName

savepointID

private final int savepointID

CLOSE

protected static final boolean CLOSE
See Also:
Constant Field Values

NOCLOSE

protected static final boolean NOCLOSE
See Also:
Constant Field Values

localConn

protected EmbedConnection localConn

factory

protected final InternalDriver factory
Factory for JDBC objects to be created.

Constructor Detail

EmbedSavepoint30

EmbedSavepoint30(EmbedConnection conn,
                 java.lang.String name)
           throws StandardException
Method Detail

getSavepointId

public int getSavepointId()
                   throws java.sql.SQLException
Retrieves the generated ID for the savepoint that this Savepoint object represents.

Specified by:
getSavepointId in interface java.sql.Savepoint
Returns:
the numeric ID of this savepoint
Throws:
java.sql.SQLException - if this is a named savepoint

getSavepointName

public java.lang.String getSavepointName()
                                  throws java.sql.SQLException
Retrieves the name of the savepoint that this Savepoint object represents.

Specified by:
getSavepointName in interface java.sql.Savepoint
Returns:
the name of this savepoint
Throws:
java.sql.SQLException - if this is an un-named savepoint

getInternalName

java.lang.String getInternalName()

sameConnection

boolean sameConnection(EmbedConnection con)

getEmbedConnection

protected final EmbedConnection getEmbedConnection()
Return a reference to the EmbedConnection


getConnectionSynchronization

protected final java.lang.Object getConnectionSynchronization()
Return an object to be used for connection synchronization.


handleException

protected final java.sql.SQLException handleException(java.lang.Throwable t)
                                               throws java.sql.SQLException
Handle any exception.

Throws:
java.sql.SQLException - thrown if can't handle
See Also:
EmbedConnection.handleException(java.lang.Throwable)

handleException

protected final java.sql.SQLException handleException(java.lang.Throwable t,
                                                      boolean close)
                                               throws java.sql.SQLException
Handle any exception.

Throws:
java.sql.SQLException - thrown if can't handle
See Also:
EmbedConnection.handleException(java.lang.Throwable)

needCommit

protected final void needCommit()
If Autocommit is on, note that a commit is needed.

See Also:
EmbedConnection.needCommit

commitIfNeeded

protected final void commitIfNeeded()
                             throws java.sql.SQLException
Perform a commit if one is needed.

Throws:
java.sql.SQLException - thrown on failure
See Also:
EmbedConnection.commitIfNeeded()

commitIfAutoCommit

protected final void commitIfAutoCommit()
                                 throws java.sql.SQLException
Perform a commit if autocommit is enabled.

Throws:
java.sql.SQLException - thrown on failure
See Also:
EmbedConnection.commitIfNeeded()

setupContextStack

protected final void setupContextStack()
                                throws java.sql.SQLException
Setup the context stack (a.k.a. context manager) for this connection.

Throws:
java.sql.SQLException - thrown on failure
See Also:
EmbedConnection.setupContextStack()

restoreContextStack

protected final void restoreContextStack()
                                  throws java.sql.SQLException
Setup the context stack (a.k.a. context manager) for this connection.

Throws:
java.sql.SQLException - thrown on failure
See Also:
EmbedConnection.restoreContextStack()

getContextManager

public ContextManager getContextManager()

getDatabase

public Database getDatabase()

getCal

protected java.util.Calendar getCal()
Get and save a unique calendar object for this JDBC object. No need to synchronize because multiple threads should not be using a single JDBC object. Even if they do there is only a small window where each would get its own Calendar for a single call.


newSQLException

protected java.sql.SQLException newSQLException(java.lang.String messageId)

newSQLException

protected java.sql.SQLException newSQLException(java.lang.String messageId,
                                                java.lang.Object arg1)

newSQLException

protected java.sql.SQLException newSQLException(java.lang.String messageId,
                                                java.lang.Object arg1,
                                                java.lang.Object arg2)

Built on Tue 2006-10-10 19:23:47+0200, from revision exported

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.