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 void setTable(Table
*impl
){ tableHdl
= impl
;}
57 Table
* getTableHdl(){ return tableHdl
; }
59 void *getBindFldAddr(const char *name
);
60 DbRetVal
bindFld(const char *name
, void *val
, bool dummy
= false);
61 void setProjList(List bindFldList
) { fldProjList
= bindFldList
; }
62 DbRetVal
setOrderBy(const char *name
, bool isDesc
=false);
63 DbRetVal
setOrderByList(List orderList
);
64 void setDistinct() { sortTree
.setDistinct(true); }
65 OrderByType
getOrderType();
66 void checkAndSetSortAlgorithm();
67 DbRetVal
markFldNull(const char *name
){ return ErrBadCall
;}
68 DbRetVal
markFldNull(int colpos
){ return ErrBadCall
;}
69 bool isFldNull(const char *name
);
70 bool isFldNull(int colpos
);
71 void clearFldNull(const char *name
){}
72 void clearFldNull(int colpos
){}
73 DbRetVal
compact(){ return ErrBadCall
;}
74 int getFldPos(char *name
){ return 0;}
75 void resetNullinfo(){}
76 DbRetVal
insertTuple() { return ErrBadCall
; }
77 DbRetVal
updateTuple() { return ErrBadCall
; }
78 DbRetVal
deleteTuple() { return ErrBadCall
; }
79 int deleteWhere() { return ErrBadCall
; }
80 int truncate() { return ErrBadCall
; }
81 long spaceUsed() { return 0; }
82 int pagesUsed() { return 0; }
83 DbRetVal
lock(bool shared
) { return ErrBadCall
; }
84 DbRetVal
unlock(){ return ErrBadCall
; }
85 DbRetVal
setUndoLogging(bool flag
) { return ErrBadCall
; }
86 void printSQLIndexString(FILE *fp
, int fd
){ };
87 void printSQLForeignString(){}
88 char* getName() { return tableHdl
->getName(); }
89 char* getAliasName(){return tableHdl
->getAliasName(); }
90 List
getFieldNameList(){ List dummyList
; return dummyList
;}
93 DbRetVal
insertDistinct();
95 void* fetch(DbRetVal
&rv
);
97 void* fetchNoBind(DbRetVal
&rv
);
101 bool pushPredicate(Predicate
*pred
)
102 { printf("Wrong call\n"); return false; }
103 void setPredicate(Predicate
*pred
)
104 { printf("Wrong call\n"); }
105 bool isTableInvolved(char *tableName
)
106 { printf("Wrong call\n"); return false; }
107 void printPlan(int space
);
109 { printf("Wrong call\n"); return OK
; }
110 bool isFKTable(){return false;}
111 ScanType
getScanType(){ return unknownScan
;}
112 bool hasIndex(char *fName
){ return false;}
113 void setCondition(Condition
*) {}
114 int computeOrderBySize();