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:
parent
f99f74fcb1
commit
9fdb73106d
2 changed files with 19 additions and 14 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue