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


C++ Statement::done方法代码示例

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


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

示例1: getProcessParams

void DatabaseSubsystem::getProcessParams(Session& session, ProcessPtr process)
{
    string paramName, paramValue;
    Statement stmt = (session <<
        "SELECT param_name, param_value FROM process_param WHERE process_id = ?",
        use(process->processID), range(0, 1), into(paramName), into(paramValue));
    while (!stmt.done()) {
        if (stmt.execute() == 1) {
            process->parameters[paramName] = paramValue;
        }
    }
}
开发者ID:Spencerx,项目名称:openBliSSART,代码行数:12,代码来源:DatabaseSubsystem.cpp

示例2: getResponseLabels

void DatabaseSubsystem::getResponseLabels(Session& session,
                                          ResponsePtr& response)
{
    int objectID;
    int labelID;
    Statement stmt = (session <<
        "SELECT object_id, label_id FROM response_label WHERE response_id = ?",
        use(response->responseID), range(0, 1), into(objectID), into(labelID));
    while (!stmt.done()) {
        if (stmt.execute() == 1)
            response->labels[objectID] = labelID;
    }
}
开发者ID:Spencerx,项目名称:openBliSSART,代码行数:13,代码来源:DatabaseSubsystem.cpp

示例3: getAvailableFeatures

void DatabaseSubsystem::getAvailableFeatures(Session& session,
    const map<int, int>& clObjMap, FeatureSet& featureSet)
{
    int ddType;
    string featureName;
    double featureParam1, featureParam2, featureParam3;

    featureSet.clear();

    ostringstream clObjIDs;
    for (map<int, int>::const_iterator itr = clObjMap.begin();
         itr != clObjMap.end(); ++itr)
    {
        if (itr != clObjMap.begin()) {
            clObjIDs << ",";
        }
        clObjIDs << itr->first;
    }

    Statement stmt = (session <<
        "SELECT DISTINCT "
        "  data_descriptor.type, data_feature.feature_name, "
        "  data_feature.feature_param1, data_feature.feature_param2, "
        "  data_feature.feature_param3  "
        "FROM data_feature INNER JOIN data_descriptor "
        "ON (data_feature.descr_id = data_descriptor.descr_id) "
        "WHERE data_descriptor.descr_id IN ("
        "  SELECT descr_id FROM classification_object_data WHERE object_id IN ("
        << clObjIDs.str()
        << "))",
        range(0, 1),
        into(ddType), into(featureName), into(featureParam1), 
        into(featureParam2), into(featureParam3));

    while (!stmt.done()) {
        if (stmt.execute() == 1) {
            featureSet.add(FeatureDescriptor(featureName,
                (DataDescriptor::Type) ddType, featureParam1, featureParam2, 
                featureParam3));
        }
    }
}
开发者ID:Spencerx,项目名称:openBliSSART,代码行数:42,代码来源:DatabaseSubsystem.cpp

示例4: getDataSet

DataSet DatabaseSubsystem::getDataSet(ResponsePtr response,
                                      const FeatureSet& featureSet)
{
    RWLock::ScopedLock lock(_dbLock);

    DataSet result;
    Session session = getSession();
    session.begin();

    // This map counts the number of values for each feature.
    map<FeatureDescriptor, int> dataCount;

    for (map<int, int>::const_iterator labelItr = response->labels.begin();
        labelItr != response->labels.end(); ++labelItr)
    {
        int ddType;
        string featureName;
        double featureParam1, featureParam2, featureParam3;
        double featureValue;

        DataPoint point;
        point.objectID = labelItr->first;
        point.classLabel = labelItr->second;

        Statement stmt = (session <<
            "SELECT data_descriptor.type, data_feature.feature_name, "
            "  data_feature.feature_param1, data_feature.feature_param2, "
            "  data_feature.feature_param3, data_feature.feature_value "
            "FROM data_feature INNER JOIN data_descriptor "
            "ON (data_feature.descr_id = data_descriptor.descr_id) "
            "WHERE data_descriptor.descr_id IN ("
            "  SELECT descr_id FROM classification_object_data "
            "  WHERE object_id = ?"
            ")",
            use(labelItr->first),
            range(0, 1),
            into(ddType), into(featureName), 
            into(featureParam1), into(featureParam2), into(featureParam3), 
            into(featureValue)
        );

        while (!stmt.done()) {
            if (stmt.execute() == 1)
            {
                FeatureDescriptor featureDescr(featureName,
                    (DataDescriptor::Type) ddType, featureParam1, 
                    featureParam2, featureParam3);
                if (featureSet.has(featureDescr)) {
                    point.components[featureDescr] = featureValue;
                    ++dataCount[featureDescr];
                }
            }
        }

        // Reject "empty" data points.
        if (!point.components.empty())
            result.push_back(point);
    }
    session.commit();

    if (dataCount.size() > 0) {
        map<FeatureDescriptor, int>::const_iterator itr = dataCount.begin();
        int firstCount = itr->second;
        for (; itr != dataCount.end(); ++itr) {
            if (itr->second != firstCount) {
                throw Poco::RuntimeException("Feature count mismatch: " +
                    itr->first.toString());
            }
        }
    }

    return result;
}
开发者ID:Spencerx,项目名称:openBliSSART,代码行数:73,代码来源:DatabaseSubsystem.cpp


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