aboutsummaryrefslogtreecommitdiff
path: root/query.h
blob: d19494ed657006f5ec3decde55e3d46ddf4a5faa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once

#include "enginedata.h"
#include <vector>
#include <string>
#include <map>

using namespace std;


struct WhereClause{
	int col;
	RowItem value;
	WhereClause(void);
	WhereClause(const int _c,const RowItem &_v);
};


struct QueryResult{
	int res;
	vector<Row> rows;
	QueryResult(void);
	QueryResult(int);
	QueryResult(int,const vector<Row>&);
};


struct Query{
	string from;
	int limit; //-1=unlimited
	Query(void);
	virtual QueryResult execute(const map<string,Table>&);
};

struct FindQuery : public Query{
	int sort; //0=no sort, 1=sort, -1=reverse sort
	vector<WhereClause> where;
	FindQuery(void);
	QueryResult execute(const map<string,Table>&);
};