windows porting
[csql.git] / include / OrderTableImpl.h
blob297a9e608e0aa350bb924c778efbd8bc56d3964e
1 /***************************************************************************
2 * Copyright (C) 2007 by www.databasecache.com *
3 * Contact: praba_tuty@databasecache.com *
4 * *
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. *
9 * *
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. *
14 * *
15 ***************************************************************************/
16 #ifndef ORDERTABLE_IMPL_H
17 #define ORDERTABLE_IMPL_H
18 #include<os.h>
19 #include<DataType.h>
20 #include<Transaction.h>
21 #include<Database.h>
22 #include<Index.h>
23 #include<CatalogTables.h>
24 #include<Info.h>
25 #include<Debug.h>
26 #include<DatabaseManagerImpl.h>
27 #include<Predicate.h>
28 #include<TableImpl.h>
29 #include<OrderByTree.h>
31 class DllExport OrderTableImpl:public Table
33 private:
34 char tblName_[IDENTIFIER_LENGTH];
35 void *curTuple; //holds the current tuple ptr. moved during fetch() calls
36 List fldProjList;
37 List fldOrderByList;
38 Table *tableHdl;
39 List sortList; //change this list to some other data structure
40 ListIterator sortIter;
41 OrderByTree sortTree;
42 long long nullValues;
43 int orderBySize;
44 int projSize;
45 char *orderBuffer;
46 void *orderBindBuf;
47 bool isPlanCreated;
49 DbRetVal copyValuesToBindBuffer(void *tuple);
50 void setNullableForProj();
51 public:
52 OrderTableImpl();
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; }
58 DbRetVal closeScan();
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;}
91 DbRetVal execute();
92 DbRetVal insert();
93 DbRetVal insertDistinct();
94 void* fetch();
95 void* fetch(DbRetVal &rv);
96 void* fetchNoBind();
97 void* fetchNoBind(DbRetVal &rv);
98 DbRetVal close();
99 long numTuples();
100 void printInfo();
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);
108 DbRetVal optimize()
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();
117 #endif