Commit 654d6baf authored by Dave Griffiths's avatar Dave Griffiths
Browse files

raspberry pi server semapore sync

parent 864e89a8
......@@ -273,7 +273,8 @@
" as a on a.entity_id = e.entity_id "
"join " table "_value_" (ktv-type ktv2)
" as b on b.entity_id = e.entity_id "
"where e.entity_type = ? and a.attribute_id = ? and b.attribute_id =? and a.value = ? and b.value > DateTime(?) ")
"where e.entity_type = ? and a.attribute_id = ? "
"and b.attribute_id = ? and a.value = ? and b.value > DateTime(?) ")
type (ktv-key ktv) (ktv-key ktv2) (ktv-value ktv) (ktv-value ktv2))))
(msg (db-status db))
(if (null? s)
......
......@@ -963,10 +963,8 @@ public class StarwispBuilder
}
if (type.equals("button-grid")) {
Log.i("starwisp","button-grid update");
LinearLayout horiz = (LinearLayout)vv;
if (token.equals("grid-buttons")) {
Log.i("starwisp","button-grid contents");
horiz.removeAllViews();
JSONArray params = arr.getJSONArray(3);
......
......@@ -127,33 +127,31 @@
(insert-entity-wholesale db table entity-type uid 1 0 ktvlist)
uid))
(define sema (make-semaphore 1))
;; all the parameters - for syncing purposes
(define (insert-entity-wholesale db table entity-type unique-id dirty version ktvlist)
(msg "1" (db-status db))
(semaphore-wait sema)
(db-exec db "begin transaction")
(let ((id (db-insert
db (string-append
"insert into " table "_entity values (null, ?, ?, ?, ?)")
entity-type unique-id dirty version)))
;; create the attributes if they are new, and validate them if they exist
; (db-exec db "begin transaction")
(for-each
(lambda (ktv)
(find/add-attribute-type db table entity-type (ktv-key ktv) (ktv-type ktv)))
ktvlist)
(msg "4" (db-status db))
;; add all the keys
(for-each
(lambda (ktv)
(insert-value db table id ktv))
ktvlist)
(msg "5" (db-status db))
; (db-exec db "end transaction")
(msg "6" (db-status db))
(db-exec db "end transaction")
(semaphore-post sema)
id))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment