server/sources/rql2sql.py
branchstable
changeset 7704 0f49dd8e76b5
parent 7672 f31f9882c90f
child 7707 936530f8d32c
equal deleted inserted replaced
7701:e5ba5de1d485 7704:0f49dd8e76b5
  1436         if constant.type is None:
  1436         if constant.type is None:
  1437             return 'NULL'
  1437             return 'NULL'
  1438         value = constant.value
  1438         value = constant.value
  1439         if constant.type == 'etype':
  1439         if constant.type == 'etype':
  1440             return value
  1440             return value
  1441         if constant.type == 'Int' and  isinstance(constant.parent, SortTerm):
  1441         if constant.type == 'Int': # XXX Float?
  1442             return value
  1442             return str(value)
  1443         if constant.type in ('Date', 'Datetime'):
  1443         if constant.type in ('Date', 'Datetime'):
  1444             rel = constant.relation()
  1444             rel = constant.relation()
  1445             if rel is not None:
  1445             if rel is not None:
  1446                 rel._q_needcast = value
  1446                 rel._q_needcast = value
  1447             return self.keyword_map[value]()
  1447             return self.keyword_map[value]()
  1448         if constant.type == 'Boolean':
  1448         if constant.type == 'Boolean':
  1449             value = self.dbhelper.boolean_value(value)
  1449             return self.dbhelper.boolean_value(value)
  1450         if constant.type == 'Substitute':
  1450         if constant.type == 'Substitute':
  1451             try:
  1451             try:
  1452                 # we may found constant from simplified var in varmap
  1452                 # we may found constant from simplified var in varmap
  1453                 return self._mapped_term(constant, '%%(%s)s' % value)[0]
  1453                 return self._mapped_term(constant, '%%(%s)s' % value)[0]
  1454             except KeyError:
  1454             except KeyError: