Fossil SCM

Simplify the SQL used to omit related nodes from a path for which there is no path to the final destination.

drh 2024-12-23 15:36 trunk
Commit dff73bdc71c24b3879a517be166623cf9bd8613a7d23c0d610dbf8d258f74b92
1 file changed +1 -2
+1 -2
--- src/timeline.c
+++ src/timeline.c
@@ -2298,11 +2298,10 @@
22982298
"INSERT OR IGNORE INTO related(x)"
22992299
" SELECT childid FROM cherrypick WHERE parentid IN pathnode;"
23002300
);
23012301
}
23022302
}
2303
- db_multi_exec("INSERT OR IGNORE INTO pathnode SELECT x FROM related");
23042303
if( earlierRid && laterRid && commonAncs==earlierRid ){
23052304
/* On a query with me=XXX, you=YYY, and rel, omit all nodes that
23062305
** are not ancestors of either XXX or YYY, as those nodes tend to
23072306
** be extraneous */
23082307
db_multi_exec(
@@ -2309,13 +2308,13 @@
23092308
"CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY)"
23102309
);
23112310
compute_ancestors(laterRid, 0, 0, earlierRid);
23122311
db_multi_exec(
23132312
"DELETE FROM related WHERE x NOT IN ok;"
2314
- "DELETE FROM pathnode WHERE x NOT IN ok;"
23152313
);
23162314
}
2315
+ db_multi_exec("INSERT OR IGNORE INTO pathnode SELECT x FROM related");
23172316
}
23182317
blob_append_sql(&sql, " AND event.objid IN pathnode");
23192318
if( zChng && zChng[0] ){
23202319
db_multi_exec(
23212320
"DELETE FROM pathnode\n"
23222321
--- src/timeline.c
+++ src/timeline.c
@@ -2298,11 +2298,10 @@
2298 "INSERT OR IGNORE INTO related(x)"
2299 " SELECT childid FROM cherrypick WHERE parentid IN pathnode;"
2300 );
2301 }
2302 }
2303 db_multi_exec("INSERT OR IGNORE INTO pathnode SELECT x FROM related");
2304 if( earlierRid && laterRid && commonAncs==earlierRid ){
2305 /* On a query with me=XXX, you=YYY, and rel, omit all nodes that
2306 ** are not ancestors of either XXX or YYY, as those nodes tend to
2307 ** be extraneous */
2308 db_multi_exec(
@@ -2309,13 +2308,13 @@
2309 "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY)"
2310 );
2311 compute_ancestors(laterRid, 0, 0, earlierRid);
2312 db_multi_exec(
2313 "DELETE FROM related WHERE x NOT IN ok;"
2314 "DELETE FROM pathnode WHERE x NOT IN ok;"
2315 );
2316 }
 
2317 }
2318 blob_append_sql(&sql, " AND event.objid IN pathnode");
2319 if( zChng && zChng[0] ){
2320 db_multi_exec(
2321 "DELETE FROM pathnode\n"
2322
--- src/timeline.c
+++ src/timeline.c
@@ -2298,11 +2298,10 @@
2298 "INSERT OR IGNORE INTO related(x)"
2299 " SELECT childid FROM cherrypick WHERE parentid IN pathnode;"
2300 );
2301 }
2302 }
 
2303 if( earlierRid && laterRid && commonAncs==earlierRid ){
2304 /* On a query with me=XXX, you=YYY, and rel, omit all nodes that
2305 ** are not ancestors of either XXX or YYY, as those nodes tend to
2306 ** be extraneous */
2307 db_multi_exec(
@@ -2309,13 +2308,13 @@
2308 "CREATE TEMP TABLE IF NOT EXISTS ok(rid INTEGER PRIMARY KEY)"
2309 );
2310 compute_ancestors(laterRid, 0, 0, earlierRid);
2311 db_multi_exec(
2312 "DELETE FROM related WHERE x NOT IN ok;"
 
2313 );
2314 }
2315 db_multi_exec("INSERT OR IGNORE INTO pathnode SELECT x FROM related");
2316 }
2317 blob_append_sql(&sql, " AND event.objid IN pathnode");
2318 if( zChng && zChng[0] ){
2319 db_multi_exec(
2320 "DELETE FROM pathnode\n"
2321

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button