diff options
Diffstat (limited to 'searx/engines/mysql_server.py')
-rw-r--r-- | searx/engines/mysql_server.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/searx/engines/mysql_server.py b/searx/engines/mysql_server.py index be89eb86e..d949ee0bc 100644 --- a/searx/engines/mysql_server.py +++ b/searx/engines/mysql_server.py @@ -20,6 +20,7 @@ paging = True result_template = 'key-value.html' _connection = None + def init(engine_settings): global _connection # pylint: disable=global-statement @@ -30,13 +31,14 @@ def init(engine_settings): raise ValueError('only SELECT query is supported') _connection = mysql.connector.connect( - database = database, - user = username, - password = password, - host = host, + database=database, + user=username, + password=password, + host=host, auth_plugin=auth_plugin, ) + def search(query, params): query_params = {'query': query} query_to_run = query_str + ' LIMIT {0} OFFSET {1}'.format(limit, (params['pageno'] - 1) * limit) @@ -46,6 +48,7 @@ def search(query, params): return _fetch_results(cur) + def _fetch_results(cur): results = [] for res in cur: |