aboutsummaryrefslogtreecommitdiff
path: root/query.h
diff options
context:
space:
mode:
Diffstat (limited to 'query.h')
-rw-r--r--query.h23
1 files changed, 16 insertions, 7 deletions
diff --git a/query.h b/query.h
index b265496..264463d 100644
--- a/query.h
+++ b/query.h
@@ -7,16 +7,24 @@
using namespace std;
+struct WhereClause{
+ int col;
+ vector<RowItem> values;
+
+ WhereClause(void);
+ WhereClause(const int _c,const vector<RowItem> &_v);
+};
-struct ColValueClause{
+struct UpdateClause{
int col;
RowItem value;
- ColValueClause(void);
- ColValueClause(const int _c,const RowItem &_v);
+ UpdateClause(void);
+ UpdateClause(const int _c,const RowItem &_v);
};
+
struct QueryResult{
int res;
vector<Row> rows;
@@ -34,6 +42,7 @@ struct Query{
string tablename;
virtual QueryResult execute(map<string,Table>&);
+ virtual ~Query(void);
};
struct CreateQuery : public Query{
@@ -47,7 +56,7 @@ struct CreateQuery : public Query{
struct FindQuery : public Query{
unsigned int limit; //-1=unlimited
- vector<ColValueClause> where;
+ vector<WhereClause> where;
FindQuery(void);
pair<vector<map<string,Row>::const_iterator>,string> executeIterators(map<string,Table> &tables);
@@ -64,15 +73,15 @@ struct InsertQuery : public Query{
};
struct UpdateQuery : public Query{
- vector<ColValueClause> where;
- vector<ColValueClause> updates;
+ vector<WhereClause> where;
+ vector<UpdateClause> updates;
UpdateQuery(void);
QueryResult execute(map<string,Table> &tables);
};
struct DeleteQuery : public Query{
- vector<ColValueClause> where;
+ vector<WhereClause> where;
DeleteQuery(void);
QueryResult execute(map<string,Table> &tables);