| 2367 | } |
| 2368 | |
| 2369 | int cbm_writer_append_nodes(cbm_db_writer_t *w, const CBMDumpNode *nodes, int count) { |
| 2370 | if (!w) { |
| 2371 | return CBM_NOT_FOUND; |
| 2372 | } |
| 2373 | if (w->err) { |
| 2374 | return w->err; |
| 2375 | } |
| 2376 | for (int i = 0; i < count; i++) { |
| 2377 | RecordBuilder r; |
| 2378 | rec_init(&r); |
| 2379 | fill_node_record(&r, &nodes[i]); |
| 2380 | /* prev_rowid is the previous node's id (0 for the very first), matching |
| 2381 | * the one-shot write_one_table loop — so output is byte-identical. */ |
| 2382 | bool placed = |
| 2383 | pb_add_table_record_with_flush(&w->nodes_pb, nodes[i].id, &r, w->last_node_rowid); |
| 2384 | rec_free(&r); |
| 2385 | if (!placed) { |
| 2386 | w->err = ERR_WRITE_FAILED; |
| 2387 | return w->err; |
| 2388 | } |
| 2389 | w->last_node_rowid = nodes[i].id; |
| 2390 | w->node_rows_written++; |
| 2391 | } |
| 2392 | return 0; |
| 2393 | } |
| 2394 | |
| 2395 | int cbm_writer_finalize(cbm_db_writer_t *w, const char *project, const char *root_path, |
| 2396 | const char *indexed_at, CBMDumpNode *nodes, int node_count, |
no test coverage detected