Megatest

Check-in [c02687e1a4]
Login
Overview
Comment:Added debug to portlogger
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.60
Files: files | file ages | folders
SHA1: c02687e1a472de8126d30a671b83509b11c4afba
User & Date: matt on 2014-08-26 23:17:52
Other Links: branch diff | manifest | tags
Context
2014-08-27
04:20
More on portlogger check-in: 53b72738b7 user: matt tags: v1.60
2014-08-26
23:17
Added debug to portlogger check-in: c02687e1a4 user: matt tags: v1.60
23:14
Portlogger almost functional check-in: 0a3812f5e3 user: matt tags: v1.60
Changes

Modified portlogger.scm from [9171034404] to [39b1bee932].

38
39
40
41
42
43
44
45


46
47
48
49
50

51
52
53
54
55
56
57
58
59
60
61
62
63
64
  (let* ((qry1 (sqlite3:prepare db "INSERT INTO ports (port,state) VALUES (?,?);"))
	 (qry2 (sqlite3:prepare db "UPDATE ports SET state=? WHERE port=?;"))
	 (qry3 (sqlite3:prepare db "SELECT state FROM ports WHERE port=?;"))
	 (res  (sqlite3:with-transaction
		db
		(lambda ()
		  ;; (fold-row (lambda (var curr) (or var curr)) #f db "SELECT var FROM foo WHERE id=100;")
		  (let* ((curr (sqlite3:fold-row


				(lambda (var curr)
				  (or var curr))
				"not-tried"
				qry3
				portnum))

			 (res   (case (string->symbol curr)
				  ((released)  (sqlite3:execute qry2 "taken" portnum) 'taken)
				  ((not-tried) (sqlite3:execute qry1 portnum "taken") 'taken)
				  ((taken)                                            'already-taken)
				  ((failed)                                           'failed)
				  (else                                               'error))))
		    (print "curr=" curr " res=" res)
		    res)))))
    (sqlite3:finalize! qry1)
    (sqlite3:finalize! qry2)
    (sqlite3:finalize! qry3)
    res))

;; set port to "released", "failed" etc.







|
>
>





>
|
|
|
|
|
|
|







38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
  (let* ((qry1 (sqlite3:prepare db "INSERT INTO ports (port,state) VALUES (?,?);"))
	 (qry2 (sqlite3:prepare db "UPDATE ports SET state=? WHERE port=?;"))
	 (qry3 (sqlite3:prepare db "SELECT state FROM ports WHERE port=?;"))
	 (res  (sqlite3:with-transaction
		db
		(lambda ()
		  ;; (fold-row (lambda (var curr) (or var curr)) #f db "SELECT var FROM foo WHERE id=100;")
		  (let* ((curr #f)
			 (res  #f))
		    (set! curr (sqlite3:fold-row
				(lambda (var curr)
				  (or var curr))
				"not-tried"
				qry3
				portnum))
		    (print "curr=" curr)
		    (set! res (case (string->symbol curr)
				((released)  (sqlite3:execute qry2 "taken" portnum) 'taken)
				((not-tried) (sqlite3:execute qry1 portnum "taken") 'taken)
				((taken)                                            'already-taken)
				((failed)                                           'failed)
				(else                                               'error)))
		    (print "res=" res)
		    res)))))
    (sqlite3:finalize! qry1)
    (sqlite3:finalize! qry2)
    (sqlite3:finalize! qry3)
    res))

;; set port to "released", "failed" etc.