All Downloads are FREE. Search and download functionalities are using the official Maven repository.

reference.language.store.html Maven / Gradle / Ivy




    
    Delete and store statements
    
    

    
    

    
    

    
    
    
    

    


Delete and store statements

The Prompto language comes with a built-in data storage mechanism.

This mechanism relies on 3rd party data store implementations. Which data store technology is effectively used is determined through configuration. Without configuration, Prompto uses a built-in in-memory non persistent data store, which helps get started and run tests, but is not supported for production.

A data store generally provides guarantees of availability, scalability and consistency. However, from a programming language standpoint, the only relevant characteristic is consistency aka ACID (Atomicity, Consistency, Isolation, Durability). Many data stores provide consistency through transactions, however this does not scale well. Instead, other data stores provide consistency using grouped CRUD operations (CReate, Update, Delete). To ensure compatibility with most data stores, Prompto only requires the data store to support consistency, not transactions. Prompto also caters for asynchronous consistency of certain data stores, using the flush statement.

Consistency in Prompto is achieved by grouping multiple CRUD operations in a single statement. A delete and store statement allows such grouping.

A delete and store statement has the form store obj1, obj2 ... objn eventually preceded by delete obj1, obj2 ... objn, where obji is any valid category or category collection expression.

Storing new objects

Prompto can store any object for which the category is marked as storable, as follows:

Updating existing objects

Prompto storable objects have a built-in database id attribute, namely dbId provided by the data store. Only objects fetched from the store can be updated, and those objects carry their dbId. These objects must also be mutable, so the language is allowed to modify attribute values.
Updating these objects can be simply done by storing them, as follows:

Deleting objects

Prompto storable objects have a built-in database id attribute, namely dbId provided by the data store. Only objects fetched from the store can be deleted, and those objects carry their dbId. Deleting these objects can be simply done as follows:

Deleting and storing atomically.

To ensure consistency of data, Prompto supports deleting and storing multiple objects in a single statement, as follows:





© 2015 - 2025 Weber Informatics LLC | Privacy Policy