Adding test framework and some sample test modules and test cases to the sytem.
[csql.git] / include / PredicateImpl.h
blobb6cc81d83354555bfba727d94847ceac53b824c7
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 PREDICATE_IMPL_H
17 #define PREDICATE_IMPL_H
18 #include<DataType.h>
19 #include<Predicate.h>
20 class TableImpl;
21 class Table;
22 class PredicateImpl:public Predicate
24 //Members set during initialization of the term
25 char fldName1[IDENTIFIER_LENGTH];
26 char fldName2[IDENTIFIER_LENGTH];
27 ComparisionOp compOp;
28 void *operand;
29 LogicalOp logicalOp;
30 PredicateImpl *lhs;
31 PredicateImpl *rhs;
33 //Members set during execution
34 void *tuple; //pointer to the tuple
36 //This will be set before calling evaluate
37 TableImpl *table;
39 public:
40 PredicateImpl(){ operand = NULL; lhs = rhs = NULL; }
41 ~PredicateImpl(){}
43 void setTerm(const char* fName1, ComparisionOp op, const char *fName2);
45 //Operand should be of the same type of the field.This is must
46 void setTerm(const char* fName1, ComparisionOp op, void *opnd);
48 void setTerm(Predicate *p1, LogicalOp op, Predicate *p2 = NULL);
50 void* valPtrForIndexField(const char *name);
52 int evaluate(bool &result);
54 void setTable(Table *tbl);
55 void setTuple(void *tpl);
57 //check predicate, whether it has field name and == operator
58 //and does not have OR, NOT operator
59 // TODO:: expression like !(f1 !=100) wont be optimized for now
60 bool pointLookupInvolved(const char *fName);
64 #endif