filters=[], params=[], fields=[],
sort=None, limit=None, offset=None,
):
- self.uuid=uniqid()
+ self.query_uuid=uniqid()
# settable
self.action=action
self.method=method
self.filters=filters
self.params=params
self.fields=fields
+ # xxx this is unused for now
self.sort=sort
self.limit=limit
self.offset=offset
- # internal data
+ # internal data - likewise, this is unused as of yet, although we have
+ # (untested) code below in analyze_subqueries to compute these..
self.analyzed_query=None
self.subqueries = {}
+ def __repr__ (self):
+ result="Q: id=%(query_uuid)s - %(action)s on %(method)s "%self.__dict__
+ result += " with %d filters, %d fields"%(len(self.filters),len(self.params))
+ return result
+
def to_json (self):
- uuid=self.uuid
+ query_uuid=self.query_uuid
a=self.action
m=self.method
t=self.timestamp
for (method, subquery) in self.subqueries.iteritems()])
sq="{%s}"%sq
- return """ new ManifoldQuery('%(a)s', '%(m)s', '%(t)s', %(f)s, %(p)s, %(c)s, %(unique)s, '%(uuid)s', %(aq)s, %(sq)s)"""%locals()
+ return """ new ManifoldQuery('%(a)s', '%(m)s', '%(t)s', %(f)s, %(p)s, %(c)s, %(unique)s, '%(query_uuid)s', %(aq)s, %(sq)s)"""%locals()
# this builds a ManifoldQuery object from a dict as received from javascript through its ajax request
# e.g. here's what I captured from the server's output
setattr(self, arg, d[key])
break
-
-
+ # not used yet ..
def analyze_subqueries(self):
analyzed_query = ManifoldQuery()
- analyzed_query.uuid = self.uuid
+ analyzed_query.query_uuid = self.query_uuid
analyzed_query.action = self.action
analyzed_query.method = self.method
analyzed_query.timestamp = self.timestamp