-
Notifications
You must be signed in to change notification settings - Fork 0
/
requetes.h
150 lines (126 loc) · 2.53 KB
/
requetes.h
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/*
*
* Author: Amanzou Amine, Jeremy Paulino
*
* Created on 20 mai 2012
*/
#ifndef REQUETES_H
#define REQUETES_H
#include "data.h"
typedef struct fields {
char* name;
enum type kind;
struct fields* next;
} fields;
typedef struct values {
data* value;
struct values* next;
} values;
typedef struct names {
char* name;
struct names* next;
} names;
typedef struct {
union {
char* name;
data* value;
} content;
enum {
FIELD_TERM,
CONSTANT_TERM
} kind;
} term;
struct condition;
typedef struct {
term* left;
term* right;
} contentComparison;
typedef struct {
struct condition* left;
struct condition* right;
} contentBinary;
typedef struct {
struct condition* daughter;
} contentUnary;
typedef struct condition {
union {
contentComparison three;
contentBinary two;
contentUnary one;
} content;
enum {
DISJUNCTION,
CONJUNCTION,
NEGATION,
EQUALITY,
SUPERIORITY,
INFERIORITY
} kind;
} condition;
typedef struct {
char* tableName;
fields* fieldsList;
} contentCreate;
typedef struct {
char* tableName;
names* fieldNamesList;
values* fieldValuesList;
} contentInsert;
typedef struct {
char* tableName;
condition* clause;
} contentDelete;
typedef struct {
char* tableName;
} contentDrop;
typedef struct {
names* fieldNamesList;
names* tableNamesList;
condition* clause;
} contentSelect;
typedef struct {
char* namefile;
} contentLoad;
typedef struct {
union {
contentCreate create;
contentInsert insert;
contentDelete delete;
contentDrop drop;
contentSelect select;
contentLoad load;
} content;
enum {
CREATE_QUERY,
INSERT_QUERY,
DELETE_QUERY,
DROP_QUERY,
SELECT_QUERY,
SAVE_QUERY,
LOAD_QUERY,
EXIT_QUERY
} kind;
} query;
fields* addField(char*, enum type, fields*);
values* addValue(data*, values*);
names* addName(char*, names*);
names* addFile (char *nm);
term* makeFieldTerm(char*);
term* makeConstantTerm(data*);
term* makeConstantNull();
condition* makeDisjunction(condition*, condition*);
condition* makeConjunction(condition*, condition*);
condition* makeNegation(condition*);
condition* makeEquality(term*, term*);
condition* makeInferiority(term*, term*);
condition* makeSuperiority(term*, term*);
query* makeCreate(char*, fields*);
query* makeInsert(char*, names*, values*);
query* makeDelete(char*, condition*);
query* makeDrop(char*);
query* makeSelect(names*, names*, condition*);
query* makeLoad(char*);
query* makeSave();
query* makeExit();
#endif
/* fin de requetes.h */