1 21 22 package org.apache.derby.impl.jdbc; 23 24 import org.apache.derby.impl.jdbc.EmbedConnection; 25 import org.apache.derby.impl.jdbc.ConnectionChild; 26 import org.apache.derby.impl.jdbc.Util; 27 28 import org.apache.derby.iapi.reference.SQLState; 29 30 import org.apache.derby.iapi.error.StandardException; 31 32 import java.sql.Savepoint ; 33 import java.sql.SQLException ; 34 35 51 final class EmbedSavepoint30 extends ConnectionChild 52 implements Savepoint { 53 54 private final String savepointName; 57 private final int savepointID; 58 59 69 EmbedSavepoint30(EmbedConnection conn, String name) 70 throws StandardException { 71 super(conn); 72 if (name == null) { 74 savepointName = "i." + conn.getLanguageConnection().getUniqueSavepointName(); 76 savepointID = conn.getLanguageConnection().getUniqueSavepointID(); 77 } else 78 { 79 savepointName = "e." + name; 80 savepointID = -1; 81 } 82 conn.getLanguageConnection().languageSetSavePoint(savepointName, this); 83 } 84 85 93 public int getSavepointId() throws SQLException { 94 if (savepointID == -1) 95 throw newSQLException(SQLState.NO_ID_FOR_NAMED_SAVEPOINT); 96 return savepointID; 97 } 98 99 107 public String getSavepointName() throws SQLException { 108 if (savepointID != -1) 109 throw newSQLException(SQLState.NO_NAME_FOR_UNNAMED_SAVEPOINT); 110 return savepointName.substring(2); 111 } 112 113 String getInternalName() { 115 return savepointName; 116 } 117 118 119 boolean sameConnection(EmbedConnection con) { 122 return (getEmbedConnection().getLanguageConnection() == con.getLanguageConnection()); 123 } 124 } 125 126 | Popular Tags |