1 21 22 package org.apache.derby.impl.sql.compile; 23 24 import org.apache.derby.iapi.services.sanity.SanityManager; 25 26 import org.apache.derby.iapi.sql.execute.ConstantAction; 27 28 import org.apache.derby.iapi.error.StandardException; 29 30 34 35 public class SavepointNode extends DDLStatementNode 36 { 37 private String savepointName; private int savepointStatementType; 40 48 49 public void init( 50 Object objectName, 51 Object savepointStatementType) 52 throws StandardException 53 { 54 initAndCheck(null); 55 this.savepointName = (String ) objectName; 56 this.savepointStatementType = ((Integer ) savepointStatementType).intValue(); 57 58 if (SanityManager.DEBUG) 59 { 60 if (this.savepointStatementType > 3 || this.savepointStatementType < 1) 61 { 62 SanityManager.THROWASSERT( 63 "Unexpected value for savepointStatementType = " + this.savepointStatementType + ". Expected value between 1-3"); 64 } 65 } 66 } 67 68 74 75 public String toString() 76 { 77 if (SanityManager.DEBUG) 78 { 79 String tempString = "savepointName: " + "\n" + savepointName + "\n"; 80 tempString = tempString + "savepointStatementType: " + "\n" + savepointStatementType + "\n"; 81 return super.toString() + tempString; 82 } 83 else 84 { 85 return ""; 86 } 87 } 88 89 public String statementToString() 90 { 91 if (savepointStatementType == 1) 92 return "SAVEPOINT"; 93 else if (savepointStatementType == 2) 94 return "ROLLBACK WORK TO SAVEPOINT"; 95 else 96 return "RELEASE TO SAVEPOINT"; 97 } 98 99 107 public boolean needsSavepoint() 108 { 109 return false; 110 } 111 112 114 119 public ConstantAction makeConstantAction() throws StandardException 120 { 121 return( 122 getGenericConstantActionFactory().getSavepointConstantAction( 123 savepointName, 124 savepointStatementType)); 125 } 126 } 127 | Popular Tags |