27 #include "../../common/STLUtils.h"
370 m_limit(rhs.m_limit),
371 m_offset(rhs.m_offset)
390 m_limit(rhs->m_limit),
391 m_offset(rhs->m_offset)
431 m_fields.reset(
new Fields(f));
453 assert(m_fields.get() != 0);
455 m_fields->push_back(
new Field(f));
462 assert(m_fields.get() != 0);
464 m_fields->push_back(f);
471 assert(m_fields.get() != 0);
473 m_fields->push_back(
new Field(propertyName));
480 assert(m_fields.get() != 0);
482 m_fields->push_back(
new Field(propertyName, alias));
489 if(m_from.get() == 0)
490 m_from.reset(
new From);
492 m_from->push_back(item.
clone());
499 if(m_from.get() == 0)
500 m_from.reset(
new From);
502 m_from->push_back(item);
509 if(m_from.get() == 0)
510 m_from.reset(
new From);
512 m_from->push_back(i1.
clone());
513 m_from->push_back(i2.
clone());
520 if(m_from.get() == 0)
521 m_from.reset(
new From);
523 m_from->push_back(i1);
524 m_from->push_back(i2);
531 if(m_from.get() == 0)
532 m_from.reset(
new From);
534 m_from->push_back(i1.
clone());
535 m_from->push_back(i2.
clone());
536 m_from->push_back(i3.
clone());
543 if(m_from.get() == 0)
544 m_from.reset(
new From);
546 m_from->push_back(i1);
547 m_from->push_back(i2);
548 m_from->push_back(i3);
555 if(m_from.get() == 0)
556 m_from.reset(
new From);
571 m_from.reset(
new From(rhs));
657 if(m_where.get() == 0)
658 m_where.reset(
new Where(e));
667 if(m_where.get() == 0)
668 m_where.reset(
new Where(e));
683 m_where.reset(
new Where(rhs));
699 if(m_groupBy.get() == 0)
709 if(m_groupBy.get() == 0)
712 m_groupBy->push_back(item);
719 if(m_groupBy.get() == 0)
729 if(m_groupBy.get() == 0)
745 m_groupBy.reset(
new GroupBy(rhs));
761 if(m_having.get() == 0)
762 m_having.reset(
new Having(e));
771 if(m_having.get() == 0)
772 m_having.reset(
new Having(e));
787 m_having.reset(
new Having(rhs));
803 if(m_orderBy.get() == 0)
813 if(m_orderBy.get() == 0)
816 m_orderBy->push_back(item);
823 if(m_orderBy.get() == 0)
833 if(m_orderBy.get() == 0)
849 m_orderBy.reset(
new OrderBy(rhs));
865 if(m_distinct.get() == 0)
868 m_distinct->push_back(e);
875 if(m_distinct.get() == 0)
878 m_distinct->push_back(e.
clone());
885 if(m_distinct.get() == 0)
901 m_distinct.reset(
new Distinct(rhs));
934 return m_fields.get();
954 return m_where.get();
964 return m_groupBy.get();
974 return m_having.get();
984 return m_orderBy.get();
994 return m_distinct.get();
A class that can be used to model a filter expression that can be applied to a query.
const Distinct * getDistinct() const
It returns the Distinct modifier.
boost::ptr_vector< GroupByItem > GroupBy
A class that can be used to model a GROUP BY clause.
An abstract class that models a source of data in a query.
const OrderBy * getOrderBy() const
It returns the list of expressions used to sort the output result.
A class that can be used in a GROUP BY clause.
An abstract class that models a source of data in a query.
The Field class can be used to model an expression that takes part of the output items of a SELECT...
A class that models the name of a dataset used in a From clause.
A class that models the name of any property of an object.
const GroupBy * getGroupBy() const
It returns the list of expressions used to condense the result set.
boost::ptr_vector< Expression > Distinct
A class that models a Distinct clause on a query.
A class that models the name of any property of an object.
A class that models the name of a dataset used in a From clause.
A class that models a Distinct clause on a query.
boost::ptr_vector< OrderByItem > OrderBy
A class that can be used to model an ORDER BY clause.
void setLimit(std::size_t m)
It specifies the maximum number of rows to return.
Select & LeftJoin(FromItem *d2, JoinCondition *c)
TE_DEFINE_VISITABLE Select()
Default constructor.
Select & operator()(const Field &f)
Select & FullOuterJoin(FromItem *d2, JoinCondition *c)
std::auto_ptr< Where > m_where
std::auto_ptr< Having > m_having
const From * getFrom() const
It returns the list of source information to be used by the query.
This is an abstract class that models a query expression.
void setWhere(Where *w)
It sets the filter codition.
A Having is a filter expression that can be applied to a query with a group by clause.
std::auto_ptr< GroupBy > m_groupBy
Select & NaturalJoin(FromItem *d2, JoinType t)
Select & InnerJoin(FromItem *d2, JoinCondition *c)
A condition to be used in a Join clause.
The Field class can be used to model an expression that takes part of the output items of a SELECT...
boost::ptr_vector< Field > Fields
Fields is just a boost::ptr_vector of Field pointers.
JoinType
The type of join in a query.
void setExp(Expression *exp)
Sets the expression.
Select & CrossJoin(FromItem *d2)
void setDistinct(Distinct *d)
If Distinct is specified, all duplicate rows are removed from the result set (one row is kept from ea...
A class that can be used to model a filter expression that can be applied to a query.
This is an abstract class that models a query expression.
void setExp(Expression *exp)
Sets the expression.
std::size_t getOffset() const
It tells the number of rows to skip before starting to return rows.
const Fields * getFields() const
It returns the list of output expressions used to form the result set.
A class that can be used in a GROUP BY clause.
Query * clone() const
It creates a new copy of this query.
virtual FromItem * clone() const =0
It creates a new copy of this FromItem.
A Select models a query to be used when retrieving data from a data source.
SortOrder
Sort order type: asc or desc.
std::auto_ptr< Fields > m_fields
void setGroupBy(GroupBy *g)
It sets the list of expressions used to condense the result set.
void setOrderBy(OrderBy *o)
It sets the list of expressions used to sort the output result.
Select & operator=(const Select &rhs)
A Select models a query to be used when retrieving data from a DataSource.
A class that can be used to model a filter expression that can be applied to a query.
boost::ptr_vector< FromItem > From
It models the FROM clause for a query.
void setOffset(std::size_t o)
It specifies the number of rows to skip before starting to return rows.
Where * getWhere() const
It returns the filter condition.
std::auto_ptr< From > m_from
const Having * getHaving() const
It returns the list of expressions used to eliminate group row that doesn't satisfy the condition...
std::size_t getLimit() const
It tells the maximum number of rows to return.
void setHaving(Having *h)
It sets the list of expressions used to eliminate group row that doesn't satisfy the condition...
Select & limit(std::size_t l)
virtual Expression * clone() const =0
It creates a new copy of this expression.
A class that can be used in an ORDER BY clause to sort the items of a resulting query.
A class that can be used in an ORDER BY clause to sort the items of a resulting query.
Select & offset(std::size_t i)
Select & RightJoin(FromItem *d2, JoinCondition *c)
std::auto_ptr< OrderBy > m_orderBy
Select & operator+(const te::da::From &f)
A Query is independent from the data source language/dialect.
void setFields(Fields *f)
It sets the list of output expressions used to form the result set.
Select & Join(FromItem *d2, JoinType t, JoinCondition *c)
std::auto_ptr< Distinct > m_distinct
void setFrom(From *f)
It sets the list of source information.