insert working with real data from track object
This commit is contained in:
parent
d4c2db9f89
commit
ed457efd53
1 changed files with 16 additions and 9 deletions
|
@ -5,7 +5,7 @@
|
||||||
(defpackage :scopes/storage/tracking
|
(defpackage :scopes/storage/tracking
|
||||||
(:use :common-lisp)
|
(:use :common-lisp)
|
||||||
(:local-nicknames (:storage :scopes/storage))
|
(:local-nicknames (:storage :scopes/storage))
|
||||||
(:export #:track #:head #:time-stamp #:data
|
(:export #:track #:head #:time-stamp #:data #:proplist
|
||||||
#:container
|
#:container
|
||||||
#:make-item
|
#:make-item
|
||||||
#:insert
|
#:insert
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
(defclass track ()
|
(defclass track ()
|
||||||
((trackid :initform nil)
|
((trackid :initform nil)
|
||||||
(head :accessor head :initarg :head)
|
(head :accessor head :initarg :head)
|
||||||
(time-stamp :accessor time-stamp) :initform nil
|
(time-stamp :accessor time-stamp :initform nil)
|
||||||
(data :accessor data :initform nil)
|
(data :accessor data :initform nil)
|
||||||
(container :reader container :initarg :container)))
|
(container :reader container :initarg :container)))
|
||||||
|
|
||||||
|
@ -31,12 +31,19 @@
|
||||||
(defun make-item (cont &rest head)
|
(defun make-item (cont &rest head)
|
||||||
(funcall (slot-value cont 'item-factory) cont head))
|
(funcall (slot-value cont 'item-factory) cont head))
|
||||||
|
|
||||||
(defun value-list (track)
|
(defun head-proplist (track)
|
||||||
(let ((vl (head track))
|
(let (pl (hv (head track)))
|
||||||
(data (data track))
|
(dolist (hf (head-fields (container track)))
|
||||||
(ts (time-stamp track)))
|
(setf (getf pl hf) (if (car hv) (car hv) ""))
|
||||||
(if ts (setf (getf vl :time-stamp) ts))
|
(setf hv (cdr hv)))
|
||||||
(if data (setf (getf vl :data) data))
|
pl))
|
||||||
|
|
||||||
|
(defun proplist (track)
|
||||||
|
(let ((vl (head-proplist track)))
|
||||||
|
(with-slots ((trid trackid) (ts time-stamp) data) track
|
||||||
|
(if trid (setf (getf vl :trackid) trid))
|
||||||
|
(if ts (setf (getf vl :timestamp) ts))
|
||||||
|
(if data (setf (getf vl :data) data)))
|
||||||
vl))
|
vl))
|
||||||
|
|
||||||
(defun insert (track)
|
(defun insert (track)
|
||||||
|
@ -45,7 +52,7 @@
|
||||||
(table (storage:qualified-table-name st (table-name cont))))
|
(table (storage:qualified-table-name st (table-name cont))))
|
||||||
(storage:do-sql st
|
(storage:do-sql st
|
||||||
(sxql:insert-into table
|
(sxql:insert-into table
|
||||||
(sxql:set= :taskid "t01")))))
|
(apply #'sxql:make-clause ':set= (proplist track))))))
|
||||||
|
|
||||||
(defun create-table (cont)
|
(defun create-table (cont)
|
||||||
(let*
|
(let*
|
||||||
|
|
Loading…
Add table
Reference in a new issue