当前位置: 首页>>代码示例>>C++>>正文


C++ VoltDBEngine::executeQuery方法代码示例

本文整理汇总了C++中VoltDBEngine::executeQuery方法的典型用法代码示例。如果您正苦于以下问题:C++ VoltDBEngine::executeQuery方法的具体用法?C++ VoltDBEngine::executeQuery怎么用?C++ VoltDBEngine::executeQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在VoltDBEngine的用法示例。


在下文中一共展示了VoltDBEngine::executeQuery方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: castToEngine

/**
 * Executes a plan fragment with the given parameter set.
 * @param engine_ptr the VoltDBEngine pointer
 * @param plan_fragment_id ID of the plan fragment to be executed.
 * @return error code
*/
SHAREDLIB_JNIEXPORT jint JNICALL Java_org_voltdb_jni_ExecutionEngine_nativeExecutePlanFragment (
        JNIEnv *env,
        jobject obj,
        jlong engine_ptr,
        jlong plan_fragment_id,
        jint outputDependencyId,
        jint inputDependencyId,
        jlong txnId,
        jlong lastCommittedTxnId,
        jlong undoToken) {
    VOLT_DEBUG("nativeExecutePlanFragment() start");
    VoltDBEngine *engine = castToEngine(engine_ptr);
    Topend *topend = static_cast<JNITopend*>(engine->getTopend())->updateJNIEnv(env);
    assert(engine);
    try {
        updateJNILogProxy(engine); //JNIEnv pointer can change between calls, must be updated
        engine->setUndoToken(undoToken);
        engine->resetReusedResultOutputBuffer();
        NValueArray &params = engine->getParameterContainer();
        Pool *stringPool = engine->getStringPool();
        const int paramcnt = deserializeParameterSet(engine->getParameterBuffer(), engine->getParameterBufferCapacity(), params, engine->getStringPool());
        engine->setUsedParamcnt(paramcnt);
        const int retval = engine->executeQuery(plan_fragment_id, outputDependencyId, inputDependencyId, params, txnId, lastCommittedTxnId, true, true);
        stringPool->purge();
        return retval;
    } catch (FatalException e) {
        topend->crashVoltDB(e);
    }
    return org_voltdb_jni_ExecutionEngine_ERRORCODE_ERROR;
}
开发者ID:arpitmit,项目名称:h-store,代码行数:36,代码来源:voltdbjni.cpp

示例2: serialize_in

/**
 * Executes multiple plan fragments with the given parameter sets and gets the results.
 * @param pointer the VoltDBEngine pointer
 * @param plan_fragment_ids ID of the plan fragment to be executed.
 * @param outputBuffer buffer to be filled with the tables.
 * @param outputCapacity maximum number of bytes to write to buffer.
 * @return error code
*/
SHAREDLIB_JNIEXPORT jint JNICALL Java_org_voltdb_jni_ExecutionEngine_nativeExecutePlanFragments
(JNIEnv *env,
        jobject obj,
        jlong engine_ptr,
        jint num_fragments,
        jlongArray plan_fragment_ids,
        jlongArray input_dep_ids,
        jlong spHandle,
        jlong lastCommittedSpHandle,
        jlong uniqueId,
        jlong undoToken) {
    //VOLT_DEBUG("nativeExecutePlanFragments() start");

    // setup
    VoltDBEngine *engine = castToEngine(engine_ptr);
    assert(engine);
    Topend *topend = static_cast<JNITopend*>(engine->getTopend())->updateJNIEnv(env);
    try {
        updateJNILogProxy(engine); //JNIEnv pointer can change between calls, must be updated
        engine->resetReusedResultOutputBuffer();
        engine->setUndoToken(undoToken);
        static_cast<JNITopend*>(engine->getTopend())->updateJNIEnv(env);
        Pool *stringPool = engine->getStringPool();

        // fragment info
        int batch_size = num_fragments;
        assert (batch_size <= MAX_BATCH_COUNT);
        jlong* fragment_ids_buffer = engine->getBatchFragmentIdsContainer();
        env->GetLongArrayRegion(plan_fragment_ids, 0, batch_size, fragment_ids_buffer);

        // all fragments' parameters are in this buffer
        ReferenceSerializeInput serialize_in(engine->getParameterBuffer(), engine->getParameterBufferCapacity());
        NValueArray &params = engine->getParameterContainer();

        // count failures
        int failures = 0;

        for (int i = 0; i < batch_size; ++i) {
            int cnt = serialize_in.readShort();
            if (cnt < 0) {
                throwFatalException("parameter count is negative: %d", cnt);
            }
            assert (cnt < MAX_PARAM_COUNT);
            deserializeParameterSetCommon(cnt, serialize_in, params, stringPool);

            engine->setUsedParamcnt(cnt);

            int64_t input_dep_id = -1;
            if (input_dep_ids) {
                env->GetLongArrayRegion(input_dep_ids, i, 1, (jlong*) &input_dep_id);
            }

            // success is 0 and error is 1.
            if (engine->executeQuery(fragment_ids_buffer[i], 1, static_cast<int32_t>(input_dep_id),
                                     params, spHandle, lastCommittedSpHandle, uniqueId, i == 0,
                                     i == (batch_size - 1)))
            {
                ++failures;
            }
        }

        // cleanup
        stringPool->purge();
        engine->resizePlanCache();

        if (failures > 0)
            return org_voltdb_jni_ExecutionEngine_ERRORCODE_ERROR;
        else
            return org_voltdb_jni_ExecutionEngine_ERRORCODE_SUCCESS;
    } catch (FatalException e) {
        topend->crashVoltDB(e);
    }
    return org_voltdb_jni_ExecutionEngine_ERRORCODE_ERROR;
}
开发者ID:DimensionSoftware,项目名称:voltdb,代码行数:82,代码来源:voltdbjni.cpp


注:本文中的VoltDBEngine::executeQuery方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。