Imported db password and user from secrets, added target_args
This commit is contained in:
13
helpers.py
13
helpers.py
@@ -14,6 +14,7 @@ from player import get_py_player
|
|||||||
from player import py_players
|
from player import py_players
|
||||||
|
|
||||||
#Imports for async query
|
#Imports for async query
|
||||||
|
from secrets import *
|
||||||
import mysqlhack
|
import mysqlhack
|
||||||
from com.ziclix.python.sql import zxJDBC
|
from com.ziclix.python.sql import zxJDBC
|
||||||
import threading
|
import threading
|
||||||
@@ -201,19 +202,19 @@ If you want your function to run sync in the case you are doing something spigot
|
|||||||
Example can be found in loginsecurity.py
|
Example can be found in loginsecurity.py
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def async_query(mysql_database,mysql_user,mysql_pass,query,args,target):
|
def async_query(mysql_database,query,query_args,target_args,target):
|
||||||
|
|
||||||
def async_query_t(mysql_database,mysql_user,mysql_pass,query,args,target):
|
def async_query_t(mysql_database,query,query_args,target_args,target):
|
||||||
db_conn = zxJDBC.connect("servercontrol.db")
|
db_conn = zxJDBC.connect(mysql_database, mysql_user, mysql_pass, "com.mysql.jdbc.Driver")
|
||||||
db_curs = db_conn.cursor()
|
db_curs = db_conn.cursor()
|
||||||
db_curs.execute(query,args)
|
db_curs.execute(query,query_args)
|
||||||
db_conn.commit()
|
db_conn.commit()
|
||||||
fetchall = db_curs.fetchall()
|
fetchall = db_curs.fetchall()
|
||||||
db_curs.close()
|
db_curs.close()
|
||||||
db_conn.close()
|
db_conn.close()
|
||||||
target(fetchall)
|
target(fetchall,target_args)
|
||||||
|
|
||||||
t = threading.Thread(target=async_query_t,args=(mysql_database,mysql_user,mysql_pass,query,args,target))
|
t = threading.Thread(target=async_query_t,args=(mysql_database,query,query_args,target_args,target))
|
||||||
t.daemon = True
|
t.daemon = True
|
||||||
t.start()
|
t.start()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user