KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > in > co > daffodil > db > jdbc > DaffodilDBSavepoint


1 package in.co.daffodil.db.jdbc;
2
3 import java.sql.*;
4 import com.daffodilwoods.database.resource.*;
5
6 /**
7  * The representation of a savepoint, which is a point within
8  * the current transaction that can be referenced from the
9  * <code>Connection.rollback</code> method. When a transaction
10  * is rolled back to a savepoint all changes made after that
11  * savepoint are undone.
12  * <p>
13  * Savepoints can be either named or unnamed. Unnamed savepoints
14  * are identified by an ID generated by the underlying data source.
15  *
16  * @since 1.4
17  */

18 public class DaffodilDBSavepoint implements Savepoint {
19
20   private String JavaDoc savePointName;
21   private int savePointId;
22
23   public DaffodilDBSavepoint(String JavaDoc savePointName) {
24     this.savePointName = savePointName.toUpperCase();
25     savePointId = savePointName.hashCode();
26   }
27
28   /**
29    * Retrieves the generated ID for the savepoint that this
30    * <code>Savepoint</code> object represents.
31    * @return the numeric ID of this savepoint
32    * @exception SQLException if this is a named savepoint
33    * @since 1.4
34    */

35   public int getSavepointId() throws SQLException {
36     return savePointId;
37   }
38
39   /**
40    * Retrieves the name of the savepoint that this <code>Savepoint</code>
41    * object represents.
42    * @return the name of this savepoint
43    * @exception SQLException if this is an un-named savepoint
44    * @since 1.4
45    */

46   public String JavaDoc getSavepointName() throws SQLException {
47     return savePointName;
48   }
49 }
50
Popular Tags