| 1885 | } |
| 1886 | |
| 1887 | static int graph_count_rows(cbm_store_t *store, const char *sql, const char *project, |
| 1888 | int64_t *out) { |
| 1889 | sqlite3_stmt *stmt = NULL; |
| 1890 | if (sqlite3_prepare_v2(store->db, sql, CBM_NOT_FOUND, &stmt, NULL) != SQLITE_OK) { |
| 1891 | store_set_error_sqlite(store, "compare count prepare"); |
| 1892 | return CBM_STORE_ERR; |
| 1893 | } |
| 1894 | if (graph_compare_bind_text(stmt, SKIP_ONE, project) != SQLITE_OK) { |
| 1895 | store_set_error(store, "compare count bind failed"); |
| 1896 | sqlite3_finalize(stmt); |
| 1897 | return CBM_STORE_ERR; |
| 1898 | } |
| 1899 | int step_rc = sqlite3_step(stmt); |
| 1900 | if (step_rc != SQLITE_ROW) { |
| 1901 | store_set_error_sqlite(store, "compare count"); |
| 1902 | sqlite3_finalize(stmt); |
| 1903 | return step_rc == SQLITE_INTERRUPT ? CBM_STORE_CANCELLED : CBM_STORE_ERR; |
| 1904 | } |
| 1905 | *out = sqlite3_column_int64(stmt, 0); |
| 1906 | step_rc = sqlite3_step(stmt); |
| 1907 | sqlite3_finalize(stmt); |
| 1908 | if (step_rc != SQLITE_DONE) { |
| 1909 | store_set_error_sqlite(store, "compare count finish"); |
| 1910 | return step_rc == SQLITE_INTERRUPT ? CBM_STORE_CANCELLED : CBM_STORE_ERR; |
| 1911 | } |
| 1912 | return CBM_STORE_OK; |
| 1913 | } |
| 1914 | |
| 1915 | static int graph_capture_project(cbm_store_t *store, const char *project, |
| 1916 | cbm_graph_compare_project_t *out) { |
no test coverage detected