pamhyr: Rename '_sql_*' function to '_db_*'.

This commit is contained in:
Pierre-Antoine Rouby committed 2023-10-27 14:15:42 +02:00
1 parent 8d92fbbdac
commit ea2dbfba3e
23 files changed
+186 -186

No files matched your search

@@ -51,7 +51,7 @@ class BoundaryCondition(SQLSubModel):
BoundaryCondition._id_cnt = max(BoundaryCondition._id_cnt + 1, self.id)
@classmethod
def _sql_create(cls, execute):
def _db_create(cls, execute):
execute("""
CREATE TABLE boundary_condition(
id INTEGER NOT NULL PRIMARY KEY,
@@ -77,7 +77,7 @@ class BoundaryCondition(SQLSubModel):
return cls._create_submodel(execute)
@classmethod
def _sql_update(cls, execute, version):
def _db_update(cls, execute, version):
return True
@classmethod
@@ -102,7 +102,7 @@ class BoundaryCondition(SQLSubModel):
return res
@classmethod
def _sql_load(cls, execute, data=None):
def _db_load(cls, execute, data=None):
new = []
tab = data["tab"]
@@ -144,7 +144,7 @@ class BoundaryCondition(SQLSubModel):
return new
def _sql_save(self, execute, data=None):
def _db_save(self, execute, data=None):
tab = data["tab"]
execute(f"DELETE FROM boundary_condition WHERE id = {self.id}")
@@ -158,16 +158,16 @@ class BoundaryCondition(SQLSubModel):
"INSERT INTO " +
"boundary_condition(id, name, type, tab, node) " +
"VALUES (" +
f"{self.id}, '{self._sql_format(self._name)}', " +
f"'{self._sql_format(self._type)}', '{tab}', {node}" +
f"{self.id}, '{self._db_format(self._name)}', " +
f"'{self._db_format(self._type)}', '{tab}', {node}" +
")"
)
execute(sql)
ind = 0
for d in self._data:
data0 = self._sql_format(str(d[0]))
data1 = self._sql_format(str(d[1]))
data0 = self._db_format(str(d[0]))
data1 = self._db_format(str(d[1]))
sql = (
"INSERT INTO " +
@@ -38,7 +38,7 @@ class BoundaryConditionList(PamhyrModelListWithTab):
]
@classmethod
def _sql_load(cls, execute, data=None):
def _db_load(cls, execute, data=None):
new = cls(status=data['status'])
if data is None:
@@ -46,13 +46,13 @@ class BoundaryConditionList(PamhyrModelListWithTab):
for tab in new._tabs:
data["tab"] = tab
new._tabs[tab] = BoundaryCondition._sql_load(
new._tabs[tab] = BoundaryCondition._db_load(
execute, data
)
return new
def _sql_save(self, execute, data=None):
def _db_save(self, execute, data=None):
execute("DELETE FROM boundary_condition")
if data is None:
@@ -61,7 +61,7 @@ class BoundaryConditionList(PamhyrModelListWithTab):
for tab in self._tabs:
data["tab"] = tab
for bc in self._tabs[tab]:
bc._sql_save(execute, data=data)
bc._db_save(execute, data=data)
return True