lintel 0.2.0
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
lintel::db::Result Class Reference

#include <Result.h>

Classes

class  ConstIterator
 
class  Iterator
 

Public Member Functions

Iterator begin ()
 
Iterator end ()
 
ConstIterator begin () const
 
ConstIterator end () const
 
 Result ()=default
 
 ~Result ()
 
 Result (std::shared_ptr< postgresql::Result > result)
 
 Result (std::shared_ptr< sqlite::Result > result)
 
std::string getValue (int row, int attribute) const
 
Arguments & of (std::size_t pos)
 
const Arguments & of (std::size_t pos) const
 
int getNumOfAttributes () const
 
int getSize () const
 

Detailed Description

Unified query result wrapping either a PostgreSQL or SQLite result. Supports random-access iteration over rows, each row being an Arguments object.

Constructor & Destructor Documentation

◆ Result() [1/3]

lintel::db::Result::Result ( )
default

Default constructor.

◆ ~Result()

lintel::db::Result::~Result ( )

Destructor.

◆ Result() [2/3]

lintel::db::Result::Result ( std::shared_ptr< postgresql::Result >  result)
explicit

Constructs a result wrapping a PostgreSQL result.

Parameters
resultthe PostgreSQL result shared pointer

◆ Result() [3/3]

lintel::db::Result::Result ( std::shared_ptr< sqlite::Result >  result)
explicit

Constructs a result wrapping an SQLite result.

Parameters
resultthe SQLite result shared pointer

Member Function Documentation

◆ begin() [1/2]

Iterator lintel::db::Result::begin ( )
inline
Returns
mutable iterator to the first row

◆ begin() [2/2]

ConstIterator lintel::db::Result::begin ( ) const
inline
Returns
const iterator to the first row

◆ end() [1/2]

Iterator lintel::db::Result::end ( )
inline
Returns
mutable iterator past the last row

◆ end() [2/2]

ConstIterator lintel::db::Result::end ( ) const
inline
Returns
const iterator past the last row

◆ getNumOfAttributes()

int lintel::db::Result::getNumOfAttributes ( ) const
Returns
the number of columns/attributes in the result

◆ getSize()

int lintel::db::Result::getSize ( ) const
Returns
the number of rows in the result

◆ getValue()

std::string lintel::db::Result::getValue ( int  row,
int  attribute 
) const

Retrieves a value at the given row and attribute.

Parameters
rowthe row index
attributethe attribute (column) index
Returns
the value as a string

◆ of() [1/2]

Arguments & lintel::db::Result::of ( std::size_t  pos)

Accesses a row as Arguments (mutable).

Parameters
posthe row index
Returns
reference to the Arguments for that row

◆ of() [2/2]

const Arguments & lintel::db::Result::of ( std::size_t  pos) const

Accesses a row as Arguments (const).

Parameters
posthe row index
Returns
const reference to the Arguments for that row

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