4563e383962690cc196f4551f217d488501b660e,bin/count_users_in_rooms.py,,,#,38

Before Change


    dbuser = config["database"]["user"]
    dbpass = config["database"]["password"]

    try:
        conn = psycopg2.connect("dbname="%s" user="%s" host="%s" port="%s" password="%s"" % (
            dbname, dbuser, dbhost, dbport, dbpass)
        )
    except:
        raise RuntimeError("could not connect to db")

    cur = conn.cursor()
    cur.execute(select count(*) from rooms_users_association_table)
    the_count = cur.fetchone()[0]

After Change


    if dbtype == "rdbms" and dbdriver.startswith("mysql"):
        import MySQLdb

        conn = MySQLdb.connect(passwd=dbpass, db=dbname, user=dbuser, host=dbhost, port=dbport)
        cur = conn.cursor()
        cur.execute(select count(*) from rooms_users_association_table)
        the_count = cur.fetchone()[0]

r_host, r_port = config["cache"]["host"].split(":")
r_db = config["cache"]["db"]
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: thenetcircle/dino
Commit Name: 4563e383962690cc196f4551f217d488501b660e
Time: 2019-12-29
Author: oscar.eriks@gmail.com
File Name: bin/count_users_in_rooms.py
Class Name:
Method Name:


Project Name: pymc-devs/pymc3
Commit Name: 5b2766aae94c0615aef2c8d6ac178428e6d28745
Time: 2008-07-20
Author: fonnesbeck@15d7aa0b-6f1a-0410-991a-d59f85d14984
File Name: pymc/database/mysql.py
Class Name: Trace
Method Name: _initialize


Project Name: commonsense/conceptnet5
Commit Name: 2a437760c9344a20a5785f5b4706950c911534b6
Time: 2015-04-08
Author: rob@luminoso.com
File Name: conceptnet5/formats/sql.py
Class Name: EdgeIndexReader
Method Name: random