Project

General

Profile

« Previous | Next » 

Revision 371

input.Makefile: Added support for multi-column verification queries. inputs/SALVIAS: Added a multi-column verification query.

View differences:

inputs/SALVIAS/verify.0.plots.sql
1
SELECT '# projects';
2
SELECT count(*) FROM project;
3
SELECT '';
1
SELECT '# projects' AS "---";
2
SELECT count(*) AS count FROM project;
4 3

  
5
SELECT '# plot observations';
6
SELECT count(*) FROM plotevent;
7
SELECT '';
4
SELECT '# plot observations' AS "---";
5
SELECT count(*) AS count FROM plotevent;
6

  
7
SELECT E'each project\'s # plots' AS "---";
8
SELECT projectname AS project, count(*) AS plots_count
9
FROM project
10
JOIN plotevent USING (project_id)
11
GROUP BY project
12
ORDER BY project
13
;
inputs/SALVIAS/verify.0.plots.ref.sql
1
SELECT '# projects';
2
SELECT count(*) FROM projects;
3
SELECT '';
1
SELECT '# projects' AS `---`;
2
SELECT count(*) AS count FROM projects;
4 3

  
5
SELECT '# plot observations';
6
SELECT count(*) FROM plotMetadata;
7
SELECT '';
4
SELECT '# plot observations' AS `---`;
5
SELECT count(*) AS count FROM plotMetadata;
8 6

  
7
SELECT 'each project\'s # plots' AS `---`;
8
SELECT CAST(plotMetadata.project_id AS char) AS project, count(PlotID) AS plots_count
9
FROM projects
10
JOIN plotMetadata ON plotMetadata.project_id = projects.project_id
11
GROUP BY project
12
ORDER BY project
13
;
14

  
9 15
/*
10
SELECT pr.project_id, project_name, COUNT(PlotID)
11
FROM projects pr JOIN plotMetadata p
12
ON pr.project_id=p.project_id
13
GROUP BY pr.project_id, project_name;
14

  
15 16
SELECT DISTINCT pr.project_id, project_name, PlotMethod, m.MethodCode, m.Description
16 17
FROM projects pr JOIN plotMetadata p JOIN lookup_MethodCode m
17 18
ON pr.project_id=p.project_id AND p.MethodCode=m.MethodCode
inputs/SALVIAS/verify.0.plots.ref
1
---
1 2
# projects
3
count
2 4
23
3

  
5
---
4 6
# plot observations
7
count
5 8
13661
6

  
9
---
10
each project's # plots
11
project	plots_count
12
1	228
13
10	22
14
11	12962
15
12	28
16
13	2
17
14	99
18
16	2
19
17	6
20
18	3
21
19	4
22
2	37
23
21	3
24
22	1
25
23	70
26
24	4
27
25	28
28
3	20
29
5	102
30
6	29
31
7	9
32
8	1
33
9	1
inputs/input.Makefile
4 4
addBeforeExt = $(basename $(2))$(1)$(suffix $(2))
5 5

  
6 6
# Commands
7
DIFF = diff --unified=1 $(+:_%=)
7
DIFF = diff --unified=2 $(+:_%=)
8 8

  
9 9
table = $(shell s="$(*F)"; echo "$${s\#\#*.}")# remove sort order prefix
10 10

  
......
69 69
	$(DIFF)
70 70

  
71 71
%.out: %.sql _not_file
72
	$(psqlAsBien) --no-align --tuples-only <$< >$@
72
	$(psqlAsBien) --no-align --field-separator='	' --pset=footer=off <$< >$@
73 73
.PRECIOUS: %.out
74 74

  
75 75
all += $(wildcard *.out)
......
104 104
$(if $(n),,>>$(log)) 2>&1$(if $(n),|tee -a $(log))
105 105

  
106 106
%.ref: %.ref.sql
107
	$(mysqlAsBien) --skip-column-names $(db) <$< >$@
107
	$(mysqlAsBien) $(db) <$< >$@
108 108
.PRECIOUS: %.ref
109 109

  
110 110
###

Also available in: Unified diff