예제 #1
0
    def _additional_query_check(self):
        if not is_postgre():
            raise DbNotSupported, 'Only Postgre 8.3+'

        fts_config = self.engine._get_ts_config()
#        cursor = connection.cursor()
#        cursor.execute('SELECT count(*) as "cnt" FROM "pg_catalog"."pg_ts_config" WHERE "cfgname" = %s',
#            (fts_config, )
#        )
#        res = cursor.fetchone()
#        if res is None:
#            raise DbNotSupported, 'FTS configuration "%s" not supported at your database' % fts_config
#
#        cursor = connection.cursor()
#        cursor.execute('SELECT count(*) as "cnt" FROM "pg_catalog"."pg_ts_config" WHERE "cfgname" = %s',
#            (fts_config, )
#        )
        cursor = self._get_connection().cursor()
        cursor.execute(
            "SELECT numnode(plainto_tsquery(%s, %s))",
            (fts_config, self._get_fts_query())
        )
        res = cursor.fetchone()
        if res is None or int(res[0]) < 1:
            raise TooShortQuery
예제 #2
0
파일: naive.py 프로젝트: maizy/PonyLib
 def _additional_query_check(self):
     #TODO mysql and sqlite support
     if not is_postgre():
         raise DbNotSupported, 'SQLite and MySql aren\'t supported yet, will be in future releases'