Removing unnecessary DSN=myodbc3 lines from conf files
[csql.git] / include / AggTableImpl.h
blob16baee4f836ab42ad742d51bed2740a1cf002d1b
1 /***************************************************************************
2 * Copyright (C) 2007 by www.databasecache.com *
3 * Contact: praba_tuty@databasecache.com *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 ***************************************************************************/
16 #ifndef AGGTABLE_IMPL_H
17 #define AGGTABLE_IMPL_H
18 #include<os.h>
19 #include<DataType.h>
20 #include<Transaction.h>
21 #include<Database.h>
22 #include<Index.h>
23 #include<CatalogTables.h>
24 #include<Info.h>
25 #include<Debug.h>
26 #include<DatabaseManagerImpl.h>
27 #include<Predicate.h>
28 enum AggType
30 AGG_MIN = 1,
31 AGG_MAX,
32 AGG_SUM,
33 AGG_AVG,
34 AGG_COUNT,
35 AGG_UNKNOWN
37 class AggFldDef
39 public:
40 char fldName[IDENTIFIER_LENGTH];
41 DataType type;
42 int length;
43 void *bindBuf;
44 void *appBuf;
45 AggType atype;
46 bool alreadyBinded;
47 AggFldDef()
49 strcpy(fldName, "");
50 type=typeUnknown;
51 length=0;
52 bindBuf=NULL;
53 appBuf=NULL;
54 atype=AGG_UNKNOWN;
55 alreadyBinded=false;
59 class AggTableImpl:public Table
61 private:
62 char tblName_[IDENTIFIER_LENGTH];
63 void *curTuple; //holds the current tuple ptr. moved during fetch() calls
64 List fldList;
65 AggFldDef groupFld;
66 Table *tableHdl;
67 List aggNodes; //change this list to some other data structure
68 ListIterator aggNodeIter;
70 int aggNodeSize;
71 DbRetVal copyValuesToBindBuffer(void *tuple);
72 public:
73 AggTableImpl();
74 virtual ~AggTableImpl();
75 DbRetVal getFieldInfo(const char *fieldName, FieldInfo *&info)
76 { return ErrBadCall; }
77 bool isGroupSet()
79 if (groupFld.type == typeUnknown) return false; else return true;
81 void* insertOrGet();
82 void setTable(Table *impl){ tableHdl = impl;}
83 Table* getTableHdl(){ return tableHdl; }
84 DbRetVal closeScan();
85 void *getBindFldAddr(const char *name);
86 DbRetVal bindFld(const char *name, void *val);
87 DbRetVal bindFld(const char *name, AggType aggType, void *val);
88 DbRetVal setGroup(const char *name, void *val);
89 void setCondition(Condition *p){}
90 void markFldNull(const char *name){}
91 void markFldNull(int colpos){}
92 bool isFldNull(const char *name){return false;}
93 bool isFldNull(int colpos){return false;}
94 void clearFldNull(const char *name){}
95 void clearFldNull(int colpos){}
96 int getFldPos(char *name){}
97 void resetNullinfo(){}
98 DbRetVal insertTuple() { return ErrBadCall; }
99 DbRetVal updateTuple() { return ErrBadCall; }
100 DbRetVal deleteTuple() { return ErrBadCall; }
101 int deleteWhere() { return ErrBadCall; }
102 int truncate() { return ErrBadCall; }
103 long spaceUsed() { return 0; }
104 int pagesUsed() { return 0; }
105 DbRetVal lock(bool shared) { return ErrBadCall; }
106 DbRetVal unlock(){ return ErrBadCall; }
107 DbRetVal setUndoLogging(bool flag) { return ErrBadCall; }
108 void printSQLIndexString(){ };
109 char* getName() { return tableHdl->getName(); }
110 List getFieldNameList(){ List list; return list;}
111 DbRetVal execute();
112 void* fetch();
113 void* fetch(DbRetVal &rv);
114 void* fetchNoBind();
115 void* fetchNoBind(DbRetVal &rv);
116 DbRetVal close();
117 long numTuples();
118 void printInfo();
119 bool pushPredicate(Predicate *pred)
120 { printf("Wrong call\n"); return false; }
121 void setPredicate(Predicate *pred)
122 { printf("Wrong call\n"); }
123 bool isTableInvolved(char *tableName)
124 { printf("Wrong call\n"); return false; }
125 void printPlan(int space){printf("AGG-PLAN-TODO\n");}
128 #endif