X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=manifoldapi%2Fstatic%2Fjs%2Fmanifold-query.js;h=64eb3a7a24ecda573713bd02f7643e8c101674a0;hb=6d50afdbe1cda199df80acec6b21dd1d633f445f;hp=3116f84d6264d76ee9dd2401a9f6f31f39fa4205;hpb=8cd242571082562afa089d7da255c8234055f685;p=myslice.git diff --git a/manifoldapi/static/js/manifold-query.js b/manifoldapi/static/js/manifold-query.js index 3116f84d..64eb3a7a 100644 --- a/manifoldapi/static/js/manifold-query.js +++ b/manifoldapi/static/js/manifold-query.js @@ -1,3 +1,15 @@ +var guid = (function() { + function s4() { + return Math.floor((1 + Math.random()) * 0x10000) + .toString(16) + .substring(1); + } + return function() { + return s4() + s4() + '-' + s4() + '-' + s4() + '-' + + s4() + '-' + s4() + s4() + s4(); + }; +})(); + function ManifoldQuery(action, object, timestamp, filters, params, fields, unique, query_uuid, aq, sq) { // get, update, delete, create var action; @@ -131,7 +143,7 @@ INSERT INTO object VALUES(field=value) }); }; - if (this.analyzed_query !== undefined) + if (!!this.analyzed_query) query = this.analyzed_query; else query = this; @@ -257,7 +269,10 @@ INSERT INTO object VALUES(field=value) else this.unique = unique; - this.query_uuid = query_uuid; + if (typeof unique == "undefined") + this.query_uuid = guid(); + else + this.query_uuid = query_uuid; if (typeof aq == "undefined") this.analyzed_query = null;