| 374 | } |
| 375 | |
| 376 | static char *graph_listing(const char *db_path, const char *project) { |
| 377 | sqlite3 *db = NULL; |
| 378 | if (sqlite3_open_v2(db_path, &db, SQLITE_OPEN_READONLY, NULL) != SQLITE_OK) { |
| 379 | sqlite3_close(db); |
| 380 | return NULL; |
| 381 | } |
| 382 | char *buf = calloc(1, 1); |
| 383 | size_t len = 0; |
| 384 | graph_listing_append(db, |
| 385 | "SELECT label||'|'||name||'|'||qualified_name||'|'||file_path||'|'||" |
| 386 | "start_line||'|'||end_line||'|'||properties FROM nodes " |
| 387 | "WHERE project=?1 ORDER BY 1", |
| 388 | project, &buf, &len); |
| 389 | graph_listing_append(db, |
| 390 | "SELECT e.type||'|'||s.qualified_name||'|'||t.qualified_name||'|'||" |
| 391 | "e.properties FROM edges e JOIN nodes s ON s.id=e.source_id " |
| 392 | "JOIN nodes t ON t.id=e.target_id WHERE e.project=?1 ORDER BY 1", |
| 393 | project, &buf, &len); |
| 394 | sqlite3_close(db); |
| 395 | return buf; |
| 396 | } |
| 397 | |
| 398 | static char *index_and_list(const char *repo, const char *db_name) { |
| 399 | char db_path[512]; |
no test coverage detected