varchar size not proper and join table with qualifed and unqualifed field names in...
[csql.git] / include / OrderTableImpl.h
blob803d6b2b5102ffbee119e3ea71af722be05afecb
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 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; }
61 DbRetVal closeScan();
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;}
94 DbRetVal execute();
95 DbRetVal insert();
96 DbRetVal insertDistinct();
97 void* fetch();
98 void* fetch(DbRetVal &rv);
99 void* fetchNoBind();
100 void* fetchNoBind(DbRetVal &rv);
101 DbRetVal close();
102 long numTuples();
103 void printInfo();
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);
111 DbRetVal optimize()
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();
120 #endif