added wrappers, temp disabled all modules

This commit is contained in:
BuildTools
2015-11-23 22:17:40 +01:00
parent ab42a0cb65
commit 70b4db5318
9 changed files with 217 additions and 115 deletions

33
mysql_utils.py Normal file
View File

@@ -0,0 +1,33 @@
import mysqlhack
from secrets import *
from thread_utils import *
from com.ziclix.python.sql import zxJDBC
from traceback import format_exc as trace
class mysql_connect:
def __init__(self):
self.conn = zxJDBC.connect(mysql_database, mysql_user, mysql_pass, "com.mysql.jdbc.Driver")
self.curs = self.conn.cursor()
def execute(self, query, args=None):
if args is None:
return self.curs.execute(query)
else:
return self.curs.execute(query, args)
def fetchall(self):
return self.curs.fetchall()
def __enter__(self):
return self
def __exit__(self, exc_type, exc_inst, exc_tb):
if exc_type is None:
try:
self.conn.commit()
self.curs.close()
self.conn.close()
except:
print(trace())
else:
print(exc_tb)