YACDB
Yet Another C(rappy) Database
instruction.h
Go to the documentation of this file.
1
7#ifndef INSTRUCTION_H
8#define INSTRUCTION_H
9
10#define IDENT_MAX_LEGHT 20
11#define COLUMNS_MAX_NB 10
12
13typedef enum dataType
14{
15 integer,
16 string,
17 unknownDataType
18} dataType;
19
24typedef enum instrType
25{
41
42
47typedef struct charray
48{
50 char **arr;
52 int size;
59{
61 char *col;
63 char *val;
64};
65
66
68typedef struct instr
69{
70 instrType type;
72
78{
82 char *table;
88 struct condition *cond;
89};
90
96{
100 char *table;
105};
106
112{
116 char *table;
121};
122
127typedef struct InstrArray
128{
129 // The array
130 instr **arr;
131 // The size of the array
132 int size;
134
135#endif
instrType
The different instruction types, such as select or add.
Definition: instruction.h:25
@ crt
Create, for table creation.
Definition: instruction.h:35
@ sel
Select, same as SELECT in sql.
Definition: instruction.h:27
@ drop
Drop (not implemented)
Definition: instruction.h:37
@ add
Add, for data insertion.
Definition: instruction.h:33
@ del
Delete (not implemented)
Definition: instruction.h:31
@ upd
Update (not implemented)
Definition: instruction.h:29
@ unknownInstrType
Unknown, when there is a parsing error.
Definition: instruction.h:39
struct instr instr
One yacDB instruction, this type is meant to be casted into other instr type.
struct charray charray
An array of char* (string)
struct InstrArray InstrArray
An array of instruction.
Add instruction.
Definition: instruction.h:112
char * table
Table name.
Definition: instruction.h:116
charray * values
Columns values.
Definition: instruction.h:120
instrType type
Always "add".
Definition: instruction.h:114
charray * columns
Columns name.
Definition: instruction.h:118
Create instruction.
Definition: instruction.h:96
charray * types
Columns type (useless)
Definition: instruction.h:104
char * table
Table name.
Definition: instruction.h:100
charray * columns
Columns name.
Definition: instruction.h:102
instrType type
Always "crt".
Definition: instruction.h:98
An array of instruction.
Definition: instruction.h:128
Select instruction.
Definition: instruction.h:78
charray * columns
Columns name, if empty represents all columns.
Definition: instruction.h:84
instrType type
Always "sel".
Definition: instruction.h:80
char * table
Table name.
Definition: instruction.h:82
int has_cond
1 if there is a where statement in the instruction
Definition: instruction.h:86
struct condition * cond
The condition in the where.
Definition: instruction.h:88
An array of char* (string)
Definition: instruction.h:48
int size
The size of the array.
Definition: instruction.h:52
char ** arr
The array.
Definition: instruction.h:50
An equality condition.
Definition: instruction.h:59
char * col
Column name.
Definition: instruction.h:61
char * val
Column value.
Definition: instruction.h:63
One yacDB instruction, this type is meant to be casted into other instr type.
Definition: instruction.h:69