## §OIP SYSTEM ARTICLE — Cloudflare D1 (3 operations)
A generated article for one OIP shelf. It lists every operation in this API/CLI/MCP/device/model/core subsystem, links each leaf article, and gives the ledger path for proof.

### Read Order
- scan operations
- open a leaf doc
- run via run_now or POST /api/dispatch
- open receipt
- repair/replay if needed

### Operations
- **D1_QUERY** — Run a SELECT query on the D1 database.
  when: any read operation on D1 tables.
  args: $1 = SQL query. Include ? for bound parameters and pass them after |.
  doc: https://miscsubjects.com/api/dispatch?key=D1_QUERY&format=markdown
  run: https://miscsubjects.com/api/dispatch?invoke=D1_QUERY&body=SELECT%20*%20FROM%20directory%20WHERE%20key%20%3D%20%3F%7CROUTER&share=<TOKEN>
  history: https://miscsubjects.com/api/invocations?object_id=D1_QUERY
- **D1_EXEC** — Run a non-SELECT D1 query (INSERT/UPDATE/DELETE).
  when: writing data to D1.
  args: $1 = SQL. Pipes inside SQL are preserved.
  doc: https://miscsubjects.com/api/dispatch?key=D1_EXEC&format=markdown
  run: https://miscsubjects.com/api/dispatch?invoke=D1_EXEC&body=UPDATE%20directory%20SET%20content%20%3D%20%3F%20WHERE%20key%20%3D%20%3F%7Cnew%20content%7CROUTER&share=<TOKEN>
  history: https://miscsubjects.com/api/invocations?object_id=D1_EXEC
- **D1_TO_2D_ARRAY** — Run a SQL SELECT and return a 2D array (header row + values) suitable for sheets_replace_tab. $1=SQL
  when: you need to d1 to 2d array
  args: $1
  doc: https://miscsubjects.com/api/dispatch?key=D1_TO_2D_ARRAY&format=markdown
  run: https://miscsubjects.com/api/dispatch?invoke=D1_TO_2D_ARRAY&body=%3Carg1%3E&share=<TOKEN>
  history: https://miscsubjects.com/api/invocations?object_id=D1_TO_2D_ARRAY

### Troubleshooting
- If a row's example has placeholders, replace only the placeholder values and preserve separators.
- If a call fails, open its receipt and repair it with POST /api/dispatch {key, body, repairs:'inv_ID'}.
- If token scope denies this system, ask the owner for a row:/rows:/pfx: token scoped to the exact operation set.

Back to the tree: https://miscsubjects.com/api/dispatch?map=1&format=markdown