1 24 25 package com.mckoi.database.interpret; 26 27 import com.mckoi.database.*; 28 import java.util.ArrayList ; 29 import java.util.List ; 30 31 36 37 public class CompleteTransaction extends Statement { 38 39 String command; 41 42 43 45 public void prepare() throws DatabaseException { 46 command = (String ) cmd.getObject("command"); 47 } 48 49 public Table evaluate() throws DatabaseException, TransactionException { 50 51 DatabaseQueryContext context = new DatabaseQueryContext(database); 52 53 if (command.equals("commit")) { 54 database.commit(); 57 return FunctionTable.resultTable(context, 0); 64 } 65 else if (command.equals("rollback")) { 66 database.rollback(); 68 return FunctionTable.resultTable(context, 0); 69 } 70 else { 71 throw new Error ("Unrecognised transaction completion command."); 72 } 73 74 } 75 76 77 } 78 | Popular Tags |