Overview
Comment: | datashare - get implemented, ref count records now updated |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.60 |
Files: | files | file ages | folders |
SHA1: |
bd5633a585618d3355a7582e32413843 |
User & Date: | matt on 2014-09-17 01:00:51 |
Other Links: | branch diff | manifest | tags |
Context
2014-09-18
| ||
10:56 | Renamed datashare binary to sd. check-in: da7ebf6c50 user: mrwellan tags: v1.60 | |
2014-09-17
| ||
01:00 | datashare - get implemented, ref count records now updated check-in: bd5633a585 user: matt tags: v1.60 | |
2014-09-16
| ||
23:17 | datashare list-areas, list-versions working, publish partially working check-in: 0805063fb3 user: matt tags: v1.60 | |
Changes
Modified datashare.scm from [4a97ac5e61] to [b4dde544c7].
︙ | |||
51 52 53 54 55 56 57 58 | 51 52 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 | + + + - - + + + + + - - - + + | (define *datashare:current-tab-number* 0) (define *args-hash* (make-hash-table)) (define datashare:help (conc "Usage: datashare [action [params ...]] Note: run datashare without parameters to start the gui. list-areas : List the allowed areas list-versions <area> : List versions available in <area> options : -full, -vpatt patt |
︙ | |||
190 191 192 193 194 195 196 | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | - + + + + + + + + + + + + + + + + + + + + + | (define (datashare:set-latest db id area version-name iteration) (let* ((rec (datashare:get-pkg-record db area version-name iteration)) (latest-id (datashare:get-id db area "latest" 0)) (stored-path (datashare:pkg-get-stored_path rec))) (if latest-id ;; have a record - bump the link pointer (datashare:set-stored-path db latest-id stored-path) (datashare:register-data db area "latest" 'link "auto" "na" stored-path "latest data")))) |
︙ | |||
260 261 262 263 264 265 266 | 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | + + + + + + + + + + + + + + + + + + + + + + + - + - + | (set! res (cons (list->vector (cons a b)) res))) db (conc "SELECT id,area,version_name,store_type,copied,source_path,iteration,submitter,datetime,storegrp,datavol,quality,disk_id,comment,stored_path " " FROM pkgs WHERE area like ? AND version_name LIKE ? AND iteration " iter-filter ";") area-filter version-filter) (reverse res))) (define (datashare:get-pkg db area-name version-name #!key (iteration #f)) (let ((dat '()) (res #f)) (sqlite3:for-each-row ;; replace with fold ... (lambda (a . b) (set! dat (cons (list->vector (cons a b)) dat))) db (conc "SELECT id,area,version_name,store_type,copied,source_path,iteration,submitter,datetime,storegrp,datavol,quality,disk_id,comment,stored_path " " FROM pkgs WHERE area=? AND version_name=? ORDER BY iteration ASC;") area-name version-name) ;; now filter for iteration, either max if #f or specific one (if (null? dat) #f (let loop ((hed (car dat)) (tal (cdr dat)) (cur 0)) (let ((itr (datashare:pkg-get-iteration hed))) (if (equal? itr iteration) ;; this is the one if iteration is specified hed (if (null? tal) hed (loop (car tal)(cdr tal))))))))) |
︙ | |||
411 412 413 414 415 416 417 418 419 420 421 422 423 424 | 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 | + | (version-tb (iup:textbox #:expand "HORIZONTAL")) ;; #:size "50x")) (areas-sel (iup:listbox #:expand "HORIZONTAL" #:dropdown "YES")) (component (iup:listbox #:expand "HORIZONTAL" #:dropdown "YES" )) (version-val (iup:textbox #:expand "HORIZONTAL" #:size "50x")) ;; (copy-link (iup:toggle #:expand "HORIZONTAL")) ;; (iteration (iup:textbox #:expand "YES" #:size "20x")) ;; (iteration (iup:textbox #:expand "HORIZONTAL" #:size "20x")) (area-filter (iup:textbox #:expand "HORIZONTAL" #:value "%")) (comment-tb (iup:textbox #:expand "YES" #:multiline "YES")) (source-tb (iup:textbox #:expand "HORIZONTAL" #:value (or (configf:lookup configdat "settings" "basepath") ""))) (publish (lambda (publish-type) (let* ((area-num (or (string->number (iup:attribute areas-sel "VALUE")) 0)) (area-dat (if (> area-num 0)(list-ref areas (- area-num 1))'("NOT SELECTED" "NOT SELECTED"))) |
︙ | |||
450 451 452 453 454 455 456 | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | - + + | ;; (pp areas) (fold (lambda (areadat num) ;; (print "Adding num=" num ", areadat=" areadat) (iup:attribute-set! areas-sel (conc num) (car areadat)) (+ 1 num)) 1 areas) (iup:vbox |
︙ | |||
661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 | 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + | (if (file-exists? fname) ;; (ini:read-ini fname) (read-config fname #f #t) (make-hash-table)))) (define (datashare:process-action configdat action . args) (case (string->symbol action) ((get) (if (< (length args) 2) (begin (print "ERROR: Missing arguments; " (string-intersperse args ", ")) (exit 1)) (let* ((basepath (configf:lookup configdat "settings" "basepath")) (db (datashare:open-db configdat)) (area (car args)) (version (cadr args)) ;; iteration (remargs (args:get-args args '("-i") '() args:arg-hash 0)) (iteration (if (args:get-arg "-i")(string->number (args:get-arg "-i")) #f)) (curr-record (datashare:get-pkg db area version iteration: iteration))) (if (not curr-record) (begin (print "ERROR: No matching record found; area=" area ", version=" version ", iteration=" (if iteration iteration "(max)")) (exit 1)) (let* ((stored-path (datashare:pkg-get-stored_path curr-record)) (source-type (datashare:pkg-get-store_type curr-record)) (source-path (case source-type ;; (equal? source-type "link")) ((link) (datashare:pkg-get-source-path curr-record)) ((copy) stored-path) (else #f))) (dest-stub (configf:lookup configdat "areas" area)) (target-path (conc basepath "/" dest-stub))) (datashare:build-dir-make-link stored-path target-path) (datashare:record-pkg-ref db (datashare:pkg-get-id curr-record) target-path) (sqlite3:finalize! db) (print "Creating link from " stored-path " to " target-path)))))) ((publish) (if (< (length args) 3) (begin (print "ERROR: Missing arguments; " (string-intersperse args ", ")) (exit 1)) (let* ((srcpath (list-ref args 0)) (areaname (list-ref args 1)) (version (list-ref args 2)) |
︙ | |||
702 703 704 705 706 707 708 | 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 | - - - - - - - - - - + | (vector-ref x 1) (vector-ref x 2) (conc "\"" (time->string (seconds->local-time (vector-ref x 3))) "\"") (conc "\"" (vector-ref x 4) "\"")) (print (vector-ref x 0)))) versions) (sqlite3:finalize! db))))) |
︙ |