+
+ // XXX We might need to update the corresponding update_query here
+ query_ext = manifold.query_store.find_query_ext(query.query_uuid);
+ query = query_ext.query;
+
+ // We don't prepare an update query if the result has more than 1 entry
+ if (result.length == 1) {
+ var res = result[0];
+
+ console.log("Locating update query for updating params", update_query);
+ update_query_ext = query_ext.update_query_ext;
+ update_query = update_query_ext.query;
+
+ // Testing whether the result has subqueries (one level deep only)
+ // iif the query has subqueries
+ var count = 0;
+ var obj = query.analyzed_query.subqueries;
+ for (method in obj) {
+ if (obj.hasOwnProperty(method)) {
+ var key = manifold.metadata.get_key(method);
+ if (!key)
+ continue;
+ if (key.length > 1)
+ continue;
+ key = key[0];
+ var sq_keys = [];
+ var records = res[method];
+ if (!records)
+ continue
+ $.each(records, function (i, obj) {
+ sq_keys.push(obj[key]);
+ });
+ update_query.params[method] = sq_keys;
+ count++;
+ }
+ }
+
+ if (count > 0) {
+ update_query_ext.disabled = false;
+ }
+
+ }
+
+
+
+ // We have results from the main query
+ // inspect subqueries and get the key for each
+
+ // XXX note that we might need the name for each relation, but
+ // this might be for SET_ADD, since we need to recursively find
+ // the path from the main query
+
+