server/sources/native.py
changeset 2619 535bc210f799
parent 2618 ff9b0d5bd884
child 2620 de68f84b8f54
equal deleted inserted replaced
2618:ff9b0d5bd884 2619:535bc210f799
   307         """
   307         """
   308         if server.DEBUG & server.DBG_RQL:
   308         if server.DEBUG & server.DBG_RQL:
   309             print 'RQL FOR NATIVE SOURCE %s: %s' % (self.uri, union.as_string())
   309             print 'RQL FOR NATIVE SOURCE %s: %s' % (self.uri, union.as_string())
   310             if varmap:
   310             if varmap:
   311                 print 'using varmap', varmap
   311                 print 'using varmap', varmap
   312             if args:
   312             if server.DEBUG & server.DBG_MORE:
   313                 print 'args', args
   313                 print 'args', args
   314             if server.DEBUG & server.DBG_MORE:
       
   315                 print 'cache key', cachekey
   314                 print 'cache key', cachekey
   316                 print 'solutions', ','.join(str(s.solutions) for s in union.children)
   315                 print 'solutions', ','.join(str(s.solutions) for s in union.children)
   317         # remember number of actually selected term (sql generation may append some)
   316         # remember number of actually selected term (sql generation may append some)
   318         if cachekey is None:
   317         if cachekey is None:
   319             self.no_cache += 1
   318             self.no_cache += 1
   436         """Execute a query.
   435         """Execute a query.
   437         it's a function just so that it shows up in profiling
   436         it's a function just so that it shows up in profiling
   438         """
   437         """
   439         cursor = session.pool[self.uri]
   438         cursor = session.pool[self.uri]
   440         if server.DEBUG & server.DBG_SQL:
   439         if server.DEBUG & server.DBG_SQL:
   441             print 'exec', query, args, session.pool.connection(self.uri)._cnx
   440             print 'exec', query, args
   442         try:
   441         try:
   443             # str(query) to avoid error if it's an unicode string
   442             # str(query) to avoid error if it's an unicode string
   444             cursor.execute(str(query), args)
   443             cursor.execute(str(query), args)
   445         except Exception, ex:
   444         except Exception, ex:
   446             self.critical("sql: %r\n args: %s\ndbms message: %r",
   445             self.critical("sql: %r\n args: %s\ndbms message: %r",