本文整理汇总了C++中DatabaseResult::next方法的典型用法代码示例。如果您正苦于以下问题:C++ DatabaseResult::next方法的具体用法?C++ DatabaseResult::next怎么用?C++ DatabaseResult::next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseResult
的用法示例。
在下文中一共展示了DatabaseResult::next方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getDbConnection
std::vector<Device *> ControllerDatabaseFactory::fetchDevices(
const std::size_t id ) const {
std::vector<Device *> devices;
DatabaseStatement * statement;
DatabaseResult * result;
DatabaseResultRow * row;
std::string query;
std::size_t deviceId;
query =
"SELECT id "
"FROM devices "
"WHERE controller_id = ";
query = query + std::to_string(id);
statement = getDbConnection()->createStatement(query);
if( statement != nullptr ) {
result = statement->execute();
if( result != nullptr ) {
while( result->hasNext() ) {
row = result->next();
deviceId = static_cast<std::size_t>(
atol(row->getColumn(0).c_str()));
devices.push_back(mDeviceContainer->get(deviceId));
delete row;
}
delete result;
}
delete statement;
}
return ( devices );
}
示例2: ValueType
std::vector<ValueType *> ValueTypeDatabaseFactory::fetchAll( void ) {
DatabaseStatement * statement;
DatabaseResult * result;
DatabaseResultRow * row;
std::vector<ValueType *> types;
std::string strId;
long bufferId;
std::size_t id;
std::string identifier;
std::string name;
std::string description;
std::string regex;
statement = getDbConnection()->createStatement(
"SELECT *"
"FROM value_types"
);
if( statement != nullptr ) {
result = statement->execute();
if( result != nullptr ) {
while( result->hasNext() ) {
row = result->next();
strId = row->getColumn(0);
identifier = row->getColumn(1);
regex = row->getColumn(2);
name = row->getColumn(3);
description = row->getColumn(4);
bufferId = atol(strId.c_str());
id = static_cast<std::size_t>(bufferId);
types.push_back(
new ValueType(id,identifier,name,description,regex)
);
delete row;
}
delete result;
}
delete statement;
}
return ( types );
}