00001 #ifndef DVMYSQL_COLUMN_H 00002 #define DVMYSQL_COLUMN_H 00003 // $Id: column.h,v 1.2 2005/12/16 16:28:12 dvermeir Exp $ 00004 namespace Dv { 00005 namespace Sql { 00006 /** A common base class representing a column in a row in a table 00007 * or query result. 00008 * @see Dv::Sql::Table::Column 00009 * @see Dv::Sql::Row<>::Column 00010 */ 00011 class Column { 00012 public: 00013 /** Constructor. 00014 * @param i 0-based index of the column 00015 */ 00016 Column(size_t i): index_(i) {} 00017 /** The index of the column. 00018 * @return the index of the column. 00019 */ 00020 size_t index() const { return index_; } 00021 private: 00022 /** The index (0-based) of the column. */ 00023 size_t index_; 00024 }; 00025 00026 /** The following is useful to define a list of columns, e.g. 00027 * in a Dv::Sql::Reference definition. 00028 * @par Example 00029 * @code 00030 * Dv::Sql::ColumnTag cols; 00031 * const Dv::Sql::Reference acct_cust( 00032 * Database::account, (cols = &Account::customer_id, &Account::code), 00033 * Database::customer, (cols = &Customer::id, &Customer::account_code) 00034 * ); 00035 * @endcode 00036 * @see Dv::Sql::Reference 00037 */ 00038 typedef Dv::Util::CsListTag<std::vector<const Dv::Sql::Column*> > ColumnTag; 00039 } 00040 } 00041 #endif
dvmysql-1.0.3 | [17 November, 2010] |