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>
41 class DllExport JoinProjFieldInfo
44 char tabFieldName
[IDENTIFIER_LENGTH
*2];
45 char tableName
[IDENTIFIER_LENGTH
];
46 char fieldName
[IDENTIFIER_LENGTH
];
53 strcpy(tableName
,""); strcpy(fieldName
, "");
54 type
= typeUnknown
; length
=0; appBuf
= NULL
; bindBuf
=NULL
;
57 class DllExport JoinCondition
60 char tableName1
[IDENTIFIER_LENGTH
];
61 char tableName2
[IDENTIFIER_LENGTH
];
62 char fieldName1
[IDENTIFIER_LENGTH
];
63 char fieldName2
[IDENTIFIER_LENGTH
];
75 strcpy(tableName1
,""); strcpy(fieldName1
, "");
76 strcpy(tableName2
,""); strcpy(fieldName2
, "");
77 type1
= typeUnknown
; length1
=0; bindBuf1
=NULL
;
78 type2
= typeUnknown
; length2
=0; bindBuf2
=NULL
;
79 alreadyBinded1
=false; alreadyBinded2
=false;
83 class DllExport JoinTableImpl
:public Table
86 void *curTuple
; //holds the current tuple ptr. moved during fetch() calls
103 DbRetVal
copyValuesToBindBuffer(void *tuple
);
104 JoinCondition jCondition
;
110 virtual ~JoinTableImpl();
112 DbRetVal
getFieldInfo(const char *fieldName
, FieldInfo
*&info
);
113 DbRetVal
getQualifiedName(const char *fldname
, char *qualName
);
115 void setTable(Table
*left
, Table
*right
)
116 { leftTableHdl
= left
; rightTableHdl
= right
; }
117 int getFldPos(char *name
){ return 0;}
118 DbRetVal
closeScan();
119 void setJoinType(JoinType type
) { jType
= type
; }
121 DbRetVal
bindFld(const char *name
, void *val
, bool dummy
=false);
122 //DbRetVal setJoinCondition(const char *fldname1, ComparisionOp op,
123 // const char *fldname2);
125 void setCondition(Condition
*p
)
126 { if (p
) pred
= p
->getPredicate(); else pred
= NULL
;}
128 DbRetVal
markFldNull(const char *name
){ return ErrBadCall
;}
129 DbRetVal
markFldNull(int colpos
){ return ErrBadCall
;}
130 bool isFldNull(const char *name
);
131 bool isFldNullInt(const char *name
);
132 bool isFldNull(int colpos
){return false;}
133 void clearFldNull(const char *name
){}
134 void clearFldNull(int colpos
){}
135 void resetNullinfo(){ }
136 DbRetVal
insertTuple() { return ErrBadCall
; }
137 DbRetVal
updateTuple() { return ErrBadCall
; }
138 DbRetVal
deleteTuple() { return ErrBadCall
; }
139 int deleteWhere() { return ErrBadCall
; }
140 int truncate() { return ErrBadCall
; }
141 long spaceUsed() { return 0; }
142 int pagesUsed() { return 0; }
143 DbRetVal
lock(bool shared
) { return ErrBadCall
; }
144 DbRetVal
unlock(){ return ErrBadCall
; }
145 DbRetVal
setUndoLogging(bool flag
) { return ErrBadCall
; }
146 void printSQLIndexString(FILE *fp
, int fd
){ };
147 void printSQLForeignString(){}
148 List
getFieldNameList();
149 char* getName() { return NULL
; }
150 char* getAliasName(){ return NULL
; }
151 void *fetchRightFail();
152 DbRetVal
compact(){ return OK
;}
157 void* fetch(DbRetVal
&rv
);
159 void* fetchNoBind(DbRetVal
&rv
);
164 void *getBindFldAddr(const char *name
);
165 bool isFKTable(){return false;}
166 bool isTableInvolved(char *tblName
);
167 bool pushPredicate(Predicate
*pred
);
168 void setPredicate(Predicate
*pred
);
169 void printPlan(int space
);
171 void optimizeRestrict();
172 ScanType
getScanType();
173 bool hasIndex(char *fname
){ return false; }
174 void* getBindedBuf(char* tName
, char*fName
);