windows porting changesw
[csql.git] / include / OrderByTree.h
blob0aca93b25fe0d49e4b123e7b939a71611a04cfb5
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 ORDERBYTREE_H
17 #define ORDERBYTREE_H
18 #include<os.h>
19 #include<Util.h>
20 #include<DataType.h>
21 #include<HeapAllocator.h>
23 class DllExport OrderByFldDef
25 public:
26 char fldName[IDENTIFIER_LENGTH];
27 DataType type;
28 int length;
29 void *bindBuf;
30 bool isDesc;
31 bool alreadyBinded;
32 bool isNull;
33 int fldPos;
34 OrderByFldDef()
36 strcpy(fldName, "");
37 type=typeUnknown;
38 length=0;
39 bindBuf=NULL;
40 isDesc= false;
41 alreadyBinded=false;
42 isNull = false;
43 fldPos=0;
47 enum OrderByType
49 Asc=0,
50 Desc,
51 UnKnown,
53 class DllExport OrderByTree
55 OrderByType type;
56 int keySize;
57 bool isDistinct;
58 List dataNode;
59 List orderByList;
60 bool fullOrderBy;
61 HashMap projMap; //used in distinct projection
63 public:
64 OrderByTree(){ isDistinct =false; fullOrderBy = false; keySize=0; type = UnKnown; dataNode.reset();}
65 DbRetVal insertDataNode(void *data);
66 bool find(void *data);
68 //Used for float type field and individual order by clause
69 void insertSpecialCaseDataNode(void *data);
71 void setKeySize(int size){ keySize = size; projMap.setKeySize(size);}
72 int getKeySize(){return keySize;}
73 void setDistinct(bool dist){ isDistinct = dist;}
74 bool getDistinct(){return isDistinct;}
75 void setOrderByType(OrderByType oType){ type = oType;}
76 OrderByType getOrderByType(){ return type; }
77 int compare(void *element1,void *element2,int size);
78 ListIterator getListIterator();
79 void setOrderByList(List oList) { orderByList = oList; }
80 void setFullOrderBy() {fullOrderBy = true; }
81 void setOrdIntNoNull() { projMap.setGrpIntNoNull(); }
82 void removeAll();
85 #endif