A logical pointer (input iterator) inside the query result of a Dv::Sql::Command. More...
#include <sqldb.h>
Public Member Functions | |
iterator & | operator++ () throw (std::logic_error) |
Make the iterator point to the next row in the result: prefix version. | |
iterator | operator++ (int) throw (std::logic_error) |
Make the iterator point to the next row in the result: postfix version. | |
std::vector< std::string > | operator* () const throw (std::logic_error) |
Dereference to the current row. | |
bool | operator== (const iterator &j) const |
Compare two iterators. | |
bool | operator!= (const iterator &j) const |
Compare two iterators. | |
std::string | operator() (unsigned int c) const throw (std::logic_error) |
Get the c'th column of the current row. | |
Command & | command () const |
The command associated with this iterator. | |
Private Types | |
enum | { END = -1, BEGIN = 0 } |
Private Member Functions | |
iterator (Command &command, int row) | |
Constructor. | |
Private Attributes | |
Command & | cmd_ |
int | row_ |
Current row number, may be BEGIN, END or any number in [0,cmd_.nrows_[. | |
Friends | |
class | Command |
A logical pointer (input iterator) inside the query result of a Dv::Sql::Command.
A valid iterator in the range [begin,end[ points to a row of the query result.
Its value type is the type of a row in the query result, i.e. a vector of strings.
Definition at line 566 of file sqldb.h.
Dv::Sql::Command::iterator::iterator | ( | Command & | command, | |
int | row | |||
) | [inline, private] |
iterator& Dv::Sql::Command::iterator::operator++ | ( | ) | throw (std::logic_error) |
Make the iterator point to the next row in the result: prefix version.
iterator Dv::Sql::Command::iterator::operator++ | ( | int | ) | throw (std::logic_error) [inline] |
std::vector<std::string> Dv::Sql::Command::iterator::operator* | ( | ) | const throw (std::logic_error) |
Dereference to the current row.
"NULL"
. bool Dv::Sql::Command::iterator::operator== | ( | const iterator & | j | ) | const [inline] |
Compare two iterators.
Two iterators are equal if they point to the same row in the query result of the same Dv::Sql::Command.
j | operator to compare with. |
bool Dv::Sql::Command::iterator::operator!= | ( | const iterator & | j | ) | const [inline] |
std::string Dv::Sql::Command::iterator::operator() | ( | unsigned int | c | ) | const throw (std::logic_error) |
Get the c'th
column of the current row.
Example
MySql::Db db(...); std::string name; Sql::Command query("select * from person where name = "); query << name; if (q.exec()) for (Sql::Command::iterator i=q.begin(); i!=q.end(); ++i) cout << i(0) << "\t" << i(1) << endl;
Command& Dv::Sql::Command::iterator::command | ( | ) | const [inline] |
Command& Dv::Sql::Command::iterator::cmd_ [private] |
Definition at line 613 of file sqldb.h.
Referenced by command(), and operator==().
int Dv::Sql::Command::iterator::row_ [private] |
Current row number, may be BEGIN, END or any number in [0,cmd_.nrows_[.
Definition at line 615 of file sqldb.h.
Referenced by operator==().
dvmysql-1.0.3 | [17 November, 2010] |