LiteSQL  0.3.10
selectquery.hpp
Go to the documentation of this file.
1 /* LiteSQL
2  *
3  * The list of contributors at http://litesql.sf.net/
4  *
5  * See LICENSE for copyright information. */
6 
7 
8 #ifndef litesql_selectquery_hpp
9 #define litesql_selectquery_hpp
10 
11 #include "litesql/utils.hpp"
12 #include "litesql/expr.hpp"
15 namespace litesql {
18 class SelectQuery {
19  bool _distinct;
20  int _limit, _offset;
21  Split _results;
22  Split _sources;
23  std::string _where;
24  Split _groupBy;
25  std::string _having;
26  Split _orderBy;
27 public:
28  SelectQuery() : _distinct(false), _limit(0), _offset(0), _where("True") {}
29  SelectQuery & distinct(bool d) ;
30  SelectQuery & limit(int value);
31  SelectQuery & offset(int value);
32  SelectQuery & result(std::string r);
33  SelectQuery & clearResults();
34  SelectQuery & source(std::string s, std::string alias="");
35  SelectQuery & where(const Expr & w);
36  SelectQuery & where(std::string w);
37  SelectQuery & groupBy(std::string gb);
38  SelectQuery & having(const Expr & h);
39  SelectQuery & having(std::string h);
40  SelectQuery & orderBy(std::string ob, bool ascending=true);
41  operator std::string() const;
42  std::string asString() const { return this->operator std::string(); }
43 };
44 }
45 
46 #endif
Definition: backend.hpp:14
includes string.hpp and split.hpp
A base class for expression in WHERE - clause.
Definition: expr.hpp:19
Contains Expr-class hierarchy and operator overloadings for them.
a class that helps creating SELECT-SQL statements.
Definition: selectquery.hpp:18
splits and joins strings.
Definition: split.hpp:15

SourceForge.net Logo