1 21 22 package org.apache.derby.client.am; 23 24 import org.apache.derby.shared.common.reference.SQLState; 25 26 import java.sql.SQLException ; 27 28 public class Savepoint implements java.sql.Savepoint { 29 31 int savepointId_ = 0; 32 String savepointName_ = null; 33 Agent agent_; 34 35 37 Savepoint(Agent agent, String savepointName) { 39 agent_ = agent; 40 savepointName_ = savepointName; 41 } 42 43 Savepoint(Agent agent, int savepointId) { 45 agent_ = agent; 46 savepointId_ = savepointId; 47 } 48 49 51 public int getSavepointId() throws SQLException { 52 if (savepointId_ != 0) { 53 return savepointId_; 54 } else { 55 throw new SqlException(agent_.logWriter_, 56 new ClientMessageId(SQLState.NO_ID_FOR_NAMED_SAVEPOINT)).getSQLException(); 57 } 58 } 59 60 public String getSavepointName() throws SQLException { 61 if (savepointName_ != null) { 62 return savepointName_; 63 } else { 64 throw new SqlException(agent_.logWriter_, 65 new ClientMessageId(SQLState.NO_NAME_FOR_UNNAMED_SAVEPOINT)).getSQLException(); 66 } 67 } 68 } 69 | Popular Tags |