File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -793,18 +793,28 @@ def update(
793
793
# Handle arcs if present in other_db
794
794
if has_arcs :
795
795
self ._choose_lines_or_arcs (arcs = True )
796
+
797
+ # Create context mapping table for faster lookups
798
+ con .execute_void ("""
799
+ CREATE TEMP TABLE context_mapping AS
800
+ SELECT
801
+ other_context.id as other_id,
802
+ main_context.id as main_id
803
+ FROM other_db.context AS other_context
804
+ INNER JOIN main.context AS main_context ON other_context.context = main_context.context
805
+ """ )
806
+
796
807
con .execute_void ("""
797
808
INSERT OR IGNORE INTO main.arc (file_id, context_id, fromno, tono)
798
809
SELECT
799
810
main_file.id,
800
- main_context.id ,
811
+ context_mapping.main_id ,
801
812
other_arc.fromno,
802
813
other_arc.tono
803
814
FROM other_db.arc AS other_arc
804
815
INNER JOIN other_file_mapped ON other_arc.file_id = other_file_mapped.other_file_id
805
- INNER JOIN other_db.context AS other_context ON other_arc.context_id = other_context.id
816
+ INNER JOIN context_mapping ON other_arc.context_id = context_mapping.other_id
806
817
INNER JOIN main.file AS main_file ON other_file_mapped.mapped_path = main_file.path
807
- INNER JOIN main.context AS main_context ON other_context.context = main_context.context
808
818
""" )
809
819
810
820
# Handle line_bits if present in other_db
You can’t perform that action at this time.
0 commit comments