<commit_before>import MySQLdb
import host_site

#db = MySQLdb.connect(host="172.16.17.32:80", # our host, do not modify
#user="sysadmin", # your username
#passwd="<PASSWORD>", # your password
#db="PositiveFish") # name of the data base

db = MySQLdb.connect(host="172.16.31.10", # our host, do not modify
                     user="root", # your username
                     passwd="<PASSWORD>", # your password
                     db="visdb") # name of the data base

initCur = db.cursor()
initCur.execute("CREATE TABLE IF NOT EXISTS users (username VARCHAR(40), password VARCHAR(40), firstname VARCHAR(40), lastname VARCHAR(40), email VARCHAR(80), teamcaptain BOOLEAN, accessibilityNeeds BOOLEAN)")
initCur.execute("CREATE TABLE IF NOT EXISTS routes (name VARCHAR(40), city VARCHAR(40), lattitudeStart FLOAT, longitudeStart FLOAT, lattitudeEnd FLOAT, longitudeEnd FLOAT, isAccessible BOOLEAN, transport VARCHAR(40))")
initCur.execute("CREATE TABLE IF NOT EXISTS faq (question VARCHAR(8000), answer VARCHAR(8000))")
initCur.execute("CREATE TABLE IF NOT EXISTS sessions (username VARCHAR(40), cookieVal VARCHAR(40))")

initCur.execute("CREATE TABLE IF NOT EXISTS provinces_in_country (country VARCHAR(40), province VARCHAR(40))")
initCur.execute("CREATE TABLE IF NOT EXISTS cities_in_province (province VARCHAR(40), city VARCHAR(40))")

initCur.execute("INSERT INTO faq (question, answer) VALUES ('What is Trick-or-eat?', 'Trick-or-eat is a charitable organization about collecting food from donors on Halloween instead of candy in order to provide to the less fortunate.')")

initCur.close()


def getFaq():
    cur = db.cursor()
    cur.execute("SELECT * FROM faq")
    
    faqArray = cur.fetchall()
    cur.close()
    return faqArray


def valLogin(username, password):<commit_msg>Added DISTINCT to faq initialize<commit_after>import MySQLdb
import host_site

#db = MySQLdb.connect(host="172.16.17.32:80", # our host, do not modify
#user="sysadmin", # your username
#passwd="<PASSWORD>", # your password
#db="PositiveFish") # name of the data base

db = MySQLdb.connect(host="172.16.31.10", # our host, do not modify
                     user="root", # your username
                     passwd="<PASSWORD>", # your password
                     db="visdb") # name of the data base

initCur = db.cursor()
initCur.execute("CREATE TABLE IF NOT EXISTS users (username VARCHAR(40), password VARCHAR(40), firstname VARCHAR(40), lastname VARCHAR(40), email VARCHAR(80), teamcaptain BOOLEAN, accessibilityNeeds BOOLEAN)")
initCur.execute("CREATE TABLE IF NOT EXISTS routes (name VARCHAR(40), city VARCHAR(40), lattitudeStart FLOAT, longitudeStart FLOAT, lattitudeEnd FLOAT, longitudeEnd FLOAT, isAccessible BOOLEAN, transport VARCHAR(40))")
initCur.execute("CREATE TABLE IF NOT EXISTS faq (question VARCHAR(8000), answer VARCHAR(8000))")
initCur.execute("CREATE TABLE IF NOT EXISTS sessions (username VARCHAR(40), cookieVal VARCHAR(40))")

initCur.execute("CREATE TABLE IF NOT EXISTS provinces_in_country (country VARCHAR(40), province VARCHAR(40))")
initCur.execute("CREATE TABLE IF NOT EXISTS cities_in_province (province VARCHAR(40), city VARCHAR(40))")

initCur.execute("INSERT INTO faq (question, answer) VALUES ('What is Trick-or-eat?', 'Trick-or-eat is a charitable organization about collecting food from donors on Halloween instead of candy in order to provide to the less fortunate.')")

initCur.close()


def getFaq():
    cur = db.cursor()
    cur.execute("SELECT DISTINCT * FROM faq")
    
    faqArray = cur.fetchall()
    cur.close()
    return faqArray


def valLogin(username, password):
{'fraction_non_alphanumeric': 0.11598224195338513, 'fraction_numerical': 0.03107658157602664, 'mean_word_length': 4.740445859872612, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2424354', 'n_tokens_mistral': 1187, 'n_tokens_neox': 1040, 'n_words': 352}