MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / cbm_store_upsert_node_batch

Function cbm_store_upsert_node_batch

src/store/store.c:2018–2037  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2016/* ── Node batch ─────────────────────────────────────────────────── */
2017
2018int cbm_store_upsert_node_batch(cbm_store_t *s, const cbm_node_t *nodes, int count,
2019 int64_t *out_ids) {
2020 if (count == 0) {
2021 return CBM_STORE_OK;
2022 }
2023
2024 exec_sql(s, "BEGIN IMMEDIATE;");
2025 for (int i = 0; i < count; i++) {
2026 int64_t id = cbm_store_upsert_node(s, &nodes[i]);
2027 if (id == CBM_STORE_ERR) {
2028 exec_sql(s, "ROLLBACK;");
2029 return CBM_STORE_ERR;
2030 }
2031 if (out_ids) {
2032 out_ids[i] = id;
2033 }
2034 }
2035 exec_sql(s, "COMMIT;");
2036 return CBM_STORE_OK;
2037}
2038
2039/* ── Edge CRUD ──────────────────────────────────────────────────── */
2040

Callers 1

test_store_nodes.cFile · 0.85

Calls 2

exec_sqlFunction · 0.85
cbm_store_upsert_nodeFunction · 0.85

Tested by

no test coverage detected