當前位置: 首頁>>代碼示例>>Java>>正文


Java IAffectRowCursor類代碼示例

本文整理匯總了Java中com.taobao.tddl.executor.cursor.IAffectRowCursor的典型用法代碼示例。如果您正苦於以下問題:Java IAffectRowCursor類的具體用法?Java IAffectRowCursor怎麽用?Java IAffectRowCursor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


IAffectRowCursor類屬於com.taobao.tddl.executor.cursor包,在下文中一共展示了IAffectRowCursor類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: handle

import com.taobao.tddl.executor.cursor.IAffectRowCursor; //導入依賴的package包/類
@Override
public ISchematicCursor handle(IDataNodeExecutor executor, ExecutionContext executionContext) throws TddlException {

    if (executionContext.getParams() != null && executionContext.getParams().isBatch()) {
        throw new ExecutorException("batch is not supported for :"
                                    + executionContext.getCurrentRepository().getClass());
    }

    long time = System.currentTimeMillis();
    IPut put = (IPut) executor;
    TableAndIndex ti = new TableAndIndex();
    buildTableAndMeta(put, ti, executionContext);

    int affect_rows = 0;
    ITransaction transaction = executionContext.getTransaction();
    ITable table = ti.table;
    IndexMeta meta = ti.index;

    try {
        if (transaction == null) {// 客戶端沒有用事務,這裏手動加上。
            throw new IllegalAccessError("txn is null");
        }
        affect_rows = executePut(executionContext, put, table, meta);
    } catch (Exception e) {
        time = Monitor.monitorAndRenewTime(Monitor.KEY1, Monitor.KEY2_TDDL_EXECUTE, Monitor.Key3Fail, time);
        throw new TddlNestableRuntimeException(e);
    }

    // 這裏返回key->value的方式的東西,類似Key=affectRow val=1 這樣的軟編碼
    IAffectRowCursor affectrowCursor = executionContext.getCurrentRepository()
        .getCursorFactory()
        .affectRowCursor(executionContext, affect_rows);

    time = Monitor.monitorAndRenewTime(Monitor.KEY1, Monitor.KEY2_TDDL_EXECUTE, Monitor.Key3Success, time);
    return affectrowCursor;

}
 
開發者ID:loye168,項目名稱:tddl5,代碼行數:38,代碼來源:PutHandlerCommon.java

示例2: getAffectRows

import com.taobao.tddl.executor.cursor.IAffectRowCursor; //導入依賴的package包/類
public int getAffectRows() throws SQLException {
    if (this.resultCursor.getCursor() instanceof IAffectRowCursor) {
        if (currentKVPair != null || next()) {
            Integer index = currentKVPair.getParentCursorMeta().getIndex(null, ResultCursor.AFFECT_ROW, null);

            return currentKVPair.getInteger(index);
        } else {
            return 0;
        }
    }

    return -1;

}
 
開發者ID:loye168,項目名稱:tddl5,代碼行數:15,代碼來源:TResultSet.java

示例3: handle

import com.taobao.tddl.executor.cursor.IAffectRowCursor; //導入依賴的package包/類
public ISchematicCursor handle(IDataNodeExecutor executor, ExecutionContext executionContext) throws TddlException {
    long time = System.currentTimeMillis();
    IPut put = (IPut) executor;

    buildTableAndMeta(put, executionContext);

    int affect_rows = 0;
    ITransaction transaction = executionContext.getTransaction();
    ITable table = executionContext.getTable();
    IndexMeta meta = executionContext.getMeta();
    boolean autoCommit = false;
    try {
        if (transaction == null) {// 客戶端沒有用事務,這裏手動加上。
            IRepository repo = executionContext.getCurrentRepository();
            if ("True".equalsIgnoreCase(repo.getRepoConfig().getProperty(RepositoryConfig.IS_TRANSACTIONAL))) {
                transaction = repo.beginTransaction(getDefalutTransactionConfig(repo));
                executionContext.setTransaction(transaction);
                autoCommit = true;
            }
        }
        affect_rows = executePut(executionContext, put, table, meta);
        if (autoCommit) {
            commit(executionContext, transaction);
        }
    } catch (Exception e) {
        time = Monitor.monitorAndRenewTime(Monitor.KEY1, Monitor.ServerPut, Monitor.Key3Fail, time);
        if (autoCommit) {
            rollback(executionContext, transaction);
        }
        throw new TddlException(e);
    }

    // 這裏返回key->value的方式的東西,類似Key=affectRow val=1 這樣的軟編碼
    IAffectRowCursor affectrowCursor = executionContext.getCurrentRepository()
        .getCursorFactory()
        .affectRowCursor(executionContext, affect_rows);

    time = Monitor.monitorAndRenewTime(Monitor.KEY1, Monitor.ServerPut, Monitor.Key3Success, time);
    return affectrowCursor;

}
 
開發者ID:beebeandwer,項目名稱:TDDL,代碼行數:42,代碼來源:PutHandlerCommon.java

示例4: handle

import com.taobao.tddl.executor.cursor.IAffectRowCursor; //導入依賴的package包/類
@Override
public ISchematicCursor handle(IDataNodeExecutor executor, ExecutionContext executionContext) throws TddlException {

    int size = OptimizerContext.getContext().getSchemaManager().getAllTables().size();

    OptimizerContext.getContext().getSchemaManager().reload();

    IAffectRowCursor c = executionContext.getCurrentRepository()
        .getCursorFactory()
        .affectRowCursor(executionContext, size);

    return c;
}
 
開發者ID:loye168,項目名稱:tddl5,代碼行數:14,代碼來源:ReloadSchemaHandler.java

示例5: executeUpdate

import com.taobao.tddl.executor.cursor.IAffectRowCursor; //導入依賴的package包/類
/**
 * 執行一個update語句
 * 
 * @param sqlAndParam
 * @return
 * @throws SQLException
 */
public IAffectRowCursor executeUpdate(ExecutionContext executionContext, IPut put, ITable table, IndexMeta meta)
                                                                                                                throws SQLException;
 
開發者ID:loye168,項目名稱:tddl5,代碼行數:10,代碼來源:GeneralQueryHandler.java

示例6: affectRowCursor

import com.taobao.tddl.executor.cursor.IAffectRowCursor; //導入依賴的package包/類
IAffectRowCursor affectRowCursor(ExecutionContext context, int affectRow) throws TddlException; 
開發者ID:loye168,項目名稱:tddl5,代碼行數:2,代碼來源:ICursorFactory.java


注:本文中的com.taobao.tddl.executor.cursor.IAffectRowCursor類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。