# QueryResult.hpp

This File On Github
Ask A Question

API: latest
module: oatpp
#include "oatpp/orm/QueryResult.hpp"

# QueryResult

Result of DB query.

namespace oatpp { namespace orm { 
  class QueryResult {}
}}

# Methods

Return Type Name Summary
[none] ~QueryResult Virtual destructor.
std::shared_ptr<Connection> getConnection Get DB connection associated with this result.
bool isSuccess Check if the query was successful.
oatpp::String getErrorMessage Get error message in case isSuccess() == false
v_int64 getPosition Get result read position.
v_int64 getKnownCount Get result entries count in the case it's known.
bool hasMoreToFetch Check if there is more data to fetch.
oatpp::Void fetch Multiple implementations:
  1. Fetch result entries.
  2. Fetch result entries.

# QueryResult::~QueryResult

Virtual destructor.

virtual ~QueryResult() = default

# QueryResult::getConnection

Get DB connection associated with this result.

  • @return

virtual std::shared_ptr<Connection> getConnection() const = 0

# QueryResult::isSuccess

Check if the query was successful.

  • @return

virtual bool isSuccess() const = 0

# QueryResult::getErrorMessage

Get error message in case isSuccess() == false

  • @return

virtual oatpp::String getErrorMessage() const = 0

# QueryResult::getPosition

Get result read position.

  • @return

virtual v_int64 getPosition() const = 0

# QueryResult::getKnownCount

Get result entries count in the case it's known.

  • @return - [0..N] - in case known. -1 - otherwise.

virtual v_int64 getKnownCount() const = 0

# QueryResult::hasMoreToFetch

Check if there is more data to fetch.

  • @return

virtual bool hasMoreToFetch() const = 0

# QueryResult::fetch

  1. Fetch result entries.
    • @param resultType - wanted output type.
    • @param count - how many entries to fetch. Use -1 to fetch all.
    • @return - oatpp::Void.
    virtual oatpp::Void fetch(const oatpp::Type* const resultType, v_int64 count) = 0
    
  2. Fetch result entries.
    • @tparam Wrapper - output type.
    • @param count - how many entries to fetch. Use -1 to fetch all.
    • @return - Wrapper.
    template<class Wrapper>
    Wrapper fetch(v_int64 count = -1)