01: /**
02: * Sequoia: Database clustering technology.
03: * Copyright (C) 2002-2004 French National Institute For Research In Computer
04: * Science And Control (INRIA).
05: * Copyright (C) 2005 AmicoSoft, Inc. dba Emic Networks
06: * Contact: sequoia@continuent.org
07: *
08: * Licensed under the Apache License, Version 2.0 (the "License");
09: * you may not use this file except in compliance with the License.
10: * You may obtain a copy of the License at
11: *
12: * http://www.apache.org/licenses/LICENSE-2.0
13: *
14: * Unless required by applicable law or agreed to in writing, software
15: * distributed under the License is distributed on an "AS IS" BASIS,
16: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17: * See the License for the specific language governing permissions and
18: * limitations under the License.
19: *
20: * Initial developer(s): Jean-Bernard van Zuylen.
21: * Contributor(s): ______________________.
22: */package org.continuent.sequoia.driver;
23:
24: import java.sql.SQLException;
25:
26: /**
27: * This class defines a Savepoint
28: *
29: * @author <a href="mailto:jbvanzuylen@transwide.com">Jean-Bernard van Zuylen
30: * </a>
31: * @version 1.0
32: */
33: public class Savepoint implements java.sql.Savepoint {
34: private int savepointId;
35:
36: private String savepointName;
37:
38: /**
39: * Creates a new un-named <code>Savepoint</code> object
40: *
41: * @param savepointId the generated ID for this savepoint
42: */
43: public Savepoint(int savepointId) {
44: this .savepointId = savepointId;
45: }
46:
47: /**
48: * Creates a new named <code>Savepoint</code> object
49: *
50: * @param savepointName the name of the savepoint
51: */
52: public Savepoint(String savepointName) {
53: this .savepointName = savepointName;
54: }
55:
56: /**
57: * @see java.sql.Savepoint#getSavepointId()
58: */
59: public int getSavepointId() throws SQLException {
60: if (this .savepointName != null)
61: throw new SQLException("This is a named savepoint");
62:
63: return this .savepointId;
64: }
65:
66: /**
67: * @see java.sql.Savepoint#getSavepointName()
68: */
69: public String getSavepointName() throws SQLException {
70: if (this .savepointName == null)
71: throw new SQLException("This is an unnamed savepoint");
72:
73: return this.savepointName;
74: }
75: }
|