Fixes in jsutils and cleaning mysql code
This commit is contained in:
parent
189f3ffcce
commit
5fa28920da
2 changed files with 10 additions and 5 deletions
|
|
@ -46,6 +46,7 @@ class SqlClass:
|
|||
self.conn=None
|
||||
self.connected=False
|
||||
self.pool_recycle=3600
|
||||
self.last_query=''
|
||||
self.connect()
|
||||
|
||||
|
||||
|
|
@ -166,23 +167,27 @@ class SqlClass:
|
|||
arguments (list): The data used in sql sentence. This data substitute the %s characters.
|
||||
name_connection (str): The name of dict element with the configuration of connection, without used in this moment.
|
||||
"""
|
||||
|
||||
|
||||
cursor=self.conn.cursor(SqlClass.cursors_connect)
|
||||
|
||||
try:
|
||||
|
||||
cursor.execute(sql_query, arguments)
|
||||
self.conn.commit()
|
||||
|
||||
#if hasattr(cursor, '_executed'):
|
||||
# self.last_query=cursor._executed
|
||||
|
||||
return cursor
|
||||
|
||||
except:
|
||||
e = sys.exc_info()[0]
|
||||
v = sys.exc_info()[1]
|
||||
|
||||
if hasattr(cursor, '_last_executed'):
|
||||
sql_query=cursor._last_executed
|
||||
#if hasattr(cursor, '_executed'):
|
||||
# self.last_query=cursor._executed
|
||||
|
||||
self.error_connection="Error in query ||%s||Values: %s" % (sql_query, str(arguments))
|
||||
self.error_connection="Error in query ||%s||Values: %s" % (self.last_query, str(arguments))
|
||||
|
||||
self.conn.close()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue