def __get_tsquery(self, term, config, join_by, startswith, unaccent=True): operator = ' {} '.format(join_by) query = self.__startswith(term) if startswith else term query = adapt(operator.join(query)) return ("to_tsquery('{}', {})".format( config, self.__unaccent(query) if unaccent else query ))
def getquoted(self): # this is the important line: note how every object in the # list is adapted and then how getquoted() is called on it pobjs = [adapt(o) for o in self._seq] for obj in pobjs: if hasattr(obj, 'prepare'): obj.prepare(self._conn) qobjs = [o.getquoted() for o in pobjs] return b('(') + b(', ').join(qobjs) + b(')')
def getquoted(self): # this is the important line: note how every object in the # list is adapted and then how getquoted() is called on it pobjs = [adapt(o) for o in self._seq] for obj in pobjs: if hasattr(obj, 'prepare'): obj.prepare(self._conn) qobjs = [str(o.getquoted()) for o in pobjs] return '(' + ', '.join(qobjs) + ')'
def getquoted(self): # this is the important line: note how every object in the # list is adapted and then how getquoted() is called on it pobjs = [adapt(o) for o in self._seq] if self._conn is not None: for obj in pobjs: if hasattr(obj, 'prepare'): obj.prepare(self._conn) qobjs = [o.getquoted() for o in pobjs] return b('(') + b(', ').join(qobjs) + b(')')
def getquoted(self): # this is the important line: note how every object in the # list is adapted and then how getquoted() is called on it pobjs = [adapt(o) for o in self._seq] if self._conn is not None: for obj in pobjs: if hasattr(obj, "prepare"): obj.prepare(self._conn) qobjs = [o.getquoted() for o in pobjs] return b"(" + b", ".join(qobjs) + b")"
def _makesafe(x): """ Function that converts input into a PostgreSQL readable. """ return adapt(x).getquoted().decode()
def __quotes(word_list): return ['{}'.format(adapt(x.replace('\\', ''))) for x in word_list]