1 /***************************************************************************
2 * Copyright (C) 2007 by www.databasecache.com *
3 * Contact: praba_tuty@databasecache.com *
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. *
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. *
15 ***************************************************************************/
16 #ifndef JOINTABLE_IMPL_H
17 #define JOINTABLE_IMPL_H
20 #include<Transaction.h>
23 #include<CatalogTables.h>
26 #include<DatabaseManagerImpl.h>
40 char fldName
[IDENTIFIER_LENGTH
];
59 class AggTableImpl
:public Table
62 char tblName_
[IDENTIFIER_LENGTH
];
63 void *curTuple
; //holds the current tuple ptr. moved during fetch() calls
67 List aggNodes
; //change this list to some other data structure
68 ListIterator aggNodeIter
;
71 DbRetVal
copyValuesToBindBuffer(void *tuple
);
74 virtual ~AggTableImpl();
75 DbRetVal
getFieldInfo(const char *fieldName
, FieldInfo
*&info
)
76 { return ErrBadCall
; }
79 if (groupFld
.type
== typeUnknown
) return false; else return true;
82 void setTable(Table
*impl
){ tableHdl
= impl
;}
83 Table
* getTableHdl(){ return tableHdl
; }
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 DbRetVal
insertTuple() { return ErrBadCall
; }
97 DbRetVal
updateTuple() { return ErrBadCall
; }
98 DbRetVal
deleteTuple() { return ErrBadCall
; }
99 int deleteWhere() { return ErrBadCall
; }
100 int truncate() { return ErrBadCall
; }
101 long spaceUsed() { return 0; }
102 int pagesUsed() { return 0; }
103 DbRetVal
lock(bool shared
) { return ErrBadCall
; }
104 DbRetVal
unlock(){ return ErrBadCall
; }
105 DbRetVal
setUndoLogging(bool flag
) { return ErrBadCall
; }
106 void printSQLIndexString(){ };
107 char* getName() { return tableHdl
->getName(); }
108 List
getFieldNameList(){ List list
; return list
;}
111 void* fetch(DbRetVal
&rv
);
113 void* fetchNoBind(DbRetVal
&rv
);
132 class JoinProjFieldInfo
135 char tabFieldName
[IDENTIFIER_LENGTH
*2];
136 char tableName
[IDENTIFIER_LENGTH
];
137 char fieldName
[IDENTIFIER_LENGTH
];
144 strcpy(tableName
,""); strcpy(fieldName
, "");
145 type
= typeUnknown
; length
=0; appBuf
= NULL
; bindBuf
=NULL
;
151 char tableName1
[IDENTIFIER_LENGTH
];
152 char tableName2
[IDENTIFIER_LENGTH
];
153 char fieldName1
[IDENTIFIER_LENGTH
];
154 char fieldName2
[IDENTIFIER_LENGTH
];
166 strcpy(tableName1
,""); strcpy(fieldName1
, "");
167 strcpy(tableName2
,""); strcpy(fieldName2
, "");
168 type1
= typeUnknown
; length1
=0; bindBuf1
=NULL
;
169 type2
= typeUnknown
; length2
=0; bindBuf2
=NULL
;
170 alreadyBinded1
=false; alreadyBinded2
=false;
174 class JoinTableImpl
:public Table
177 void *curTuple
; //holds the current tuple ptr. moved during fetch() calls
180 Table
*rightTableHdl
;
187 DbRetVal
copyValuesToBindBuffer(void *tuple
);
188 JoinCondition jCondition
;
193 virtual ~JoinTableImpl();
195 DbRetVal
getFieldInfo(const char *fieldName
, FieldInfo
*&info
);
197 void setTable(Table
*left
, Table
*right
)
198 { leftTableHdl
= left
; rightTableHdl
= right
; }
201 void setJoinType(JoinType type
) { jType
= type
; }
203 DbRetVal
bindFld(const char *name
, void *val
);
204 DbRetVal
setJoinCondition(const char *fldname1
, ComparisionOp op
,
205 const char *fldname2
);
207 void setCondition(Condition
*p
)
208 { if (p
) pred
= p
->getPredicate(); else pred
= NULL
;}
210 void markFldNull(const char *name
){}
211 void markFldNull(int colpos
){}
212 bool isFldNull(const char *name
){return false;}
213 bool isFldNull(int colpos
){return false;}
214 void clearFldNull(const char *name
){}
215 void clearFldNull(int colpos
){}
216 DbRetVal
insertTuple() { return ErrBadCall
; }
217 DbRetVal
updateTuple() { return ErrBadCall
; }
218 DbRetVal
deleteTuple() { return ErrBadCall
; }
219 int deleteWhere() { return ErrBadCall
; }
220 int truncate() { return ErrBadCall
; }
221 long spaceUsed() { return 0; }
222 int pagesUsed() { return 0; }
223 DbRetVal
lock(bool shared
) { return ErrBadCall
; }
224 DbRetVal
unlock(){ return ErrBadCall
; }
225 DbRetVal
setUndoLogging(bool flag
) { return ErrBadCall
; }
226 void printSQLIndexString(){ };
227 List
getFieldNameList();
228 char* getName() { return NULL
; }
233 void* fetch(DbRetVal
&rv
);
235 void* fetchNoBind(DbRetVal
&rv
);
240 void *getBindFldAddr(const char *name
);