-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathql.h
executable file
·90 lines (72 loc) · 3.11 KB
/
ql.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
//
// ql.h
// Query Language Component Interface
//
// This file only gives the stub for the QL component
#ifndef QL_H
#define QL_H
#include <stdlib.h>
#include <string.h>
#include <vector>
#include "redbase.h"
#include "parser.h"
#include "rm.h"
#include "ix.h"
#include "sm.h"
//
// QL_Manager: query language (DML)
//
class QL_Manager {
public:
QL_Manager (SM_Manager &smm, IX_Manager &ixm, RM_Manager &rmm);
~QL_Manager(); // Destructor
RC Select (int nSelAttrs, // # attrs in select clause
const RelAttr selAttrs[], // attrs in select clause
int nRelations, // # relations in from clause
const char * const relations[], // relations in from clause
int nConditions, // # conditions in where clause
const Condition conditions[]); // conditions in where clause
RC Insert (const char *relName, // relation to insert into
int nValues, // # values
const Value values[]); // values to insert
RC Delete (const char *relName, // relation to delete from
int nConditions, // # conditions in where clause
const Condition conditions[]); // conditions in where clause
RC Update (const char *relName, // relation to update
const RelAttr &updAttr, // attribute to update
const int bIsValue, // 1 if RHS is a value, 0 if attribute
const RelAttr &rhsRelAttr, // attr on RHS to set LHS equal to
const Value &rhsValue, // or value to set attr equal to
int nConditions, // # conditions in where clause
const Condition conditions[]); // conditions in where clause
private:
RC PostCheck(std::vector<RelAttr> &vSelAttrs,
std::vector<const char*> &vRelations,
std::vector<Condition> &vConditions);
RC PostConditionsCheck(std::vector<RelAttr> &vSelAttrs,
std::vector<const char*> &vRelations,
std::vector<Condition> &vConditions);
RC PostParse(std::vector<RelAttr> &vSelAttrs,
std::vector<const char*> &vRelations,
std::vector<Condition> &vConditions);
SM_Manager *_pSmm;
IX_Manager *_pIxm;
RM_Manager *_pRmm;
};
//
// Print-error function
//
void QL_PrintError(RC rc);
#define QL_UNKNOWN_TYPE (START_QL_ERR - 0)
#define QL_ITERATOR_NOT_OPENED (START_QL_ERR - 1)
#define QL_NULL_CHILD (START_QL_ERR - 2)
#define QL_NO_RELATION (START_QL_ERR - 3)
#define QL_LASTERROR QL_NULL_CHILD
#define QL_TWICE_RELATION (START_QL_WARN + 0)
#define QL_NO_MATCHING_RELATION (START_QL_WARN + 1)
#define QL_UNDEFINED_RELATION (START_QL_WARN + 2)
#define QL_BAD_JOIN (START_QL_WARN + 3)
#define QL_NON_TREATED_CASE (START_QL_WARN + 4)
#define QL_LASTWARN QL_NON_TREATED_CASE
#define QL_EOF PF_EOF
#endif