01: package com.mockrunner.mock.jdbc;
02:
03: import java.sql.SQLException;
04: import java.sql.Savepoint;
05:
06: /**
07: * Mock implementation of <code>Savepoint</code>.
08: */
09: public class MockSavepoint implements Savepoint {
10: private static int idCount = 0;
11:
12: private String name;
13: private int id;
14: private int number;
15: private boolean released;
16: private boolean rolledback;
17:
18: public MockSavepoint(int number) {
19: this ("", number);
20: }
21:
22: public MockSavepoint(String name, int number) {
23: this .name = name;
24: this .id = idCount++;
25: this .number = number;
26: released = false;
27: rolledback = false;
28: }
29:
30: public int getSavepointId() throws SQLException {
31: return id;
32: }
33:
34: public String getSavepointName() throws SQLException {
35: return name;
36: }
37:
38: public int getNumber() {
39: return number;
40: }
41:
42: public boolean isReleased() {
43: return released;
44: }
45:
46: /**
47: * @deprecated use {@link #isRolledBack}
48: */
49: public boolean isRollbacked() {
50: return isRolledBack();
51: }
52:
53: public boolean isRolledBack() {
54: return rolledback;
55: }
56:
57: public void setReleased(boolean released) {
58: this .released = released;
59: }
60:
61: /**
62: * @deprecated use {@link #setRolledBack}
63: */
64: public void setRollbacked(boolean rollbacked) {
65: setRolledBack(rollbacked);
66: }
67:
68: public void setRolledBack(boolean rollbacked) {
69: this.rolledback = rollbacked;
70: }
71: }
|