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.SQLException ; 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 SetIsolation extends ConsoleCommand 42 { 43 44 49 public SetIsolation(VirtualDatabaseConsole module) 50 { 51 super(module); 52 } 53 54 57 public void parse(String commandText) throws IOException , ConsoleException 58 { 59 try 60 { 61 int isolation = new Integer (commandText.trim()).intValue(); 62 Connection connection = 63 ((VirtualDatabaseConsole)module).getConnection(); 64 connection.setTransactionIsolation(isolation); 65 console.println(ConsoleTranslate.get("sql.command.isolation.value", 66 isolation)); 67 } 68 catch (NumberFormatException e) 69 { 70 console.printError(getUsage()); 71 } 72 catch (SQLException e) 73 { 74 throw new ConsoleException(ConsoleTranslate.get("sql.command.isolation.failed"), e); 75 } 76 } 77 78 81 public String getCommandName() 82 { 83 return "setisolation"; 84 } 85 86 89 public String getCommandParameters() 90 { 91 return ConsoleTranslate.get("sql.command.isolation.params"); 92 } 93 94 97 public String getCommandDescription() 98 { 99 return ConsoleTranslate.get("sql.command.isolation.description"); 100 } 101 } | Popular Tags |