473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
|
;; 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
;;
|
>
|
|
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
|
;; 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
;;
|