| 1913 | } |
| 1914 | |
| 1915 | static int graph_capture_project(cbm_store_t *store, const char *project, |
| 1916 | cbm_graph_compare_project_t *out) { |
| 1917 | cbm_project_t row = {0}; |
| 1918 | int rc = cbm_store_get_project(store, project, &row); |
| 1919 | if (rc != CBM_STORE_OK) { |
| 1920 | return rc; |
| 1921 | } |
| 1922 | if (!row.name || !row.indexed_at || !row.root_path) { |
| 1923 | cbm_project_free_fields(&row); |
| 1924 | store_set_error(store, "compare project allocation failed"); |
| 1925 | return CBM_STORE_ERR; |
| 1926 | } |
| 1927 | |
| 1928 | snprintf(out->generation, sizeof(out->generation), "%s", safe_str(row.indexed_at)); |
| 1929 | snprintf(out->index_mode, sizeof(out->index_mode), "unknown"); |
| 1930 | |
| 1931 | cbm_coverage_meta_t meta = {0}; |
| 1932 | rc = cbm_store_coverage_meta_get(store, project, &meta); |
| 1933 | if (rc == CBM_STORE_OK) { |
| 1934 | snprintf(out->generation, sizeof(out->generation), "%s", safe_str(meta.generation)); |
| 1935 | snprintf(out->index_mode, sizeof(out->index_mode), "%s", safe_str(meta.index_mode)); |
| 1936 | cbm_store_coverage_meta_clear(&meta); |
| 1937 | } else if (rc != CBM_STORE_NOT_FOUND) { |
| 1938 | cbm_project_free_fields(&row); |
| 1939 | return rc; |
| 1940 | } |
| 1941 | cbm_project_free_fields(&row); |
| 1942 | |
| 1943 | rc = graph_count_rows(store, "SELECT count(*) FROM nodes WHERE project=?1;", project, |
| 1944 | &out->node_count); |
| 1945 | if (rc != CBM_STORE_OK) { |
| 1946 | return rc; |
| 1947 | } |
| 1948 | return graph_count_rows(store, "SELECT count(*) FROM edges WHERE project=?1;", project, |
| 1949 | &out->edge_count); |
| 1950 | } |
| 1951 | |
| 1952 | static int graph_node_cursor_step(cbm_store_t *store, graph_node_cursor_t *cursor) { |
| 1953 | int rc = sqlite3_step(cursor->stmt); |
no test coverage detected