MySQL Conditional Update
mysql_conditional_updateUpdates a row only when its _version matches the expected version, avoiding lost updates in multi-agent environments.
Instructions
Update a row only if its _version matches expectedVersion. Prevents lost updates in multi-agent environments.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Alias for rowId | |
| data | No | Column-value pairs to update | |
| name | No | Alias for table | |
| rowId | No | Alias for conditions. Shorthand for updating a single row by primary key. | |
| table | No | Table to update | |
| updates | No | Alias for data | |
| version | No | Alias for expectedVersion | |
| idColumn | No | Primary key column name. Defaults to 'id' if not provided. Used with rowId alias. | |
| condition | No | Alias for conditions (can be object, string, or number) | |
| tableName | No | Alias for table | |
| conditions | No | Conditions identifying the row (e.g. primary key). Anti-Hallucination Hint: Must be an array of objects (e.g. [{column: 'id', value: 1}]), not a string. | |
| expectedVersion | No | The _version value currently expected. Update fails if this does not match. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | Error code (e.g. VALIDATION_ERROR, QUERY_ERROR) | |
| data | No | ||
| error | No | Error message if operation failed | |
| details | No | Additional error context | |
| metrics | No | Token estimation metrics | |
| success | Yes | Whether the operation succeeded | |
| category | No | Error category (validation, query, connection, internal) | |
| suggestion | No | Suggested fix for the error | |
| recoverable | No | Whether the error is recoverable |