3c8bfbcdc608b0a868e655d647da3c8a33aa7449,mindsdb/api/mysql/mysql_proxy/classes/sql_query.py,SQLQuery,parse_insert,#Any#,52

Before Change


    @staticmethod
    def parse_insert(sql):
        search = re.search(r"(\(.*\)).*(\(.*\))", sql)
        columns = search.groups()[0].split(",")
        columns = [x.strip("(` )") for x in columns]
        p = re.compile("\s*,\s*".join(["(".*")"] * len(columns)))
        values = re.search(p, search.groups()[1])
        values = [x.strip("( ")") for x in values.groups()]

After Change


        columns = columns[columns.find("(") + 1:columns.rfind(")")]
        values = values[values.find("(") + 1:values.rfind(")")]

        p = parse(f"select ({columns})")["select"]["value"]
        columns = p["literal"] if isinstance(p, dict) else p

        p = parse(f"select ({values})")["select"]["value"]
        values = p["literal"] if isinstance(p, dict) else p
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: mindsdb/mindsdb
Commit Name: 3c8bfbcdc608b0a868e655d647da3c8a33aa7449
Time: 2020-07-23
Author: stpmax@yandex.ru
File Name: mindsdb/api/mysql/mysql_proxy/classes/sql_query.py
Class Name: SQLQuery
Method Name: parse_insert


Project Name: andresriancho/w3af
Commit Name: 69ff07c2bf368ebc0d6f0700a9735451ed851999
Time: 2018-01-02
Author: andres.riancho@gmail.com
File Name: w3af/plugins/audit/global_redirect.py
Class Name: global_redirect
Method Name: _javascript_redirect


Project Name: elfi-dev/elfi
Commit Name: eb48b9b095e2200e1f7acbc6f448ff39f88c4145
Time: 2017-07-13
Author: jarno.lintusaari@aalto.fi
File Name: elfi/model/elfi_model.py
Class Name: NodeReference
Method Name: _give_name