88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
exn
(begin
(print-call-chain)
(debug:print 0 *default-log-port* "ERROR: cannot create ttype entry, " ((condition-property-accessor 'exn 'message) exn))
#f)
(dbi:exec dbh "INSERT INTO ttype (target_spec) VALUES (?);" target-spec))
(pgdb:get-ttype dbh target-spec)))))
;;======================================================================
;; T A G S
;;======================================================================
(define (pgdb:get-tag-info-by-name dbh tag)
(dbi:get-one-row dbh "SELECT id,tag_name FROM tags where tag_name=?;" tag))
(define (pgdb:insert-tag dbh name )
(dbi:exec dbh "INSERT INTO tags (tag_name) VALUES (?)" name ))
(define (pgdb:insert-area-tag dbh tag-id area-id )
(dbi:exec dbh "INSERT INTO area_tags (tag_id, area_id) VALUES (?,?)" tag-id area-id ))
(define (pgdb:is-area-taged dbh area-id)
(let ((area-tag-id (dbi:get-one dbh "SELECT id FROM area_tags WHERE area_id=?;" area-id)))
(if area-tag-id
#t
#f)))
(define (pgdb:is-area-taged-with-a-tag dbh tag-id area-id)
(let ((area-tag-id (dbi:get-one dbh "SELECT id FROM area_tags WHERE area_id=? and tag_id=?;" area-id tag-id)))
(if area-tag-id
#t
#f)))
;;======================================================================
;; R U N S
;;======================================================================
;; given a target spec id, target and run-name return the run-id
;; if no run found return #f
|