write track data to database, JSON-encoded
This commit is contained in:
parent
56467cd4c1
commit
c188ed2baf
3 changed files with 7 additions and 4 deletions
|
@ -6,7 +6,7 @@
|
|||
:version "0.0.1"
|
||||
:homepage "https://www.cyberconcepts.org"
|
||||
:description ""
|
||||
:depends-on (:dbi :local-time :str :sxql)
|
||||
:depends-on (:com.inuoe.jzon :dbi :local-time :str :sxql)
|
||||
:components ((:file "forge/forge")
|
||||
(:file "storage/storage")
|
||||
(:file "storage/tracking" :depends-on ("storage/storage"))
|
||||
|
|
|
@ -4,7 +4,8 @@
|
|||
|
||||
(defpackage :scopes/storage/tracking
|
||||
(:use :common-lisp)
|
||||
(:local-nicknames (:storage :scopes/storage))
|
||||
(:local-nicknames (:jzon :com.inuoe.jzon)
|
||||
(:storage :scopes/storage))
|
||||
(:export #:track #:trackid #:head #:head-proplist #:time-stamp #:data
|
||||
#:container
|
||||
#:make-item
|
||||
|
@ -51,7 +52,7 @@
|
|||
(if trid (setf (getf vl :trackid) trid))
|
||||
(if ts (setf (getf vl :timestamp)
|
||||
(storage:timestamp-to-sql (engine track) ts)))
|
||||
(if data (setf (getf vl :data) data)))
|
||||
(if data (setf (getf vl :data) (jzon:stringify data))))
|
||||
vl))
|
||||
|
||||
(defun insert (track)
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
(t:show-result)))
|
||||
|
||||
(defun test-track (st)
|
||||
(let (cont tr)
|
||||
(let (cont tr (data (make-hash-table :test 'equalp)))
|
||||
(setf cont (make-instance 'tracking:container :storage st))
|
||||
(storage:drop-table st :tracks)
|
||||
(tracking:create-table cont)
|
||||
|
@ -46,6 +46,8 @@
|
|||
(== (tracking:head tr) '("t01" "john"))
|
||||
(== (tracking:head-proplist tr) '(:username "john" :taskid "t01"))
|
||||
(== (tracking:data tr) nil)
|
||||
(setf (gethash :desc data) "scopes/storage: queries")
|
||||
(setf (tracking:data tr) data)
|
||||
(tracking:insert tr)
|
||||
(== (tracking:trackid tr) 1)
|
||||
))
|
||||
|
|
Loading…
Add table
Reference in a new issue