Diff
Not logged in

Differences From Artifact [cebf3ae637]:

To Artifact [45a49dc7f3]:


201
202
203
204
205
206
207
208
209
210

211
212
213
214
215
216
217
218
219

220
221
222




223
224

225
226
227
228
229
230
231
232
233
234
201
202
203
204
205
206
207

208

209
210
211
212
213
214
215
216
217

218
219


220
221
222
223
224
225
226
227


228
229
230
231
232
233
234







-

-
+








-
+

-
-
+
+
+
+


+

-
-







** both /annotate and /finfo.  See also: compute_direct_ancestors().
*/
void path_shortest_stored_in_ancestor_table(
  int origid,     /* RID for check-in at start of the path */
  int cid         /* RID for check-in at the end of the path */
){
  PathNode *pPath;
  Blob sql;
  int gen = 0;
  char *zSep = "VALUES";
  Stmt ins;
  pPath = path_shortest(cid, origid, 1, 0);
  db_multi_exec(
    "CREATE TEMP TABLE IF NOT EXISTS ancestor("
    "  rid INT UNIQUE,"
    "  generation INTEGER PRIMARY KEY"
    ");"
    "DELETE FROM ancestor;"
  );
  blob_init(&sql, "INSERT INTO ancestor(rid, generation)", -1);
  db_prepare(&ins, "INSERT INTO ancestor(rid, generation) VALUES(:rid,:gen)");
  while( pPath ){
    blob_append_sql(&sql, "%s(%d,%d)", zSep/*safe-for-%s*/, pPath->rid,++gen);
    zSep = ",";
    db_bind_int(&ins, ":rid", pPath->rid);
    db_bind_int(&ins, ":gen", ++gen);
    db_step(&ins);
    db_reset(&ins);
    pPath = pPath->u.pTo;
  }
  db_finalize(&ins);
  path_reset();
  db_multi_exec("%s", blob_sql_text(&sql));
  blob_reset(&sql);
}

/*
** COMMAND: test-shortest-path
**
** Usage: %fossil test-shortest-path ?--no-merge? VERSION1 VERSION2
**