project-m36-1.2.3: Relational Algebra Engine
Safe HaskellSafe-Inferred
LanguageHaskell2010

ProjectM36.DatabaseContext

Synopsis

Documentation

empty :: DatabaseContext Source #

The DatabaseContext is a snapshot of a database's evolving state and contains everything a database client can change over time. I spent some time thinking about whether the VirtualDatabaseContext/Schema and DatabaseContext data constructors should be the same constructor, but that would allow relation variables to be created in a "virtual" context which would appear to defeat the isomorphisms of the contexts. It should be possible to switch to an alternative schema to view the same equivalent information without information loss. However, allowing all contexts to reference another context while maintaining its own relation variables, new types, etc. could be interesting from a security perspective. For example, if a user creates a new relvar in a virtual context, then does it necessarily appear in all linked contexts? After deliberation, I think the relvar should appear in *all* linked contexts to retain the isomorphic properties, even when the isomorphism is for a subset of the context. This hints that the IsoMorphs should allow for "fall-through"; that is, when a relvar is not defined in the virtual context (for morphing), then the lookup should fall through to the underlying context. | Used for read-only database context within a transaction.

Indicate whether a record field has been changed in this transaction. This is used in the DatabaseContext ot mark fields which have been modified relative to the previous transactions' state as an optimization when persisting transactions on disk.

stripGraphRefRelationalExpr :: GraphRefRelationalExpr -> RelationalExpr Source #

Remove TransactionId markers on GraphRefRelationalExpr

isUpdated :: DatabaseContext -> Bool Source #

If the database context has any values which do *not* reference previous transactions, it must be new data.

freshDatabaseContext :: TransactionId -> DatabaseContext -> DatabaseContext Source #

The "fresh" database context is created after a commit, so all values will refer to previous transactions.