ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/DBS/Servers/AppServer/include/TableTemplate.hpp
Revision: 1.4
Committed: Mon Feb 6 23:18:52 2006 UTC (19 years, 3 months ago) by afaq
Branch: MAIN
CVS Tags: DBS_0_0_3a, DBS_0_0_3, DBS_0_0_0, vs20060320, AfterJan2006SchemaChanges_v01_00_01, AfterJan2006SchemaChanges_v01_00_00, AfterJan2006SchemaChanges
Branch point for: BranchForCPPWebServiceTesting
Changes since 1.3: +1 -1 lines
Log Message:
Non working set, Checking IN for securing the changes, will resume working

File Contents

# User Rev Content
1 afaq 1.1 #ifndef _TableTemplate_hpp_included_
2     #define _TableTemplate_hpp_included_
3    
4     /// This file contains a Tempelate Class that
5     /// Represents a RDMS Table, containing a vector
6     /// of Rows, where each Row is a self describing
7     /// Object.
8    
9     #include <iostream.h>
10     #include <vector>
11     #include "common.hpp"
12     #include "ResultSet.hpp"
13     #include "DBManagement.hpp"
14     #include "BaseSchemaNConstratints.hpp"
15     #include "Util.hpp"
16     #include "SQL.hpp"
17     #include "TableInterface.hpp"
18     #include <log4cxx/logger.h>
19    
20     /// Template Class for a Table
21     template <class R>
22     class TableTemplate : public TableInterface {
23    
24     public:
25     //Default constructor
26     TableTemplate();
27     ~TableTemplate();
28 sekhri 1.3 void dispose();
29 afaq 1.1 TableTemplate(DBManagement* dbmanager);
30     void addRow(RowInterface* aRow);
31     void addRow(R* aRow);
32     void delRows();
33     //RowIter getRowsBegin();
34     //RowIter getRowsEnd();
35     std::vector<R*>& select(std::string whereClause);
36     //std::vector<RowInterface*>& select(std::string whereClause);
37     void insert();
38     void update();
39     std::string* getTableName();
40     void setDBManager(DBManagement* dbmanager);
41     Dictionary* getSchema();
42 sekhri 1.2 Dictionary* getMultiRefrence();
43 sekhri 1.3 std::vector<R*>& getRows();
44     int getNoOfRows();
45     std::string getStrValue(int index, string name);
46 afaq 1.1
47     private:
48     void init();
49     RowSchemaNConstraintsBinding<R> schemaNconstraints;
50     int getSeqValue(std::string, std::string);
51    
52     std::string makeSelectQuery(std::string);
53     std::string makeWhereClause(std::string);
54     std::vector<std::string> makeInsertQuery(R*);
55     Dictionary getSatisfiedRefrences(ResultSet*,int);
56     void makeRefrences(void);
57    
58     Dictionary* schema;
59     Dictionary* constraints;
60     Dictionary* refrences;
61    
62    
63     Keys* primaryKeys;
64     Keys* foreignKeys;
65    
66     std::string *tableName;
67     std::vector<R*> rows;
68     typedef std::vector<R*>::iterator RowIter;
69     RowIter rowIterator;
70    
71    
72     protected :
73     log4cxx::LoggerPtr logger;
74     virtual void doSmartInsert(R*){cout <<"doSmartInsert virtual"<<endl; };
75     void doSimpleInsert(R*);
76     void insertSingle(R*, std::string, std::string);
77     void insertMulti(R*, std::string);
78     void fixPKWithSeq(R*);
79     void setTimeInRow(R*);
80     void setPersonInRow(R*);
81     ResultSet* doSelect(std::string, std::string);
82     void convertIntoRow(ResultSet*,int,R*);
83     void reSetColNamesInRS(ResultSet* rs);
84     Dictionary* multiRefrences;
85     Keys primaryKeysReal;
86     ListOfLists* uniqueKeys;
87    
88     Util util;
89     SQL* sql;
90     DBManagement* dbmanager;
91     Keys* schemaOrder;
92 afaq 1.4 Keys* notNullKeys;
93 afaq 1.1
94     };
95    
96     #endif
97