Skip to main content

Responses And Persistence

Successful requests return one stable wrapper:

{
"ok": true,
"result": {
"rows": [
{ "id": "w_001", "email": "ada@example.com" }
]
}
}

Mutations return operation-specific results such as affected row counts:

{
"ok": true,
"result": { "rowsAffected": 1 }
}

Errors

Errors use one JSON shape:

{
"ok": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Required column \"id\" cannot be null."
},
"requestId": "req_01J..."
}

Common status mappings:

ErrorHTTP statusJSON code
Malformed JSON or command envelope400INVALID_REQUEST
Unknown database or table404NOT_FOUND
SQL error422SQL_ERROR
Validation error422VALIDATION_ERROR
Unexpected server failure500INTERNAL_ERROR

Persistence

The server opens databases with automatic persistence enabled. Every successful mutation is validated and saved atomically before the response is returned. A failed mutation is rolled back and does not modify the .csdb file. Read commands never write the file.

The server serializes commands for the same database so concurrent requests cannot overwrite one another. Commands for different databases may run in parallel.