Index: db.scm
==================================================================
--- db.scm
+++ db.scm
@@ -446,11 +446,12 @@
 (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 "'"))
+			       (let ((wildtype (if (substring-index "%" patt) "LIKE" "GLOB")))
+				 (conc fieldname " " wildtype " '" patt "'")))
 			     (if (null? patts)
 				 '("")
 				 patts))
 			comparator)))
 

Index: runs.scm
==================================================================
--- runs.scm
+++ runs.scm
@@ -736,18 +736,20 @@
 						      sort-by: (case action
 								 ((remove-runs) 'rundir)
 								 (else          'event_time)))
 			       '()))
 		(lasttpath "/does/not/exist/I/hope"))
-
+	   (debug:print 4 "INFO: runs:operate-on run=" run ", header=" header)
 	   (if (not (null? tests))
 	       (begin
 		 (case action
 		   ((remove-runs)
 		    (debug:print 1 "Removing tests for run: " runkey " " (db:get-value-by-header run header "runname")))
 		   ((set-state-status)
 		    (debug:print 1 "Modifying state and staus for tests for run: " runkey " " (db:get-value-by-header run header "runname")))
+		   ((print-run)
+		    (debug:print 1 "Printing info for run " runkey ", run=" run ", tests=" tests ", header=" header))
 		   (else
 		    (print "INFO: action not recognised " action)))
 		 (for-each
 		  (lambda (test)
 		    (let* ((item-path (db:test-get-item-path test))

Index: tests/Makefile
==================================================================
--- tests/Makefile
+++ tests/Makefile
@@ -27,10 +27,12 @@
 	cd simplerun;cp ../../*_records.scm .;perl -pi.bak -e 's/define-inline/define/' *_records.scm
 	cd simplerun;echo '(load "../tests.scm")' | $(MEGATEST) -repl -debug $(DEBUG)
 
 test2 : fullprep
 	cd fullrun;$(MEGATEST) -runtests ez_pass,runfirst -reqtarg ubuntu/nfs/none -itempatt a/1 :runname $(RUNNAME)_a $(SERVER)
+	cd fullrun;sleep 20;megatest -target ubuntu/nfs/none :runname $(RUNNAME) -set-state-status :state COMPLETED :status FORCED -testpatt runfirst -itempatt ''
+
 
 test3 : fullprep
 	cd fullrun;$(MEGATEST) -runtests runfirst -reqtarg ubuntu/nfs/none :runname $(RUNNAME)_b  $(SERVER) -debug 10
 
 test4 : fullprep

Index: tests/tests.scm
==================================================================
--- tests/tests.scm
+++ tests/tests.scm
@@ -100,10 +100,17 @@
 						    "myrun" 
 						    "new"
 						    "n/a" 
 						    "bob")))
 (define keys (db:get-keys *db*))
+
+;;======================================================================
+;; D B
+;;======================================================================
+(test #f "FOO LIKE 'abc%def'" (db:patt->like "FOO" "abc%def"))
+(test #f "SYSTEM,RELEASE,id,runname,state,status,owner,event_time" (car (runs:get-std-run-fields keys '("id" "runname" "state" "status" "owner" "event_time"))))
+(test #f #t (list? (runs:operate-on 'print "%" "%" "%")))
 
 ;;(test "update-test-info" #t (test-update-meta-info *db* 1 "nada" 
 (setenv "BLAHFOO" "1234")
 (unsetenv "NADAFOO")
 (test "env temp overrides" "xyz" (let ((prevvals (alist->env-vars '(("BLAHFOO" 4321)("NADAFOO" xyz))))