CYCLUS
Public Member Functions | Public Attributes | List of all members
cyclus::QueryResult Class Reference

Detailed Description

Meta data and results of a query.

Definition at line 427 of file query_backend.h.

#include <query_backend.h>

Public Member Functions

template<class T >
GetVal (std::string field, int row=0)
 
void Reset ()
 

Public Attributes

std::vector< std::string > fields
 
std::vector< QueryRowrows
 
std::vector< DbTypestypes
 

Member Function Documentation

◆ GetVal()

template<class T >
T cyclus::QueryResult::GetVal ( std::string  field,
int  row = 0 
)
inline

Convenience method for retrieving a value from a specific row and named field (column).

The caller is responsible for specifying a valid templated type to cast to. Example use:

QueryResult qr = ...
for (int i = 0; i < qr.rows.size(); ++i) {
std::cout << qr.GetVal<int>("field1", i) << "\n";
std::cout << qr.GetVal<double>("field2", i) << "\n";
std::cout << qr.GetVal<std::string>("field3", i) << "\n";
}

Definition at line 460 of file query_backend.h.

◆ Reset()

void cyclus::QueryResult::Reset ( )
inline

Definition at line 438 of file query_backend.h.

Member Data Documentation

◆ fields

std::vector<std::string> cyclus::QueryResult::fields

names of each field returned by a query

Definition at line 430 of file query_backend.h.

◆ rows

std::vector<QueryRow> cyclus::QueryResult::rows

ordered results of a query

Definition at line 436 of file query_backend.h.

◆ types

std::vector<DbTypes> cyclus::QueryResult::types

types of each field returned by a query.

Definition at line 433 of file query_backend.h.


The documentation for this class was generated from the following file: