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>
36 class JoinProjFieldInfo
39 char tabFieldName
[IDENTIFIER_LENGTH
*2];
40 char tableName
[IDENTIFIER_LENGTH
];
41 char fieldName
[IDENTIFIER_LENGTH
];
48 strcpy(tableName
,""); strcpy(fieldName
, "");
49 type
= typeUnknown
; length
=0; appBuf
= NULL
; bindBuf
=NULL
;
55 char tableName1
[IDENTIFIER_LENGTH
];
56 char tableName2
[IDENTIFIER_LENGTH
];
57 char fieldName1
[IDENTIFIER_LENGTH
];
58 char fieldName2
[IDENTIFIER_LENGTH
];
70 strcpy(tableName1
,""); strcpy(fieldName1
, "");
71 strcpy(tableName2
,""); strcpy(fieldName2
, "");
72 type1
= typeUnknown
; length1
=0; bindBuf1
=NULL
;
73 type2
= typeUnknown
; length2
=0; bindBuf2
=NULL
;
74 alreadyBinded1
=false; alreadyBinded2
=false;
78 class JoinTableImpl
:public Table
81 void *curTuple
; //holds the current tuple ptr. moved during fetch() calls
91 DbRetVal
copyValuesToBindBuffer(void *tuple
);
92 JoinCondition jCondition
;
97 virtual ~JoinTableImpl();
99 DbRetVal
getFieldInfo(const char *fieldName
, FieldInfo
*&info
);
101 void setTable(Table
*left
, Table
*right
)
102 { leftTableHdl
= left
; rightTableHdl
= right
; }
105 void setJoinType(JoinType type
) { jType
= type
; }
107 DbRetVal
bindFld(const char *name
, void *val
);
108 DbRetVal
setJoinCondition(const char *fldname1
, ComparisionOp op
,
109 const char *fldname2
);
111 void setCondition(Condition
*p
)
112 { if (p
) pred
= p
->getPredicate(); else pred
= NULL
;}
114 void markFldNull(const char *name
){}
115 void markFldNull(int colpos
){}
116 bool isFldNull(const char *name
){return false;}
117 bool isFldNull(int colpos
){return false;}
118 void clearFldNull(const char *name
){}
119 void clearFldNull(int colpos
){}
120 DbRetVal
insertTuple() { return ErrBadCall
; }
121 DbRetVal
updateTuple() { return ErrBadCall
; }
122 DbRetVal
deleteTuple() { return ErrBadCall
; }
123 int deleteWhere() { return ErrBadCall
; }
124 int truncate() { return ErrBadCall
; }
125 long spaceUsed() { return 0; }
126 int pagesUsed() { return 0; }
127 DbRetVal
lock(bool shared
) { return ErrBadCall
; }
128 DbRetVal
unlock(){ return ErrBadCall
; }
129 DbRetVal
setUndoLogging(bool flag
) { return ErrBadCall
; }
130 void printSQLIndexString(){ };
131 List
getFieldNameList();
132 char* getName() { return NULL
; }
137 void* fetch(DbRetVal
&rv
);
139 void* fetchNoBind(DbRetVal
&rv
);
144 void *getBindFldAddr(const char *name
);