コード例 #1
0
ファイル: JE_Table.java プロジェクト: HashZhang/tddl
  @Override
  public ISchematicCursor getCursor(
      ExecutionContext executionContext, IndexMeta indexMeta, String actualTableName)
      throws TddlException {
    Database db = getDatabase(actualTableName);
    if (db == null) {
      throw new TddlException("table don't contains indexName:" + actualTableName);
    }
    ITransaction txn = executionContext.getTransaction();
    CursorConfig cc = CursorConfig.DEFAULT;
    LockMode lm = LockMode.DEFAULT;
    if (txn != null) {
      com.sleepycat.je.TransactionConfig _config = ((JE_Transaction) txn).config;
      if (_config.getReadUncommitted()) {
        cc = CursorConfig.READ_UNCOMMITTED;
        lm = LockMode.READ_UNCOMMITTED;
      } else if (_config.getReadCommitted()) {
        cc = CursorConfig.READ_COMMITTED;
        // lm = LockMode.READ_COMMITTED;
      }
    } else {

      cc = CursorConfig.READ_COMMITTED;
    }
    JE_Cursor je_cursor =
        new JE_Cursor(
            indexMeta, db.openCursor(txn == null ? null : ((JE_Transaction) txn).txn, cc), lm);
    if (txn != null) {
      ((JE_Transaction) txn).addCursor(je_cursor);
    }
    return new SchematicCursor(
        je_cursor, je_cursor.getiCursorMeta(), ExecUtils.getOrderBy(indexMeta));
  }
コード例 #2
0
ファイル: JE_Table.java プロジェクト: HashZhang/tddl
 public ISchematicCursor getCursor(
     ITransaction txn, IndexMeta indexMeta, String isolation, String actualTableName)
     throws TddlException {
   Database db = getDatabase(actualTableName);
   if (db == null) {
     throw new TddlException("table don't contains indexName:" + actualTableName);
   }
   CursorConfig cc = CursorConfig.DEFAULT;
   LockMode lm = LockMode.DEFAULT;
   if (txn != null) {
     com.sleepycat.je.TransactionConfig _config = ((JE_Transaction) txn).config;
     if (_config.getReadUncommitted()) {
       cc = CursorConfig.READ_UNCOMMITTED;
       lm = LockMode.READ_UNCOMMITTED;
     } else if (_config.getReadCommitted()) {
       cc = CursorConfig.READ_COMMITTED;
       // lm = LockMode.READ_COMMITTED;
     }
   } else {
     if (Isolation.READ_COMMITTED.equals(isolation)) {
       cc = CursorConfig.READ_COMMITTED;
       // lm = LockMode.READ_COMMITTED;//not support
     } else if (Isolation.READ_UNCOMMITTED.equals(isolation)) {
       cc = CursorConfig.READ_UNCOMMITTED;
       lm = LockMode.READ_UNCOMMITTED;
     } else if (Isolation.REPEATABLE_READ.equals(isolation)) {
       // default
     } else if (Isolation.SERIALIZABLE.equals(isolation)) {
       // txn_config
     }
   }
   JE_Cursor je_cursor =
       new JE_Cursor(
           indexMeta, db.openCursor(txn == null ? null : ((JE_Transaction) txn).txn, cc), lm);
   if (txn != null) {
     ((JE_Transaction) txn).addCursor(je_cursor);
   }
   return new SchematicCursor(
       je_cursor, je_cursor.getiCursorMeta(), ExecUtils.getOrderBy(indexMeta));
 }