Overview
Comment: | changed more sqlite3 calls to dbi |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.63-gasket |
Files: | files | file ages | folders |
SHA1: |
750e8df937a3d41a50dd165217e5875e |
User & Date: | srehman on 2016-12-20 15:50:46 |
Other Links: | branch diff | manifest | tags |
Context
2016-12-20
| ||
16:36 | fixed issues with single columns being fetched from db check-in: 484ab17aff user: srehman tags: v1.63-gasket | |
15:50 | changed more sqlite3 calls to dbi check-in: 750e8df937 user: srehman tags: v1.63-gasket | |
15:01 | fixed sync-tables bug check-in: 1d0bf66aa6 user: srehman tags: v1.63-gasket | |
Changes
Modified datashare.scm from [ff237ff27e] to [b0df4daba9].
︙ | |||
148 149 150 151 152 153 154 155 | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | + - + - + - + - - + + | (define (datashare:register-data db area version-name store-type submitter quality source-path comment) (let ((iter-qry (dbi:prepare db "SELECT max(iteration) FROM pkgs WHERE area=? AND version_name=?;")) (next-iteration 0)) (dbi:with-transaction db (lambda () (dbi:for-each-row (lambda (output) (lambda (iteration) |
︙ | |||
212 213 214 215 216 217 218 | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 | - + | (define (datashare:record-pkg-ref db pkg-id dest-link) (dbi:exec db "INSERT INTO refs (pkg_id,destlink) VALUES (?,?);" pkg-id dest-link)) (define (datashare:count-refs db pkg-id) (let ((res 0)) (dbi:for-each-row (lambda (count) |
︙ | |||
279 280 281 282 283 284 285 | 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | - - + + - - + + | res)) (define open-run-close open-run-close-no-exception-handling) (define (datashare:get-pkgs db area-filter version-filter iter-filter) (let ((res '())) (dbi:for-each-row ;; replace with fold ... |
︙ | |||
314 315 316 317 318 319 320 321 322 | 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | + - + | hed (loop (car tal)(cdr tal))))))))) (define (datashare:get-versions-for-area db area-name #!key (version-patt #f)) (let ((res '()) (data (make-hash-table))) (dbi:for-each-row (lambda (output) (lambda (version-name submitter iteration submitted-time comment) ;; 0 1 2 3 4 |
︙ |
Modified filedb.scm from [40227ed70e] to [9cc1ddbcdd].
︙ | |||
57 58 59 60 61 62 63 | 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 | - + - + - + - + | (define (filedb:finalize-db! fdb) (dbi:close (filedb:fdb-get-db fdb))) (define (filedb:get-current-time-string) (string-chomp (time->string (seconds->local-time (current-seconds))))) (define (filedb:get-base-id db path) |
︙ | |||
107 108 109 110 111 112 113 | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | - + | (vector-ref statinfo 4) ;; gid (vector-ref statinfo 5) ;; size (vector-ref statinfo 8) ;; mtime ) (dbi:close stmt))) ;; (filedb:get-current-time-string)))) (define (filedb:add-path db path parent) |
︙ | |||
173 174 175 176 177 178 179 | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | - + - + - + - + | pth)))) (define (filedb:drop-base fdb path) (print "Sorry, I don't do anything yet")) (define (filedb:find-all fdb pattern action) (let* ((db (filedb:fdb-get-db fdb)) |
︙ | |||
212 213 214 215 216 217 218 219 | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | + - + | ;; retrieve all that have children and those without ;; children that match patt (define (filedb:get-children-patt fdb parent-id search-patt) (let* ((db (filedb:fdb-get-db fdb)) (res '())) ;; first get the children that have no children (dbi:for-each-row (lambda (output) (lambda (id path parent-id) |
︙ |
Modified lock-queue.scm from [95a0581694] to [d0d9e7e805].
︙ | |||
101 102 103 104 105 106 107 108 109 110 | 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 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | + - + - - + + - - + + | (lock-queue:delete-lock-db dbdat) (lock-queue:any-younger? dbdat mystart test-id remtries: (- remtries 1))) (begin (debug:print-error 0 *default-log-port* " Failed to find younger locks for test with id " test-id ", error: " ((condition-property-accessor 'exn 'message) exn) ", giving up.") #f)) (let ((res #f)) (dbi:for-each-row (lambda (output) (lambda (tid) ;; Actually this should not be needed as mystart cannot be simultaneously less than and test-id same as (if (not (equal? tid test-id)) |
︙ |
Modified portlogger.scm from [581ebea116] to [40aae0c748].
︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | + | ;; implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ;; PURPOSE. (require-extension (srfi 18) extras tcp s11n) (use sqlite3 srfi-1 posix srfi-69 hostinfo dot-locking z3) (import (prefix sqlite3 sqlite3:)) (include "/nfs/site/disks/icf_fdk_cw_gwa002/srehman/fossil/dbi/dbi.scm") (import (prefix dbi dbi:)) (declare (unit portlogger)) (declare (uses db)) ;; lsof -i |
︙ | |||
62 63 64 65 66 67 68 | 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 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 | - + - - - - + + + + - + - - + + - - - + + + - + | (debug:print 0 *default-log-port* " message: " ((condition-property-accessor 'exn 'message) exn)) (debug:print 0 *default-log-port* "exn=" (condition->list exn)) (if (file-exists? fname)(delete-file fname)) ;; brutally get rid of it (print-call-chain (current-error-port))) (let* (;; (lock (obtain-dot-lock fname 2 9 10)) (db (portlogger:open-db fname)) (res (apply proc db params))) |
︙ | |||
137 138 139 140 141 142 143 | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | - + - + | (debug:print 0 *default-log-port* "Continuing anyway.")) (portlogger:take-port db portnum)) portnum)) ;; set port to "released", "failed" etc. ;; (define (portlogger:set-port db portnum value) |
︙ | |||
172 173 174 175 176 177 178 | 173 174 175 176 177 178 179 180 181 182 183 | - + | ((set) (let ((port (cadr args)) (state (caddr args))) (portlogger:set-port db (if (number? port) port (string->number port)) state) state)) ((failed)(portlogger:set-failed db (string->number (cadr args))) 'failed))))) |
Modified sdb.scm from [0256a92e53] to [ede55c5109].
︙ | |||
53 54 55 56 57 58 59 | 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 | - + - + | (dbi:exec sdb "INSERT OR IGNORE INTO strs (str) VALUES (?);" str)) (define (sdb:string->id sdb str-cache str) (let ((id (hash-table-ref/default str-cache str #f))) (if (not id) (dbi:for-each-row (lambda (sid) |
︙ |
Modified tests.scm from [63786038c0] to [9894ea1171].
︙ | |||
11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | + + + | ;;====================================================================== ;; Tests ;;====================================================================== (use sqlite3 srfi-1 posix regex regex-case srfi-69 dot-locking tcp directory-utils) (import (prefix sqlite3 sqlite3:)) (include "/nfs/site/disks/icf_fdk_cw_gwa002/srehman/fossil/dbi/dbi.scm") (import (prefix dbi dbi:)) (require-library stml) (declare (unit tests)) (declare (uses lock-queue)) (declare (uses db)) (declare (uses tdb)) (declare (uses common)) |
︙ | |||
1327 1328 1329 1330 1331 1332 1333 | 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 | - + - + | (let* ((testdat (rmt:get-test-info-by-id run-id test-id))) (and testdat (equal? (test:get-state testdat) "KILLREQ")))) (define (test:tdb-get-rundat-count tdb) (if tdb (let ((res 0)) |
︙ |