本文整理汇总了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;
}
}
}
示例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;
}
}
示例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));
}
}
}
示例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;
}