Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (40 loc) · 2.21 KB
/
Copy pathMakefile
File metadata and controls
60 lines (40 loc) · 2.21 KB
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
BASE_DIR=/tmp/minidb
DBNAME=db1
TABLENAME=table1
LOGLEVEL=warn
.PHONY: setup test_run init_db create_db create_table insert_into insert_into5 insert_into25 select_from count
setup: clean init_db create_db create_table
test_run: setup insert_into select_from
clean:
rm -rf $(BASE_DIR)
init_db:
cargo run -- --base_dir $(BASE_DIR) init
create_db:
cargo run -- --base_dir $(BASE_DIR) create_db $(DBNAME)
create_table:
cargo run -- --base_dir $(BASE_DIR) create_table $(DBNAME) $(TABLENAME)
insert_into:
cargo run -- --base_dir $(BASE_DIR) --log_level $(LOGLEVEL) execute "insert into $(DBNAME).$(TABLENAME) (id, age) values (1, 12)"
insert_into5:
cargo run -- --base_dir $(BASE_DIR) --log_level $(LOGLEVEL) execute "insert into $(DBNAME).$(TABLENAME) (id, age) values (1, 12), (2, 13), (3, 12), (4, 20), (5, 21)"
insert_into25: insert_into insert_into insert_into insert_into insert_into
select_from:
cargo run -- --base_dir $(BASE_DIR) --log_level $(LOGLEVEL) execute "select * from $(DBNAME).$(TABLENAME)"
select_sort:
cargo run -- --base_dir $(BASE_DIR) --log_level $(LOGLEVEL) execute "select * from $(DBNAME).$(TABLENAME) order by age"
count:
cargo run -- --base_dir $(BASE_DIR) --log_level $(LOGLEVEL) execute "select count() from $(DBNAME).$(TABLENAME)"
count_true:
cargo run -- --base_dir $(BASE_DIR) --log_level $(LOGLEVEL) execute "select count() from $(DBNAME).$(TABLENAME) where true"
count_false:
cargo run -- --base_dir $(BASE_DIR) --log_level $(LOGLEVEL) execute "select count() from $(DBNAME).$(TABLENAME) where false"
count_true_false:
cargo run -- --base_dir $(BASE_DIR) --log_level $(LOGLEVEL) execute "select count() from $(DBNAME).$(TABLENAME) where true = false"
count_false_false:
cargo run -- --base_dir $(BASE_DIR) --log_level $(LOGLEVEL) execute "select count() from $(DBNAME).$(TABLENAME) where false = false"
count_age_12:
cargo run -- --base_dir $(BASE_DIR) --log_level $(LOGLEVEL) execute "select count() from $(DBNAME).$(TABLENAME) where age = 12"
delete:
cargo run -- --base_dir $(BASE_DIR) --log_level $(LOGLEVEL) execute "delete from $(DBNAME).$(TABLENAME)"
delete_age_12:
cargo run -- --base_dir $(BASE_DIR) --log_level $(LOGLEVEL) execute "delete from $(DBNAME).$(TABLENAME) where age = 12"