engine_db_execute
Run a pool of database steps in a single connection to preserve temporary tables and LAST_INSERT_ID across them. Use for sequences that depend on connection state.
Instructions
Run a pool of steps in ONE database connection, which is the only way a temporary table or LAST_INSERT_ID survives between them. Steps: lock (our table registry, not the DBMS), unlock, generate (id from the generator), select, modify (any sql), insert (table + rows as one multi-row INSERT of at most 65535 values, rows times columns - more rows go as several inserts), change (mark tables so the storefront cache refreshes). Trees (topic, info and any table with tindex/tlevel/absindex) are shaped ONLY by the tree steps - never by raw sql: tree_add (table, parent_id; 0 = top level; answers the new id), tree_move (table, id, parent_id), tree_up / tree_down (table, id), tree_remove (table, id; deletes the whole subtree). A tree step rebuilds the indexes and marks its table itself; the new row is bare, so set its fields with a following modify by the lent id. A new topic or info node is visible to the admin only until you insert its rights rows. Before a delete ask dependent (table, and ids when you have them): what hangs on that table and, with ids, how many rows point at them. After deletions run clear_dependent (table): it sweeps the rows left pointing nowhere and names the busy tables it skipped. Values go in params: :NAME in the sql, upper case, the value under that name in params. A named step lends its value to the next ones as @name, in params too. Nothing is guessed: tables you touched with raw sql are refreshed only by the change step, so put it in. A failed step stops the pool and the answer says which one and why; whatever the pool locked it releases itself. Announce data changes to the owner first, and ask whether to take the tables into work (a lock step) for the time of the change - do not decide that alone. Keep the locked stretch short: read and compute before the pool, not inside it. A pool too big to write out is built by a script and given as pool_file instead of pool.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pool | No | ||
| pool_file | No | Path on this machine, absolute or off the store folder, to a json file holding the pool - the same list of steps; instead of pool. |