changes of .env file
This commit is contained in:
@@ -11,28 +11,31 @@ class YearGet:
|
||||
def get_year_by_model(self, proc_name):
|
||||
try:
|
||||
self.cursor.callproc(proc_name)
|
||||
|
||||
years = []
|
||||
for result in self.cursor.stored_results():
|
||||
rows = result.fetchall()
|
||||
years = [row["year"] for row in rows]
|
||||
|
||||
print("-- years get --",years)
|
||||
return years
|
||||
|
||||
except mysql.connector.Error as e:
|
||||
print("MySQL Error:", e)
|
||||
return []
|
||||
|
||||
# def get_all_year_in_all_model(self):
|
||||
# self.cursor.callproc("AllYearsInAllModel")
|
||||
# years = []
|
||||
# for result in self.cursor.stored_results():
|
||||
# rows = result.fetchall()
|
||||
# years = [row["year"] for row in rows]
|
||||
# return years
|
||||
|
||||
|
||||
def CheckYearExists(self, table_name, year):
|
||||
try:
|
||||
self.cursor.callproc('CheckYearExists', (table_name, year))
|
||||
|
||||
result = 0
|
||||
for result_set in self.cursor.stored_results():
|
||||
result = result_set.fetchone()[0]
|
||||
|
||||
return {"exists": result > 0}
|
||||
|
||||
except mysql.connector.Error as e:
|
||||
print("MySQL Error:", e)
|
||||
return {"exists": False, "error": str(e)}
|
||||
|
||||
def close(self):
|
||||
self.cursor.close()
|
||||
self.conn.close()
|
||||
|
||||
Reference in New Issue
Block a user