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 ORDERTABLE_IMPL_H
17 #define ORDERTABLE_IMPL_H
20 #include<Transaction.h>
23 #include<CatalogTables.h>
26 #include<DatabaseManagerImpl.h>
29 #include<OrderByTree.h>
31 class DllExport OrderTableImpl
:public Table
34 char tblName_
[IDENTIFIER_LENGTH
];
35 void *curTuple
; //holds the current tuple ptr. moved during fetch() calls
39 List sortList
; //change this list to some other data structure
40 ListIterator sortIter
;
49 DbRetVal
copyValuesToBindBuffer(void *tuple
);
50 void setNullableForProj();
53 virtual ~OrderTableImpl();
54 DbRetVal
getFieldInfo(const char *fieldName
, FieldInfo
*&info
)
55 { return tableHdl
->getFieldInfo(fieldName
, info
); }
56 DbRetVal
getQualifiedName(const char *fieldName
, char *qualName
)
57 { return tableHdl
->getQualifiedName(fieldName
, qualName
); }
59 void setTable(Table
*impl
){ tableHdl
= impl
;}
60 Table
* getTableHdl(){ return tableHdl
; }
62 void *getBindFldAddr(const char *name
);
63 DbRetVal
bindFld(const char *name
, void *val
, bool dummy
= false);
64 void setProjList(List bindFldList
) { fldProjList
= bindFldList
; }
65 DbRetVal
setOrderBy(const char *name
, bool isDesc
=false);
66 DbRetVal
setOrderByList(List orderList
);
67 void setDistinct() { sortTree
.setDistinct(true); }
68 OrderByType
getOrderType();
69 void checkAndSetSortAlgorithm();
70 DbRetVal
markFldNull(const char *name
){ return ErrBadCall
;}
71 DbRetVal
markFldNull(int colpos
){ return ErrBadCall
;}
72 bool isFldNull(const char *name
);
73 bool isFldNull(int colpos
);
74 void clearFldNull(const char *name
){}
75 void clearFldNull(int colpos
){}
76 DbRetVal
compact(){ return ErrBadCall
;}
77 int getFldPos(char *name
){ return 0;}
78 void resetNullinfo(){}
79 DbRetVal
insertTuple() { return ErrBadCall
; }
80 DbRetVal
updateTuple() { return ErrBadCall
; }
81 DbRetVal
deleteTuple() { return ErrBadCall
; }
82 int deleteWhere() { return ErrBadCall
; }
83 int truncate() { return ErrBadCall
; }
84 long spaceUsed() { return 0; }
85 int pagesUsed() { return 0; }
86 DbRetVal
lock(bool shared
) { return ErrBadCall
; }
87 DbRetVal
unlock(){ return ErrBadCall
; }
88 DbRetVal
setUndoLogging(bool flag
) { return ErrBadCall
; }
89 void printSQLIndexString(FILE *fp
, int fd
){ };
90 void printSQLForeignString(){}
91 char* getName() { return tableHdl
->getName(); }
92 char* getAliasName(){return tableHdl
->getAliasName(); }
93 List
getFieldNameList(){ List dummyList
; return dummyList
;}
96 DbRetVal
insertDistinct();
98 void* fetch(DbRetVal
&rv
);
100 void* fetchNoBind(DbRetVal
&rv
);
104 bool pushPredicate(Predicate
*pred
)
105 { printf("Wrong call\n"); return false; }
106 void setPredicate(Predicate
*pred
)
107 { printf("Wrong call\n"); }
108 bool isTableInvolved(char *tableName
)
109 { printf("Wrong call\n"); return false; }
110 void printPlan(int space
);
112 { printf("Wrong call\n"); return OK
; }
113 bool isFKTable(){return false;}
114 ScanType
getScanType(){ return unknownScan
;}
115 bool hasIndex(char *fName
){ return false;}
116 void setCondition(Condition
*) {}
117 int computeOrderBySize();