KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > cjdbc > driver > Savepoint


1 /**
2  * C-JDBC: Clustered JDBC.
3  * Copyright (C) 2002-2005 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Contact: c-jdbc@objectweb.org
6  *
7  * This library is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation; either version 2.1 of the License, or any later
10  * version.
11  *
12  * This library is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15  * for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, write to the Free Software Foundation,
19  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20  *
21  * Initial developer(s): Jean-Bernard van Zuylen.
22  * Contributor(s): ______________________.
23  */

24
25 package org.objectweb.cjdbc.driver;
26
27 import java.sql.SQLException JavaDoc;
28
29 /**
30  * This class defines a Savepoint
31  *
32  * @author <a HREF="mailto:jbvanzuylen@transwide.com">Jean-Bernard van Zuylen
33  * </a>
34  * @version 1.0
35  */

36 public class Savepoint implements java.sql.Savepoint JavaDoc
37 {
38   private int savepointId;
39   
40   private String JavaDoc savepointName;
41   
42   /**
43    * Creates a new un-named <code>Savepoint</code> object
44    *
45    * @param savepointId the generated ID for this savepoint
46    */

47   public Savepoint(int savepointId)
48   {
49     this.savepointId = savepointId;
50   }
51   
52   /**
53    * Creates a new named <code>Savepoint</code> object
54    *
55    * @param savepointName the name of the savepoint
56    */

57   public Savepoint(String JavaDoc savepointName)
58   {
59     this.savepointName = savepointName;
60   }
61   
62   /**
63    * @see java.sql.Savepoint#getSavepointId()
64    */

65   public int getSavepointId() throws SQLException JavaDoc
66   {
67     if (this.savepointName != null)
68       throw new SQLException JavaDoc("This is a named savepoint");
69     
70     return this.savepointId;
71   }
72   
73   /**
74    * @see java.sql.Savepoint#getSavepointName()
75    */

76   public String JavaDoc getSavepointName() throws SQLException JavaDoc
77   {
78     if (this.savepointName == null)
79       throw new SQLException JavaDoc("This is an unnamed savepoint");
80     
81     return this.savepointName;
82   }
83 }
84
Popular Tags