Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

Dv::Sql::Command::iterator Class Reference

A logical pointer (input iterator) inside the query result of a Dv::Sql::Command. More...

#include <sqldb.h>

Collaboration diagram for Dv::Sql::Command::iterator:

Collaboration graph
[legend]
List of all members.

Public Member Functions

iteratoroperator++ () throw (Exception)
 Make the iterator point to the next row in the result: prefix version.

iterator operator++ (int)
 Make the iterator point to the next row in the result: postfix version.

std::vector< std::string > operator * () const throw (Exception)
 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 (Exception)
 Non standard operator: get c'th column of current row.

Commandcommand () const
 Return command associated with iterator.


Private Types

enum  { END = -1, BEGIN = 0 }

Private Member Functions

 iterator (Command &cmd, int r)

Private Attributes

Commandcmd_
int row_

Friends

class Command
 Friend.


Detailed Description

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 (classes like Dv::Int can be used to convert to numeric types, see dvutil).

Definition at line 408 of file sqldb.h.


Member Enumeration Documentation

anonymous enum [private]
 

Enumeration values:
END 
BEGIN 

Definition at line 449 of file sqldb.h.


Constructor & Destructor Documentation

Dv::Sql::Command::iterator::iterator Command cmd,
int  r
[inline, private]
 

Definition at line 454 of file sqldb.h.

References cmd_, and row_.


Member Function Documentation

iterator& Dv::Sql::Command::iterator::operator++  )  throw (Exception)
 

Make the iterator point to the next row in the result: prefix version.

iterator Dv::Sql::Command::iterator::operator++ int   )  [inline]
 

Make the iterator point to the next row in the result: postfix version.

Definition at line 417 of file sqldb.h.

std::vector<std::string> Dv::Sql::Command::iterator::operator *  )  const throw (Exception)
 

Dereference to the current row.

NULL is represented by the std::string ``NULL''.

bool Dv::Sql::Command::iterator::operator== const iterator j  )  const [inline]
 

Compare two iterators.

Definition at line 425 of file sqldb.h.

References cmd_, and row_.

bool Dv::Sql::Command::iterator::operator!= const iterator j  )  const [inline]
 

Compare two iterators.

Definition at line 428 of file sqldb.h.

References cmd_, and row_.

std::string Dv::Sql::Command::iterator::operator() unsigned int  c  )  const throw (Exception)
 

Non standard operator: get c'th column of 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]
 

Return command associated with iterator.

Definition at line 447 of file sqldb.h.

References cmd_.


Friends And Related Function Documentation

friend class Command [friend]
 

Friend.

Definition at line 411 of file sqldb.h.


Member Data Documentation

Command& Dv::Sql::Command::iterator::cmd_ [private]
 

Definition at line 451 of file sqldb.h.

Referenced by command(), iterator(), operator!=(), and operator==().

int Dv::Sql::Command::iterator::row_ [private]
 

Definition at line 452 of file sqldb.h.

Referenced by iterator(), operator!=(), and operator==().


The documentation for this class was generated from the following file:
dvmysql-0.4.11 [15 February, 2004]