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 DbRetVal
bindFld(const char *name
, void *val
);
86 DbRetVal
bindFld(const char *name
, AggType aggType
, void *val
);
87 DbRetVal
setGroup(const char *name
, void *val
);
88 void setCondition(Condition
*p
){}
89 void markFldNull(const char *name
){}
90 void markFldNull(int colpos
){}
91 bool isFldNull(const char *name
){return false;}
92 bool isFldNull(int colpos
){return false;}
93 void clearFldNull(const char *name
){}
94 void clearFldNull(int colpos
){}
95 DbRetVal
insertTuple() { return ErrBadCall
; }
96 DbRetVal
updateTuple() { return ErrBadCall
; }
97 DbRetVal
deleteTuple() { return ErrBadCall
; }
98 int deleteWhere() { return ErrBadCall
; }
99 int truncate() { return ErrBadCall
; }
100 long spaceUsed() { return 0; }
101 int pagesUsed() { return 0; }
102 DbRetVal
lock(bool shared
) { return ErrBadCall
; }
103 DbRetVal
unlock(){ return ErrBadCall
; }
104 DbRetVal
setUndoLogging(bool flag
) { return ErrBadCall
; }
105 void printSQLIndexString(){ };
106 char* getName() { return tableHdl
->getName(); }
107 List
getFieldNameList(){ List list
; return list
;}
110 void* fetch(DbRetVal
&rv
);
112 void* fetchNoBind(DbRetVal
&rv
);
131 class JoinProjFieldInfo
134 char tableName
[IDENTIFIER_LENGTH
];
135 char fieldName
[IDENTIFIER_LENGTH
];
142 strcpy(tableName
,""); strcpy(fieldName
, "");
143 type
= typeUnknown
; length
=0; appBuf
= NULL
; bindBuf
=NULL
;
149 char tableName1
[IDENTIFIER_LENGTH
];
150 char tableName2
[IDENTIFIER_LENGTH
];
151 char fieldName1
[IDENTIFIER_LENGTH
];
152 char fieldName2
[IDENTIFIER_LENGTH
];
164 strcpy(tableName1
,""); strcpy(fieldName1
, "");
165 strcpy(tableName2
,""); strcpy(fieldName2
, "");
166 type1
= typeUnknown
; length1
=0; bindBuf1
=NULL
;
167 type2
= typeUnknown
; length2
=0; bindBuf2
=NULL
;
168 alreadyBinded1
=false; alreadyBinded2
=false;
172 class JoinTableImpl
:public Table
175 void *curTuple
; //holds the current tuple ptr. moved during fetch() calls
178 Table
*rightTableHdl
;
184 DbRetVal
copyValuesToBindBuffer(void *tuple
);
185 JoinCondition jCondition
;
189 virtual ~JoinTableImpl();
191 DbRetVal
getFieldInfo(const char *fieldName
, FieldInfo
*&info
)
192 { return ErrBadCall
; }
194 void setTable(Table
*left
, Table
*right
)
195 { leftTableHdl
= left
; rightTableHdl
= right
; }
198 void setJoinType(JoinType type
) { jType
= type
; }
200 DbRetVal
bindFld(const char *name
, void *val
);
201 DbRetVal
setJoinCondition(const char *fldname1
, ComparisionOp op
,
202 const char *fldname2
);
203 void getFieldNameAlone(char*, char*);
204 void getTableNameAlone(char*, char*);
206 void setCondition(Condition
*p
){}
207 void markFldNull(const char *name
){}
208 void markFldNull(int colpos
){}
209 bool isFldNull(const char *name
){return false;}
210 bool isFldNull(int colpos
){return false;}
211 void clearFldNull(const char *name
){}
212 void clearFldNull(int colpos
){}
213 DbRetVal
insertTuple() { return ErrBadCall
; }
214 DbRetVal
updateTuple() { return ErrBadCall
; }
215 DbRetVal
deleteTuple() { return ErrBadCall
; }
216 int deleteWhere() { return ErrBadCall
; }
217 int truncate() { return ErrBadCall
; }
218 long spaceUsed() { return 0; }
219 int pagesUsed() { return 0; }
220 DbRetVal
lock(bool shared
) { return ErrBadCall
; }
221 DbRetVal
unlock(){ return ErrBadCall
; }
222 DbRetVal
setUndoLogging(bool flag
) { return ErrBadCall
; }
223 void printSQLIndexString(){ };
224 List
getFieldNameList(){ List list
; return list
;}
225 char* getName() { return NULL
; }
230 void* fetch(DbRetVal
&rv
);
232 void* fetchNoBind(DbRetVal
&rv
);