예제 #1
0
 private Connection getRawConnectionForReadOnly(Options options) {
   try {
     Connection conn = target.getConnection(options);
     conn.setAutoCommit(true);
     conn.setReadOnly(true);
     if (session.getTransactionIsolation() != 0) {
       if (conn.getTransactionIsolation() != session.getTransactionIsolation()) {
         conn.setTransactionIsolation(session.getTransactionIsolation());
       }
     }
     return conn;
   } catch (SQLException e) {
     throw DbException.convert(e);
   }
 }
예제 #2
0
 public ConnectionHolder(Session session) {
   Database database = session.getDatabase();
   JdbcRepository repository = (JdbcRepository) database.getRepository();
   this.session = session;
   this.trace = database.getTrace(Trace.TRANSACTION);
   this.target = repository.getConnectionProvider();
   String mode = database.getSettings().transactionMode;
   this.holderStrategy = transactionMode(mode);
 }
예제 #3
0
 private void cloneLobs(Value[] values) {
   for (int i = 0; i < values.length; i++) {
     Value v = values[i];
     Value v2 = v.copyToResult();
     if (v2 != v) {
       session.addTemporaryLob(v2);
       values[i] = v2;
     }
   }
 }
예제 #4
0
 @Override
 public synchronized Connection getConnection(Options options) {
   Connection conn;
   if (session.getAutoCommit()) {
     conn = getRawConnection(options);
   } else {
     conn = getConnectionWithStrategy(options);
   }
   return conn;
 }
예제 #5
0
 /**
  * Construct a local result object.
  *
  * @param session the session
  * @param expressions the expression array
  * @param visibleColumnCount the number of visible columns
  */
 public LocalResult(Session session, Expression[] expressions, int visibleColumnCount) {
   this.session = session;
   if (session == null) {
     this.maxMemoryRows = Integer.MAX_VALUE;
   } else {
     this.maxMemoryRows = session.getDatabase().getMaxMemoryRows();
   }
   rows = New.arrayList(20);
   this.visibleColumnCount = visibleColumnCount;
   rowId = -1;
   this.expressions = expressions;
 }
예제 #6
0
 /**
  * @param options
  * @return
  * @throws SQLException
  */
 private Connection getRawConnection(Options options) throws DbException {
   Connection conn = target.getConnection(options);
   try {
     if (conn.getAutoCommit() != session.getAutoCommit()) {
       conn.setAutoCommit(session.getAutoCommit());
     }
     if (session.getTransactionIsolation() != 0) {
       if (conn.getTransactionIsolation() != session.getTransactionIsolation()) {
         conn.setTransactionIsolation(session.getTransactionIsolation());
       }
     }
     if (conn.isReadOnly() != session.isReadOnly()) {
       conn.setReadOnly(session.isReadOnly());
     }
   } catch (Exception e) {
     throw DbException.convert(e);
   }
   return conn;
 }