1 29 30 package com.caucho.sql; 31 32 import com.caucho.config.ConfigException; 33 import com.caucho.util.L10N; 34 35 import java.sql.Connection ; 36 37 40 public class ConnectionConfig { 41 private static final L10N L = new L10N(ConnectionConfig.class); 42 43 private int _isolation = -1; 44 private boolean _readOnly; 45 private String _catalog; 46 47 50 public void setTransactionIsolation(String name) 51 throws ConfigException 52 { 53 if ("none".equals(name)) 54 _isolation = Connection.TRANSACTION_NONE; 55 else if ("read-committed".equals(name)) 56 _isolation = Connection.TRANSACTION_READ_COMMITTED; 57 else if ("read-uncommitted".equals(name)) 58 _isolation = Connection.TRANSACTION_READ_UNCOMMITTED; 59 else if ("repeatable-read".equals(name)) 60 _isolation = Connection.TRANSACTION_REPEATABLE_READ; 61 else if ("serializable".equals(name)) 62 _isolation = Connection.TRANSACTION_SERIALIZABLE; 63 else 64 throw new ConfigException(L.l("'{0}' is an unknown transaction isolation.", 65 name)); 66 } 67 68 71 public int getTransactionIsolation() 72 { 73 return _isolation; 74 } 75 76 79 public void setReadOnly(boolean isReadOnly) 80 { 81 _readOnly = isReadOnly; 82 } 83 84 87 public boolean isReadOnly() 88 { 89 return _readOnly; 90 } 91 92 95 public void setCatalog(String catalog) 96 { 97 _catalog = catalog; 98 } 99 100 103 public String getCatalog() 104 { 105 return _catalog; 106 } 107 } 108 | Popular Tags |