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

Dv::Sql::Field Class Reference

A field/column in a table or a query result. More...

#include <sqldb.h>

List of all members.

Public Member Functions

 Field (const std::string &name, const std::string &table, const std::string &type, const std::string &defaultvalue, bool isint, bool isflt, bool isstr, bool isbin, unsigned int sz)
 Field constructor. Users will never use this.

std::string name () const
 The name of the field.

std::string table () const
 The name of the table containing this column.

std::string type () const
 The type of this field. The return value is dbms-dependent.

std::string defaultvalue () const
 The default value (see the constructor).

bool numeric () const
 Does the field have a numeric (int or float) type?

bool integer () const
 Does the field have an integer type?

bool real () const
 Does the field have floating point type?

bool binary () const
 Does the field have a binary type?

bool text () const
 Does the field have a string type?

unsigned int size () const
 Size of the field (in bytes).


Static Public Member Functions

Dv::Util::Date timestamp2date (const std::string &timestamp)
 Convert mysql timestamp(14) value, e.g. 20010724110830 to Date.


Private Attributes

std::string name_
std::string table_
std::string type_
std::string default_
bool int_
bool float_
bool string_
bool binary_
unsigned int size_

Friends

std::ostream & operator<< (std::ostream &, const Field &)
 Print readable representation on ostream.


Detailed Description

A field/column in a table or a query result.

Definition at line 72 of file sqldb.h.


Constructor & Destructor Documentation

Dv::Sql::Field::Field const std::string &  name,
const std::string &  table,
const std::string &  type,
const std::string &  defaultvalue,
bool  isint,
bool  isflt,
bool  isstr,
bool  isbin,
unsigned int  sz
 

Field constructor. Users will never use this.

What are valid arguments is dbms-dependent.


Member Function Documentation

std::string Dv::Sql::Field::name  )  const [inline]
 

The name of the field.

Definition at line 82 of file sqldb.h.

References name_.

std::string Dv::Sql::Field::table  )  const [inline]
 

The name of the table containing this column.

For a query result (i.e. a Dv::Sql::Command), the table can be defined by the ``as'' clause in a ``select'' statement.

Definition at line 87 of file sqldb.h.

References table_.

std::string Dv::Sql::Field::type  )  const [inline]
 

The type of this field. The return value is dbms-dependent.

Definition at line 89 of file sqldb.h.

References type_.

std::string Dv::Sql::Field::defaultvalue  )  const [inline]
 

The default value (see the constructor).

Definition at line 91 of file sqldb.h.

References default_.

bool Dv::Sql::Field::numeric  )  const [inline]
 

Does the field have a numeric (int or float) type?

Definition at line 94 of file sqldb.h.

References float_, and int_.

bool Dv::Sql::Field::integer  )  const [inline]
 

Does the field have an integer type?

Definition at line 96 of file sqldb.h.

References int_.

bool Dv::Sql::Field::real  )  const [inline]
 

Does the field have floating point type?

Definition at line 98 of file sqldb.h.

References float_.

bool Dv::Sql::Field::binary  )  const [inline]
 

Does the field have a binary type?

Definition at line 100 of file sqldb.h.

References binary_.

bool Dv::Sql::Field::text  )  const [inline]
 

Does the field have a string type?

Definition at line 102 of file sqldb.h.

References string_.

Dv::Util::Date Dv::Sql::Field::timestamp2date const std::string &  timestamp  )  [static]
 

Convert mysql timestamp(14) value, e.g. 20010724110830 to Date.

unsigned int Dv::Sql::Field::size  )  const [inline]
 

Size of the field (in bytes).

Definition at line 107 of file sqldb.h.

References size_.


Friends And Related Function Documentation

std::ostream& operator<< std::ostream &  ,
const Field
[friend]
 

Print readable representation on ostream.

Example:

       LONG[11] test.number
       STRING[32] test.word
       DATETIME[19] structuur2.wanneer
       VAR_STRING[100] structuur2.info
       TIMESTAMP[14] structuur2.time_stamp        


Member Data Documentation

std::string Dv::Sql::Field::name_ [private]
 

Definition at line 121 of file sqldb.h.

Referenced by name().

std::string Dv::Sql::Field::table_ [private]
 

Definition at line 122 of file sqldb.h.

Referenced by table().

std::string Dv::Sql::Field::type_ [private]
 

Definition at line 123 of file sqldb.h.

Referenced by type().

std::string Dv::Sql::Field::default_ [private]
 

Definition at line 124 of file sqldb.h.

Referenced by defaultvalue().

bool Dv::Sql::Field::int_ [private]
 

Definition at line 126 of file sqldb.h.

Referenced by integer(), and numeric().

bool Dv::Sql::Field::float_ [private]
 

Definition at line 127 of file sqldb.h.

Referenced by numeric(), and real().

bool Dv::Sql::Field::string_ [private]
 

Definition at line 128 of file sqldb.h.

Referenced by text().

bool Dv::Sql::Field::binary_ [private]
 

Definition at line 129 of file sqldb.h.

Referenced by binary().

unsigned int Dv::Sql::Field::size_ [private]
 

Definition at line 130 of file sqldb.h.

Referenced by size().


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