| 2134 | /* ── Node batch ─────────────────────────────────────────────────── */ |
| 2135 | |
| 2136 | int cbm_store_upsert_node_batch(cbm_store_t *s, const cbm_node_t *nodes, int count, |
| 2137 | int64_t *out_ids) { |
| 2138 | if (count == 0) { |
| 2139 | return CBM_STORE_OK; |
| 2140 | } |
| 2141 | |
| 2142 | exec_sql(s, "BEGIN IMMEDIATE;"); |
| 2143 | for (int i = 0; i < count; i++) { |
| 2144 | int64_t id = cbm_store_upsert_node(s, &nodes[i]); |
| 2145 | if (id == CBM_STORE_ERR) { |
| 2146 | exec_sql(s, "ROLLBACK;"); |
| 2147 | return CBM_STORE_ERR; |
| 2148 | } |
| 2149 | if (out_ids) { |
| 2150 | out_ids[i] = id; |
| 2151 | } |
| 2152 | } |
| 2153 | exec_sql(s, "COMMIT;"); |
| 2154 | return CBM_STORE_OK; |
| 2155 | } |
| 2156 | |
| 2157 | /* ── Edge CRUD ──────────────────────────────────────────────────── */ |
| 2158 |
no test coverage detected