matador::result< T > Class Template Reference

Represents a sql query result. More...

#include <result.hpp>

Public Types

typedef std::function< T *()> t_creator_func
 
typedef result_iterator< T > iterator
 

Public Member Functions

 result (const result &x)=delete
 
resultoperator= (const result &x)=delete
 
 result ()=default
 
 result (matador::detail::result_impl *impl)
 
 result (matador::detail::result_impl *impl, const T &prototype)
 
 result (result &&x) noexcept
 
resultoperator= (result &&x) noexcept
 
iterator begin ()
 
iterator end ()
 
bool empty () const
 
std::size_t size () const
 
void creator (const t_creator_func &creator_func)
 
void close ()
 

Friends

class result_iterator< T >
 

Detailed Description

template<class T>
class matador::result< T >

Represents a sql query result.

This class is used as a iterable result of a sql select query. Once such a query is executed one can iterate the result and each row is deserialized as the object of type T

Template Parameters
TThe object type of the result

Member Typedef Documentation

◆ iterator

template<class T >
typedef result_iterator<T> matador::result< T >::iterator

Shortcut to the iterator type

◆ t_creator_func

template<class T >
typedef std::function<T*()> matador::result< T >::t_creator_func

Shortcut to a creator function for the object type

Constructor & Destructor Documentation

◆ result() [1/4]

template<class T >
matador::result< T >::result ( )
default

Empty result

◆ result() [2/4]

template<class T >
matador::result< T >::result ( matador::detail::result_impl *  impl)
inlineexplicit

Creates a result initialized by the given result implementation

Parameters
implResult implementation

◆ result() [3/4]

template<class T >
matador::result< T >::result ( matador::detail::result_impl *  impl,
const T &  prototype 
)
inline

Creates a result initialized by the given result implementation and the given row prototype containing all expected columns.

Parameters
implResult implementation
prototypeThe row prototype

◆ result() [4/4]

template<class T >
matador::result< T >::result ( result< T > &&  x)
inlinenoexcept

Copy moves a result from given result

Parameters
xThe result ro move

Member Function Documentation

◆ begin()

template<class T >
iterator matador::result< T >::begin ( )
inline

Returns the first object of the result set

Returns
Iterator to the first object

◆ creator()

template<class T >
void matador::result< T >::creator ( const t_creator_func creator_func)
inline

Sets a creator function to create a custom object

Parameters
creator_funcThe custom creator function

◆ empty()

template<class T >
bool matador::result< T >::empty ( ) const
inline

Returns true if the result set is empty

Returns
True on empty result set

◆ end()

template<class T >
iterator matador::result< T >::end ( )
inline

Returns the last element of the result set

Returns
Iterator to the last element

◆ operator=()

template<class T >
result & matador::result< T >::operator= ( result< T > &&  x)
inlinenoexcept

Assignment move constructor for given result

Parameters
xThe result ro move
Returns
Reference to this

◆ size()

template<class T >
std::size_t matador::result< T >::size ( ) const
inline

Returns the size of the result set

Returns
Size of the result set

The documentation for this class was generated from the following file:
  • matador/sql/result.hpp