Files
Payment_Reconciliation/services/Generalservice.py

31 lines
671 B
Python
Raw Normal View History

class GeneralUse:
data=[]
@staticmethod
def execute_sp(cursor, proc_name, params=[], fetch_one=False):
cursor.callproc(proc_name, params)
return (
GeneralUse.fetch_one_result(cursor)
if fetch_one else
GeneralUse.fetch_all_results(cursor)
)
@staticmethod
def fetch_all_results(cursor):
data = []
for result in cursor.stored_results():
data = result.fetchall()
return data
@staticmethod
def fetch_one_result(cursor):
data = None
for result in cursor.stored_results():
data = result.fetchone()
return data