ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/DBS/Servers/AppServer/include/TableTemplate.hpp
Revision: 1.2
Committed: Tue Dec 13 23:13:39 2005 UTC (19 years, 4 months ago) by sekhri
Branch: MAIN
CVS Tags: before_message_removal, preXOverChanges
Changes since 1.1: +1 -0 lines
Log Message:
Added insertEventCollection and insertFiles API to work with Sinsisa high level api

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     TableTemplate(DBManagement* dbmanager);
29     void addRow(RowInterface* aRow);
30     void addRow(R* aRow);
31     void delRows();
32     //RowIter getRowsBegin();
33     //RowIter getRowsEnd();
34     std::vector<R*>& select(std::string whereClause);
35     //std::vector<RowInterface*>& select(std::string whereClause);
36     void insert();
37     void update();
38     std::string* getTableName();
39     void setDBManager(DBManagement* dbmanager);
40     Dictionary* getSchema();
41 sekhri 1.2 Dictionary* getMultiRefrence();
42 afaq 1.1
43     private:
44     void init();
45     RowSchemaNConstraintsBinding<R> schemaNconstraints;
46     int getSeqValue(std::string, std::string);
47    
48     std::string makeSelectQuery(std::string);
49     std::string makeWhereClause(std::string);
50     std::vector<std::string> makeInsertQuery(R*);
51     Dictionary getSatisfiedRefrences(ResultSet*,int);
52     void makeRefrences(void);
53    
54     Dictionary* schema;
55     Dictionary* constraints;
56     Dictionary* refrences;
57    
58    
59     Keys* primaryKeys;
60     Keys* notNullKeys;
61     Keys* foreignKeys;
62    
63     std::string *tableName;
64     std::vector<R*> rows;
65     typedef std::vector<R*>::iterator RowIter;
66     RowIter rowIterator;
67    
68    
69     protected :
70     log4cxx::LoggerPtr logger;
71     virtual void doSmartInsert(R*){cout <<"doSmartInsert virtual"<<endl; };
72     void doSimpleInsert(R*);
73     void insertSingle(R*, std::string, std::string);
74     void insertMulti(R*, std::string);
75     void fixPKWithSeq(R*);
76     void setTimeInRow(R*);
77     void setPersonInRow(R*);
78     ResultSet* doSelect(std::string, std::string);
79     void convertIntoRow(ResultSet*,int,R*);
80     void reSetColNamesInRS(ResultSet* rs);
81     Dictionary* multiRefrences;
82     Keys primaryKeysReal;
83     ListOfLists* uniqueKeys;
84    
85     Util util;
86     SQL* sql;
87     DBManagement* dbmanager;
88     Keys* schemaOrder;
89    
90     };
91    
92     #endif
93