ifcopenshell.sql - fix error in by_id method

it was fetching some random row from id_map instead of using ifc_id filter
This commit is contained in:
Andrej730
2024-09-24 12:35:15 +05:00
parent 08e221fe93
commit 21dd5054e6
+3 -2
View File
@@ -153,10 +153,11 @@ class sqlite(file):
entity = sqlite_entity(id, ifc_class, self)
self.entity_cache[id] = entity
return entity
self.cursor.execute("SELECT ifc_id, ifc_class FROM id_map LIMIT 1")
self.cursor.execute("SELECT ifc_id, ifc_class FROM id_map WHERE ifc_id = ? LIMIT 1", (id,))
row = self.cursor.fetchone()
if row:
self.id_map[row[0]] = row[1]
_, ifc_class = row
self.id_map[id] = ifc_class
entity = sqlite_entity(id, ifc_class, self)
self.entity_cache[id] = entity
return entity