444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
|
;; make a query (fieldname like 'patt1' OR fieldname
(define (db:patt->like fieldname pattstr #!key (comparator " OR "))
(let ((patts (if (string? pattstr)
(string-split pattstr ",")
'("%"))))
(string-intersperse (map (lambda (patt)
(conc fieldname " LIKE '" patt "'"))
(if (null? patts)
'("")
patts))
comparator)))
;; replace header and keystr with a call to runs:get-std-run-fields
;;
|
>
|
|
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
|
;; make a query (fieldname like 'patt1' OR fieldname
(define (db:patt->like fieldname pattstr #!key (comparator " OR "))
(let ((patts (if (string? pattstr)
(string-split pattstr ",")
'("%"))))
(string-intersperse (map (lambda (patt)
(let ((wildtype (if (substring-index "%" patt) "LIKE" "GLOB")))
(conc fieldname " " wildtype " '" patt "'")))
(if (null? patts)
'("")
patts))
comparator)))
;; replace header and keystr with a call to runs:get-std-run-fields
;;
|