mcs::Table Class Reference

#include <mcs.hh>

Inheritance diagram for mcs::Table:

Inheritance graph
[legend]

List of all members.


Detailed Description

A class to directly set and retrieve value from a database table.

This class gives you direct access to the value of a table. Direct access means that you can use setFirst(), setLast(), setWhere() method of Query to find a specific record. While you can retrieve the values from the table with the usual rec() method you can also update the table. To update you need to move the record pointer to the record you want to update, then insert the new values using the rec() method, and call the update() method. Finally you can insert new records setting values in the internal array of Data through the newRec() method, and call insert();

Warning:
For this class to work correctly the table must have a unique key on one integer field.

Definition at line 6014 of file mcs.hh.


Public Member Functions

void insert ()
 Insert a new record.
void loadTable ()
 Reload the table.
RecordnewRec ()
 Return a reference to a Record object for insert.
Tableoperator= (const Table &)
 Declared to avoid using of default assignment operator.
void replace ()
 Insert (or replace) a new record.
 Table (DBConn *db, string table, string fieldkey)
 Constructor.
 Table (const Table &)
 Declared to avoid using of default copy constructor.
void update ()
 Update the current record.
 ~Table ()
 Destructor.

Private Member Functions

void insert_or_update (int op)

Private Attributes

string lfieldkey
 Name of the index field.
string ltable
 Table name.
 MCS_DEBUG_ALLOC
Record newrec
 Array of values for insert.
unsigned int posfieldkey
 Position of the index field.

Constructor & Destructor Documentation

mcs::Table::Table ( const Table  ) 

Declared to avoid using of default copy constructor.

Warning:
This constructor is declared but not implemented. If you try to use it you will get a compilation error.

mcs::Table::Table ( DBConn db,
string  table,
string  fieldkey 
)

Constructor.

Parameters:
db DBConn object used to connect to db server;
table Table name;
fieldkey Field index which is a unique key in the table.

Definition at line 919 of file Db.cc.

mcs::Table::~Table (  ) 

Destructor.

Definition at line 931 of file Db.cc.


Member Function Documentation

void mcs::Table::insert (  ) 

Insert a new record.

Values are those set with the newRec() methods.

Definition at line 954 of file Db.cc.

void mcs::Table::loadTable (  ) 

Reload the table.

Definition at line 935 of file Db.cc.

Record & mcs::Table::newRec (  ) 

Return a reference to a Record object for insert.

Definition at line 947 of file Db.cc.

Table& mcs::Table::operator= ( const Table  ) 

Declared to avoid using of default assignment operator.

Warning:
This operator is declared but not implemented. If you try to use it you will get a compilation error.

void mcs::Table::replace (  ) 

Insert (or replace) a new record.

Values are those set with the newRec() methods.

Definition at line 967 of file Db.cc.

void mcs::Table::update (  ) 

Update the current record.

Values are those actually found in the Record returned by the rec() method.

Definition at line 961 of file Db.cc.


Member Data Documentation

string mcs::Table::lfieldkey [private]

Name of the index field.

Definition at line 6023 of file mcs.hh.

string mcs::Table::ltable [private]

Table name.

Definition at line 6020 of file mcs.hh.

Record mcs::Table::newrec [private]

Array of values for insert.

Definition at line 6029 of file mcs.hh.

unsigned int mcs::Table::posfieldkey [private]

Position of the index field.

Definition at line 6026 of file mcs.hh.


The documentation for this class was generated from the following files:
mcslogo

MCS (My Customizable Server) ver. 0.3.3-alpha3
Documentation generated on Thu Mar 22 13:22:23 UTC 2012