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 363 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

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

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 396 of file query_backend.h.

void cyclus::QueryResult::Reset ( )

Definition at line 374 of file query_backend.h.

Member Data Documentation

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

names of each field returned by a query

Definition at line 366 of file query_backend.h.

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

ordered results of a query

Definition at line 372 of file query_backend.h.

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

types of each field returned by a query.

Definition at line 369 of file query_backend.h.

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