85d879803c88aa036934d36977a10b5d28b70aaa,debug_toolbar/views.py,,sql_explain,#,21

Before Change


    from debug_toolbar.panels.sql import reformat_sql
    sql = request.GET.get("sql", "")
    if sql.lower().startswith("select"):
        params = simplejson.loads(request.GET.get("params", ""))
        cursor = connection.cursor()
        cursor.execute("EXPLAIN %s" % (sql,), params)
        headers = [d[0] for d in cursor.description]
        result = cursor.fetchall()

After Change


    sql = request.GET.get("sql", "")
    params = request.GET.get("params", "")
    hash = sha_constructor(settings.SECRET_KEY + sql + params).hexdigest()
    if hash != request.GET.get("hash", ""):
        return HttpResponse("<h3>Tamper alert</h3>") // SQL Tampering alert
    if sql.lower().startswith("select"):
        params = simplejson.loads(params)
        cursor = connection.cursor()
        cursor.execute("EXPLAIN %s" % (sql,), params)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: jazzband/django-debug-toolbar
Commit Name: 85d879803c88aa036934d36977a10b5d28b70aaa
Time: 2008-09-24
Author: rob@cogit8.org
File Name: debug_toolbar/views.py
Class Name:
Method Name: sql_explain


Project Name: sentinel-hub/eo-learn
Commit Name: d3baf96418c790cad57c007cf43224866844ae99
Time: 2019-11-29
Author: matic.lubej@sinergise.com
File Name: core/eolearn/core/eodata.py
Class Name: EOPatch
Method Name: load_aws


Project Name: UFAL-DSG/tgen
Commit Name: 386917355bbe616ec57881ba8a950a49cfbef9b0
Time: 2015-12-18
Author: odusek@ufal.mff.cuni.cz
File Name: tgen/parallel_percrank_train.py
Class Name: ParallelRanker
Method Name: train