code reorg
[csql.git] / src / server / Condition.cxx
blob0829db0ef93e0c40da9ac979e36ddabb9e116812
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 #include<os.h>
17 #include<Predicate.h>
18 #include<PredicateImpl.h>
19 Condition::Condition()
21 //pred = new PredicateImpl();
22 pred = NULL;
24 void Condition::reset()
26 if (pred) {delete pred;}
27 pred = NULL;
29 Condition::~Condition()
31 if (pred) delete pred;
32 pred = NULL;
34 void Condition::setTerm(const char* fName1, ComparisionOp op,
35 const char *fName2)
37 if (pred) delete pred;
38 pred = new PredicateImpl();
39 pred->setTerm(fName1, op, fName2);
42 //Operand should be of the same type of the field.This is must
43 void Condition::setTerm(const char* fName1, ComparisionOp op, void *opnd)
45 if (pred) delete pred;
46 pred = new PredicateImpl();
47 pred->setTerm(fName1, op, opnd);
50 void Condition::setTerm(const char* fName1, ComparisionOp op, void **opnd)
52 if (pred) delete pred;
53 pred = new PredicateImpl();
54 pred->setTerm(fName1, op, opnd);
57 void Condition::setTerm(Predicate *p1, LogicalOp op, Predicate *p2 )
59 if (pred) delete pred;
60 pred = new PredicateImpl();
61 pred->setTerm(p1, op, p2);