pollutants edit db

This commit is contained in:
Youcef AOUAD committed 2024-06-05 11:35:41 +02:00
1 parent 37dd4ebaef
commit 1535247e1b
9 files changed
+19 -25

No files matched your search

+3 -4
View File
@@ -86,6 +86,7 @@ class Pollutants(SQLSubModel):
apd REAL NOT NULL,
ac REAL NOT NULL,
bc REAL NOT NULL,
pollutant INTEGER NOT NULL,
FOREIGN KEY(pollutant) REFERENCES Pollutants(id)
)
""")
@@ -126,7 +127,7 @@ class Pollutants(SQLSubModel):
if table is not None:
for t in table:
new_data.append(t)
new_data = t[1:]
new_pollutant._data.append(new_data)
@@ -136,14 +137,12 @@ class Pollutants(SQLSubModel):
def _db_save(self, execute, data=None):
print("save in data base for pollutants")
execute(f"DELETE FROM Pollutants WHERE id = {self.id}")
execute(f"DELETE FROM Pollutants_characteristics WHERE pollutant = {self.id}")
sql = (
"INSERT INTO " +
"Pollutants(id, name " +
"Pollutants(id, name) " +
"VALUES (" +
f"{self.id}, " +
f"'{self._db_format(self._name)}'" +
-1
View File
@@ -35,7 +35,6 @@ class PollutantsList(PamhyrModelList):
return new
def _db_save(self, execute, data=None):
print("save pollutantsList")
ok = True
# Delete previous data