9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
-
-
+
+
-
+
|
;; PURPOSE.
;;======================================================================
;;======================================================================
;; Database access
;;======================================================================
(require-extension (srfi 18) extras tcp rpc)
(import (prefix rpc rpc:))
(require-extension (srfi 18) extras tcp) ;; rpc)
;; (import (prefix rpc rpc:))
(use sqlite3 srfi-1 posix regex regex-case srfi-69 csv-xml s11n)
(use sqlite3 srfi-1 posix regex regex-case srfi-69 csv-xml s11n md5 message-digest)
(import (prefix sqlite3 sqlite3:))
(use zmq)
(declare (unit db))
(declare (uses common))
(declare (uses keys))
|
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
|
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
|
-
-
-
+
+
+
|
(let* ((push-socket (vector-ref zmq-sockets 0))
(sub-socket (vector-ref zmq-sockets 1))
(query-id (conc (server:get-client-signature) "-" (message-digest-string (md5-primitive) (conc params))))
(zdat (db:obj->string (vector query-id params))) ;; (with-output-to-string (lambda ()(serialize params))))
(res #f)
(get-res (lambda ()
(db:string->obj (if *client-non-blocking-mode*
(receive-message* zmq-socket)
(receive-message zmq-socket))))))
(send-message zmq-socket zdat)
(receive-message* sub-socket)
(receive-message sub-socket))))))
(send-message push-socket zdat)
(let loop ((res (get-res)))
(if res res
(begin
(thread-sleep! 0.5)
(get-res))))))
(define (cdb:set-verbosity zmq-socket val)
|