diff options
author | Manel Caro <mcaro@iseebcn.com> | 2019-03-09 21:29:27 +0100 |
---|---|---|
committer | Manel Caro <mcaro@iseebcn.com> | 2019-03-09 21:29:27 +0100 |
commit | e4366bb1f2dc3a43a1289f6f76967f1005278954 (patch) | |
tree | 4f07744ecfb6c6a60e29e35ca17d93b52f8b5d45 /scripts/PYTHON_SOFTWARE/test/helpers/psqldb.py | |
parent | 9332c933fc05f42882640c9a4e35fab09854af84 (diff) | |
download | board-e4366bb1f2dc3a43a1289f6f76967f1005278954.zip board-e4366bb1f2dc3a43a1289f6f76967f1005278954.tar.gz board-e4366bb1f2dc3a43a1289f6f76967f1005278954.tar.bz2 |
Remove incorrect copy PYTHON_SOFTWARE folder inside scripts directory
Diffstat (limited to 'scripts/PYTHON_SOFTWARE/test/helpers/psqldb.py')
-rw-r--r-- | scripts/PYTHON_SOFTWARE/test/helpers/psqldb.py | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/scripts/PYTHON_SOFTWARE/test/helpers/psqldb.py b/scripts/PYTHON_SOFTWARE/test/helpers/psqldb.py deleted file mode 100644 index af08579..0000000 --- a/scripts/PYTHON_SOFTWARE/test/helpers/psqldb.py +++ /dev/null @@ -1,55 +0,0 @@ -import psycopg2 - -class PgSQLConnection(object): - """aaaaaaa""" - - __conection_object = None - __db_config = {'dbname': 'testsrv', 'host': '192.168.2.171', - 'password': 'Idkfa2009', 'port': 5432, 'user': 'admin'} - - def __init__ (self, connect_str = None): - self.__conection_object = None - if connect_str is not None: - self.__db_config = connect_str - else: - self.__db_config = {'dbname': 'testsrv', 'host': '192.168.2.171', - 'password': 'Idkfa2009', 'port': 5432, 'user': 'admin'} - - def db_connect (self, connect_str = None): - result = False - try: - if connect_str == None: - self.__conection_object = psycopg2.connect(**self.__db_config) - else: - __db_config = connect_str; - self.__conection_object = psycopg2.connect(**self.__db_config) - self.__conection_object.autocommit = True - result = True - except Exception as error: - print(error) - return result - - def db_execute_query(self, query): - cur = self.__conection_object.cursor() - cur.execute(query) - data = cur.fetchall() - cur.close() - return data - - def commit(self): - self.__conection_object.commit() - - - def db_close(self): - if self.__conection_object is not None: - self.__conection_object.close() - del self.__conection_object - self.__conection_object = None - - - def __del__(self): - if self.__conection_object is not None: - self.__conection_object.close() - #print("disconnected") - - |