1
0
Fork 0
mirror of https://github.com/yweber/lodel2.git synced 2026-07-06 23:50:48 +02:00

SQL: do queries in one function

This commit is contained in:
ArnAud 2015-11-19 12:05:04 +01:00
commit 9fdb73106d
2 changed files with 19 additions and 14 deletions

View file

@ -18,6 +18,17 @@ class MySQL(object):
## @brief Lodel_id for the hierachy root
leroot_lodel_id = 0
@staticmethod
## @brief Exec a query
# @param query str : SQL query
def query(connection, query):
with connection as cur:
try:
cur.execute(query)
except Exception as err:
raise err
return cur
@classmethod
## @brief gets the table name from class name
# @param class_name str