Public Member Functions | |
Result (const RawResult &raw) | |
const std::vector< std::string > & | cols () const |
const std::vector< CrateDataType > & | colTypes () const |
double | duration () const |
const std::string & | errorString () const |
bool | hasError () const |
operator bool () const | |
const RawResult & | rawResult () const |
Record | record (int pos) const |
int | recordSize () const |
int | rowCount () const |
const std::vector< std::string > & | rows () const |
The class Result encapsulates the reply of a Crate HTTP endpoint request. In contrast to RawResult it parses the reply and provides convenience function to access the result's information directly.
The following code for example shows how to iterate over all returned rows of a query:
|
explicit |
Constructs a result based on the raw result raw.
const std::vector< std::string > & CppCrate::Result::cols | ( | ) | const |
Returns the query's column names.
const std::vector< CrateDataType > & CppCrate::Result::colTypes | ( | ) | const |
Returns the query's column types.
double CppCrate::Result::duration | ( | ) | const |
Returns the query's duration.
const std::string & CppCrate::Result::errorString | ( | ) | const |
Returns the error string.
bool CppCrate::Result::hasError | ( | ) | const |
Returns whether the result has an error.
|
explicit |
Returns whether the result is valid.
const RawResult & CppCrate::Result::rawResult | ( | ) | const |
Returns the raw result on which this result is based on. Use
to get the HTTP endpoint's original reply.
Record CppCrate::Result::record | ( | int | pos | ) | const |
Returns the record on the position pos. If pos is outside the record's boundaries an empty record is returned.
int CppCrate::Result::recordSize | ( | ) | const |
Returns the amount of records that can be fetched using record().
int CppCrate::Result::rowCount | ( | ) | const |
Returns the query's row count.
const std::vector< std::string > & CppCrate::Result::rows | ( | ) | const |
Returns the query's rows.