当前位置: 首页>>代码示例>>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;未经允许,请勿转载。