Condition Class Reference

Represents the condition part of SQL Query. More...


Public Member Functions

PredicategetPredicate ()
 gets the current predicate.
void setPredicate (Predicate *predicate)
 sets the current predicate.
void setTerm (const char *fName1, ComparisionOp op, const char *fName2)
 sets the predicate term of form f1 = f2.
void setTerm (const char *fName1, ComparisionOp op, void *opnd)
 sets the predicate term of form f1 = 10
void setTerm (const char *fName1, ComparisionOp op, void **opnd)
 sets the predicate term of form f1 =10, using pointer semantics
void setTerm (Predicate *p1, LogicalOp op, Predicate *p2=NULL)
 sets the predicate term of form f1 = f2 && f1 = 100.


Detailed Description

Represents the condition part of SQL Query.

Used in SELECT, UPDATE and DELETE statement to retrieve only tuples which satisfy
the condition. This represents the root of the logical expression. This logical
expression may contain multiple terms(predicates).
For example to set this condition f1 == f2 && f1 == 100.
Condition c1;
int val1 = 100;
c1.setTerm("f1", OpEquals, &val1);
Predicate *p1 = c1.getPredicate();
Condition c2;
c2.setTerm("f1", opEquals, "f2");
Predicate *p2 = c2.getPredicate();
Condtion rootCondition;
rootCondition.setTerm(p1, OpAnd, p2);
table->setCondition(rootCondition);


Member Function Documentation

Predicate* Condition::getPredicate (  )  [inline]

gets the current predicate.

This is used to create logical expressions with terms or predicates.

Returns:
Predicate* predicate

void Condition::setPredicate ( Predicate predicate  )  [inline]

sets the current predicate.

This is set after creating the logical expression and used in the table interface for setting the condition.

Parameters:
Predicate* predicate

void Condition::setTerm ( Predicate p1,
LogicalOp  op,
Predicate p2 = NULL 
)

sets the predicate term of form f1 = f2 && f1 = 100.

Parameters:
p1* predicate
op logical operator (&&, ||, !)
p2* predicate

void Condition::setTerm ( const char *  fName1,
ComparisionOp  op,
void **  opnd 
)

sets the predicate term of form f1 =10, using pointer semantics

Parameters:
fName1* field name
op comparision operator(=,!=, >,<,>=,<=)
opnd** pointer to pointer to the value

void Condition::setTerm ( const char *  fName1,
ComparisionOp  op,
void *  opnd 
)

sets the predicate term of form f1 = 10

Parameters:
fName1* field name
op comparision operator(=,!=, >,<,>=,<=)
opnd* pointer to the value

void Condition::setTerm ( const char *  fName1,
ComparisionOp  op,
const char *  fName2 
)

sets the predicate term of form f1 = f2.

Parameters:
fName1* field name
op comparision operator
fName2* field name


The documentation for this class was generated from the following file:
CSQL Project Page