1 24 25 package org.objectweb.cjdbc.console.text.commands.sqlconsole; 26 27 import java.io.IOException ; 28 import java.sql.Connection ; 29 import java.sql.Savepoint ; 30 31 import org.objectweb.cjdbc.common.i18n.ConsoleTranslate; 32 import org.objectweb.cjdbc.console.text.ConsoleException; 33 import org.objectweb.cjdbc.console.text.commands.ConsoleCommand; 34 import org.objectweb.cjdbc.console.text.module.VirtualDatabaseConsole; 35 36 41 public class SetSavePoint extends ConsoleCommand 42 { 43 44 49 public SetSavePoint(VirtualDatabaseConsole module) 50 { 51 super(module); 52 } 53 54 57 public void parse(String commandText) throws IOException , ConsoleException 58 { 59 if (commandText.trim().length() == 0) 60 { 61 console.printError(getUsage()); 62 return; 63 } 64 String name = commandText.trim(); 65 66 Connection connection = ((VirtualDatabaseConsole) module).getConnection(); 67 try 68 { 69 Savepoint savePoint = connection.setSavepoint(name); 70 ((VirtualDatabaseConsole) module).addSavePoint(savePoint); 71 console.println(ConsoleTranslate.get("sql.command.savepoint.saved", name)); 72 } 73 catch (Exception e) 74 { 75 console.printError(ConsoleTranslate.get("sql.display.exception", e), e); 76 } 77 } 78 79 82 public String getCommandName() 83 { 84 return "savepoint"; 85 } 86 87 90 public String getCommandParameters() 91 { 92 return ConsoleTranslate.get("sql.command.savepoint.params"); 93 } 94 95 98 public String getCommandDescription() 99 { 100 return ConsoleTranslate.get("sql.command.savepoint.description"); 101 } 102 } | Popular Tags |