OpenStructure
Public Member Functions
RowSet< R > Class Template Reference

#include <sqlite_wrap.hh>

Public Member Functions

 RowSet (PreparedStatementPtr stmt)
 
 RowSet ()
 
R & operator* ()
 
RowSet< R > & operator++ ()
 
bool AtEnd ()
 

Detailed Description

template<typename R>
class ost::db::RowSet< R >

Row set iterator.

Row set iterators let you iterate over a set of rows as returned by a select statements. The parametrisable type R is the type that should be used for each row. For the standard types such as int and strings, conversion routines are available. For your custom types, you have to write an overloaded version of SqlConvert()

PreparedStatementPtr ps=db->Prepare("select * from animals where num_legs=?");
ps->BindInt(num_legs)
for (RowSet<Animal> ani_it(ps); !ani_it.AtEnd(); ++ani_it) {
Animal& a=*ani_it;
std::cout << a.GetName() << std::endl;
}
boost::shared_ptr< PreparedStatement > PreparedStatementPtr
Definition: sqlite_wrap.hh:41

Definition at line 111 of file sqlite_wrap.hh.

Constructor & Destructor Documentation

◆ RowSet() [1/2]

RowSet ( PreparedStatementPtr  stmt)
inline

Definition at line 113 of file sqlite_wrap.hh.

◆ RowSet() [2/2]

RowSet ( )
inline

Definition at line 118 of file sqlite_wrap.hh.

Member Function Documentation

◆ AtEnd()

bool AtEnd ( )
inline

Definition at line 130 of file sqlite_wrap.hh.

◆ operator*()

R& operator* ( )
inline

Definition at line 121 of file sqlite_wrap.hh.

◆ operator++()

RowSet<R>& operator++ ( )
inline

Definition at line 124 of file sqlite_wrap.hh.


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