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

Dv::Sql::Command_ Class Reference

Proxy class for Sql::Db::Command. Not used by end users. More...

#include <sqldb.h>

Inheritance diagram for Dv::Sql::Command_:

Inheritance graph
[legend]
Collaboration diagram for Dv::Sql::Command_:

Collaboration graph
[legend]
List of all members.

Protected Member Functions

unsigned int nrows ()
 Return number of rows in the query result.

void nrows (unsigned int n)
 Set number of rows in the query result.

void ncols (unsigned int n)
 Set number of columns in the query result.

void run ()
 Mark the command (and associated Dv::Sql::Command) as having been executed.

std::string err ()
 Return status string of this command.

void err (const char *s)
 Set status string of this command.

void ok (bool b)
 Set status of this command.

std::ostringstream & textstream ()
 Retrieve text of the command as a string stream.

 Command_ (Command &cmd)
 Constructor: the associated Dv::Sql::Command object must already exist.

virtual ~Command_ ()
 Destructor, virtual because it will be subclassed.

virtual bool exec ()=0
 Actually execute the command, DBMS-dependent.

virtual Dbdb ()=0
 Return database connection associated with this command.

virtual void escape (const std::string &s)
 Write s in properly quoted and escaped form to this->textstream().

virtual void fetch (std::vector< std::string > &, unsigned int r)=0 throw (Exception)
 Low level retrieval: put row # r from query result into the parameter.

virtual void fetch (std::string &, unsigned int r, unsigned int c) throw (Exception)
 Low level retrieval: get column c from row # r from query result.

virtual const std::vector<
Field > & 
fields ()=0
 Return field information for the query result.

virtual unsigned int insertid () const
 Return id of auto_increment field of last insertion.


Protected Attributes

Commandcmd_
 Associated DBMS-independent Dv::Sql::Command object.


Private Member Functions

 Command_ (const Command_ &)
Command_operator= (const Command_ &)

Friends

class Command
 Friend.


Detailed Description

Proxy class for Sql::Db::Command. Not used by end users.

This class needs to be subclassed for a particular DBMS. A Dv::Sql::Command_ object forms a pair with a Dv::Sql::Command object: each contains a reference (or pointer) to the other. The Dv::Sql::Command_ object associated with a Dv::Sql::Command object cmd is created using the Dv::Sql::Db virtual member function Sql::Db::command_(cmd).

There is delegation in both ways: Dv::Sql::Command_ uses Dv::Sql::Command to perform some DBMS-independent operations and Dv::Sql::Command delegates all DBMS-dependent operations to Dv::Sql::Command_.

Definition at line 470 of file sqldb.h.


Constructor & Destructor Documentation

Dv::Sql::Command_::Command_ Command cmd  )  [inline, protected]
 

Constructor: the associated Dv::Sql::Command object must already exist.

Definition at line 495 of file sqldb.h.

virtual Dv::Sql::Command_::~Command_  )  [inline, protected, virtual]
 

Destructor, virtual because it will be subclassed.

Reimplemented in Dv::MySql::Command_.

Definition at line 497 of file sqldb.h.

Dv::Sql::Command_::Command_ const Command_  )  [private]
 


Member Function Documentation

unsigned int Dv::Sql::Command_::nrows  )  [inline, protected]
 

Return number of rows in the query result.

Definition at line 475 of file sqldb.h.

void Dv::Sql::Command_::nrows unsigned int  n  )  [inline, protected]
 

Set number of rows in the query result.

Definition at line 477 of file sqldb.h.

void Dv::Sql::Command_::ncols unsigned int  n  )  [inline, protected]
 

Set number of columns in the query result.

Definition at line 479 of file sqldb.h.

void Dv::Sql::Command_::run  )  [inline, protected]
 

Mark the command (and associated Dv::Sql::Command) as having been executed.

Definition at line 481 of file sqldb.h.

std::string Dv::Sql::Command_::err  )  [inline, protected]
 

Return status string of this command.

Definition at line 483 of file sqldb.h.

void Dv::Sql::Command_::err const char *  s  )  [inline, protected]
 

Set status string of this command.

Definition at line 485 of file sqldb.h.

void Dv::Sql::Command_::ok bool  b  )  [inline, protected]
 

Set status of this command.

Definition at line 487 of file sqldb.h.

std::ostringstream& Dv::Sql::Command_::textstream  )  [inline, protected]
 

Retrieve text of the command as a string stream.

Definition at line 489 of file sqldb.h.

virtual bool Dv::Sql::Command_::exec  )  [protected, pure virtual]
 

Actually execute the command, DBMS-dependent.

Implemented in Dv::MySql::Command_.

Referenced by Dv::Sql::Command::exec().

virtual Db& Dv::Sql::Command_::db  )  [protected, pure virtual]
 

Return database connection associated with this command.

Implemented in Dv::MySql::Command_.

Referenced by Dv::Sql::Command::db().

virtual void Dv::Sql::Command_::escape const std::string &  s  )  [protected, virtual]
 

Write s in properly quoted and escaped form to this->textstream().

Reimplemented in Dv::MySql::Command_.

virtual void Dv::Sql::Command_::fetch std::vector< std::string > &  ,
unsigned int  r
throw (Exception) [protected, pure virtual]
 

Low level retrieval: put row # r from query result into the parameter.

Implemented in Dv::MySql::Command_.

Referenced by Dv::Sql::Command::fetch().

virtual void Dv::Sql::Command_::fetch std::string &  ,
unsigned int  r,
unsigned int  c
throw (Exception) [protected, virtual]
 

Low level retrieval: get column c from row # r from query result.

An exception is thrown if any of r or c is out of range.

Reimplemented in Dv::MySql::Command_.

virtual const std::vector<Field>& Dv::Sql::Command_::fields  )  [protected, pure virtual]
 

Return field information for the query result.

Implemented in Dv::MySql::Command_.

Referenced by Dv::Sql::Command::fields().

virtual unsigned int Dv::Sql::Command_::insertid  )  const [protected, virtual]
 

Return id of auto_increment field of last insertion.

Reimplemented in Dv::MySql::Command_.

Referenced by Dv::Sql::Command::insertid().

Command_& Dv::Sql::Command_::operator= const Command_  )  [private]
 


Friends And Related Function Documentation

friend class Command [friend]
 

Friend.

Definition at line 472 of file sqldb.h.


Member Data Documentation

Command& Dv::Sql::Command_::cmd_ [protected]
 

Associated DBMS-independent Dv::Sql::Command object.

Definition at line 492 of file sqldb.h.


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