This commit is contained in:
Andrej730
2026-02-27 11:15:30 +05:00
parent 8834a51122
commit 92c979fbbf
27 changed files with 121 additions and 271 deletions
@@ -55,8 +55,7 @@ class Patcher:
self.c = self.db.cursor()
self.file_patched = db_file
self.c.execute(
"""
self.c.execute("""
CREATE TABLE IF NOT EXISTS elements (
id integer PRIMARY KEY NOT NULL UNIQUE,
global_id text,
@@ -65,33 +64,28 @@ class Patcher:
name text,
description text
);
"""
)
""")
self.c.execute("CREATE INDEX IF NOT EXISTS idx_global_id ON elements (global_id);")
self.c.execute("CREATE INDEX IF NOT EXISTS idx_ifc_class ON elements (ifc_class);")
self.c.execute("CREATE INDEX IF NOT EXISTS idx_predefined_type ON elements (predefined_type);")
self.c.execute(
"""
self.c.execute("""
CREATE TABLE IF NOT EXISTS relationships (
from_id integer NOT NULL,
type text,
to_id integer NOT NULL
);
"""
)
""")
self.c.execute("CREATE INDEX IF NOT EXISTS idx_from_id ON relationships (from_id);")
self.c.execute(
"""
self.c.execute("""
CREATE TABLE IF NOT EXISTS properties (
element_id integer NOT NULL,
set_name text,
name text,
value text
);
"""
)
""")
self.c.execute("CREATE INDEX IF NOT EXISTS idx_element_id ON properties (element_id);")
elements = self.file.by_type("IfcObjectDefinition")
+2 -4
View File
@@ -349,13 +349,11 @@ class Patcher(ifcpatch.BasePatcher):
assert cursor is not None
row = cursor.fetchone()
elif self.sql_type == "mysql":
cursor = self.c.execute(
f"""
cursor = self.c.execute(f"""
SELECT 1 FROM information_schema.tables
WHERE table_schema = '{self.database}' AND table_name = 'id_map'
LIMIT 1;
"""
)
""")
row = self.c.fetchone()
else:
assert_never(self.sql_type)