00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef AGGTABLE_IMPL_H
00017 #define AGGTABLE_IMPL_H
00018 #include<os.h>
00019 #include<DataType.h>
00020 #include<Transaction.h>
00021 #include<Database.h>
00022 #include<Index.h>
00023 #include<CatalogTables.h>
00024 #include<Info.h>
00025 #include<Debug.h>
00026 #include<DatabaseManagerImpl.h>
00027 #include<Predicate.h>
00028 enum AggType
00029 {
00030 AGG_MIN = 1,
00031 AGG_MAX,
00032 AGG_SUM,
00033 AGG_AVG,
00034 AGG_COUNT
00035 };
00036 class AggFldDef
00037 {
00038 public:
00039 char fldName[IDENTIFIER_LENGTH];
00040 DataType type;
00041 int length;
00042 void *bindBuf;
00043 void *appBuf;
00044 AggType atype;
00045 bool alreadyBinded;
00046 };
00047
00048
00049 class AggTableImpl:public Table
00050 {
00051 private:
00052 char tblName_[IDENTIFIER_LENGTH];
00053 void *curTuple;
00054 List fldList;
00055 AggFldDef groupFld;
00056 Table *tableHdl;
00057 List aggNodes;
00058 ListIterator aggNodeIter;
00059
00060 int aggNodeSize;
00061 DbRetVal copyValuesToBindBuffer(void *tuple);
00062
00063 public:
00064 AggTableImpl();
00065 virtual ~AggTableImpl();
00066
00067 DbRetVal getFieldInfo(const char *fieldName, FieldInfo *&info)
00068 { return ErrBadCall; }
00069
00070 void* insertOrGet();
00071 void setTable(Table *impl){ tableHdl = impl;}
00072 void closeScan();
00073
00074
00075 DbRetVal bindFld(const char *name, void *val);
00076 DbRetVal bindFld(const char *name, AggType aggType, void *val);
00077 DbRetVal setGroup(const char *name, void *val);
00078
00079 void setCondition(Condition *p){}
00080 void markFldNull(const char *name){}
00081 void markFldNull(int colpos){}
00082 bool isFldNull(const char *name){return false;}
00083 bool isFldNull(int colpos){return false;}
00084 void clearFldNull(const char *name){}
00085 void clearFldNull(int colpos){}
00086 DbRetVal insertTuple() { return ErrBadCall; }
00087 DbRetVal updateTuple() { return ErrBadCall; }
00088 DbRetVal deleteTuple() { return ErrBadCall; }
00089 int deleteWhere() { return ErrBadCall; }
00090 int truncate() { return ErrBadCall; }
00091 long spaceUsed() { return 0; }
00092 int pagesUsed() { return 0; }
00093 DbRetVal lock(bool shared) { return ErrBadCall; }
00094 DbRetVal unlock(){ return ErrBadCall; }
00095 DbRetVal setUndoLogging(bool flag) { return ErrBadCall; }
00096 void printSQLIndexString(){ };
00097 char* getName() { return tableHdl->getName(); }
00098 List getFieldNameList(){ List list; return list;}
00099
00100 DbRetVal execute();
00101 void* fetch();
00102 void* fetch(DbRetVal &rv);
00103 void* fetchNoBind();
00104 void* fetchNoBind(DbRetVal &rv);
00105 DbRetVal close();
00106
00107 long numTuples();
00108 void printInfo();
00109
00110 };
00111
00112
00113 #endif