mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-16 21:42:19 +00:00
black .
This commit is contained in:
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user