The ARX specification

03 Operations

Every provider offers the same operations, with the same names, parameter order and result shapes. All are asynchronous and take a cancellation token. A provider that can't do an operation, or part of one, must refuse it with ARX8001 NotSupported naming what it can't do, never ignore part of it (chapter 08).

Create

Writes one record and returns its record id ("none" for a table without one).

  • The attributes are validated first: names (chapter 07), values (chapter 01), selection sets, lookups. Nothing is sent when one fails.
  • A record whose id or unique key exists is ARX3001 UniqueViolation; Create never replaces a record (on DynamoDB the put is conditional for this).
  • A generated id is set on the entity's RecordId after the write succeeds.

CreateMultiple

Writes many records, all or nothing, and returns one record id per entity, in list order.

  • If any record fails, none is stored, and the error names which.
  • The same entity object twice in one list is ARX1001: one entity holds one id.
  • A provider may limit the size of one call where its database limits a transaction (DynamoDB: 100), refusing more with ARX8001 unless the caller opts into several transactions.
  • Without ids (ReturnIds = false): the same write, all or nothing, reading no ids back, so a provider may use its database's bulk load. It returns one None record id per entity. A call that needs no id needs no usable id column: without a schema catalog (SchemaResolution), a table with no primary key can be written.

Update

Changes one record and returns 1.

  • Only the attributes present are written; an attribute left out keeps its value. Null stores null.
  • The record is found by its id (default), a declared key, or named columns (ArxMatch); the match's columns are never written. Nothing matched is ARX2002 RecordNotFound, and nothing is created. With RequireSingleRow, several matched is ARX2003 MultipleRecordsMatched and nothing changes.
  • With a declared version column (chapter 02), an entity that carries the version it read is written only if the record still has it (ARX2004 RecordChanged otherwise), and the version goes up by one.
  • A provider that finds records only by key (DynamoDB) answers a match by other columns with one query of a partition they give, or refuses it with ARX8001 when they give none.

UpdateMultiple

Many updates, all or nothing; returns how many records changed. If any entity matches nothing, nothing changes (ARX2002).

By a filter (WriteByFilter, chapter 08): one entity carrying only the values to set, and a filter. Every record of the entity's table that the filter matches gets the values; the call returns how many matched (0 is not an error).

  • The filter tests the table's own columns, with the operators of RetrieveMultiple (chapter 04), Or filters included; names are validated and values are parameters, as in a query. A condition on another entity (a link) is ARX1001.
  • An empty filter is ARX1001, unless the caller says every record is meant (AllRows).
  • The entity carries no id: the id attribute or a record id with a value, beside a filter, is ARX1001 (the call can't tell which records were meant). A version value is ARX1001 too; a declared version column goes up by one on every changed record.
  • All or nothing: a record the database refuses leaves every record unchanged.
  • A provider that reads by partition (DynamoDB) needs the filter to give a partition key, finds the records with one query, and writes each conditioned on the filter still matching; it may limit the count (100), refusing more with ARX8001. A filter that gives no partition is ARX8001.

Delete

Deletes the record an id or match finds. By id it answers true or false; by entity it returns the count (0 when nothing matched, which isn't an error). With RequireSingleRow, nothing matched is ARX2002.

DeleteMultiple

Deletes the records the ids or entities find, all or nothing, and returns how many existed and went.

By a filter (WriteByFilter): a table and a filter, with UpdateMultiple's rules for the filter (own columns, empty refused unless AllRows, a partition where the provider needs one); returns how many went.

Retrieve

Reads one record by id or match, with the columns asked for (and always the id). Nothing found is null, not an error. Several found is ARX2003.

RetrieveMultiple

Runs a query (chapter 04) and returns the records, a page of them, or aggregates.

Execute

Runs a stored procedure or a function that returns rows (ArxProcedureExpression), where the database has them (capability StoredProcedures). An error the routine raises is ARX3005 RaisedByDatabase. A provider without them refuses Execute with ARX8001.

All chapters of the specification