mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 17:31:45 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user