RowSet< R > Class Template Reference

Row set iterator. More...

#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;
 }

Definition at line 111 of file sqlite_wrap.hh.


Constructor & Destructor Documentation

RowSet ( PreparedStatementPtr  stmt  )  [inline]

Definition at line 113 of file sqlite_wrap.hh.

RowSet (  )  [inline]

Definition at line 118 of file sqlite_wrap.hh.


Member Function Documentation

bool AtEnd (  )  [inline]

Definition at line 130 of file sqlite_wrap.hh.

R& operator* (  )  [inline]

Definition at line 121 of file sqlite_wrap.hh.

RowSet<R>& operator++ (  )  [inline]

Definition at line 124 of file sqlite_wrap.hh.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines

Generated on 1 Mar 2018 for OpenStructure by  doxygen 1.6.1