Safe Haskell | None |
---|---|
Language | Haskell2010 |
Responsible for translating and building an MSSQL execution plan for update mutations.
This module is used by Hasura.Backends.MSSQL.Instances.Execute.
Synopsis
- executeUpdate :: (MonadError QErr m, MonadReader QueryTagsComment m) => UserInfo -> StringifyNumbers -> SourceConfig 'MSSQL -> AnnotatedUpdateG 'MSSQL Void (UnpreparedValue 'MSSQL) -> m (ExceptT QErr IO EncJSON)
- buildUpdateTx :: AnnotatedUpdate 'MSSQL -> StringifyNumbers -> QueryTagsComment -> TxET QErr IO EncJSON
Documentation
executeUpdate :: (MonadError QErr m, MonadReader QueryTagsComment m) => UserInfo -> StringifyNumbers -> SourceConfig 'MSSQL -> AnnotatedUpdateG 'MSSQL Void (UnpreparedValue 'MSSQL) -> m (ExceptT QErr IO EncJSON) Source #
Executes an Update IR AST and return results as JSON.
buildUpdateTx :: AnnotatedUpdate 'MSSQL -> StringifyNumbers -> QueryTagsComment -> TxET QErr IO EncJSON Source #
Converts an Update IR AST to a transaction of three update sql statements.
A GraphQL update mutation does two things:
- Update rows in a table according to some predicate
- (Potentially) returns the updated rows (including relationships) as JSON
In order to complete these 2 things we need 3 SQL statements:
SELECT INTO temp_table WHERE false
- creates a temporary table with the same schema as the original table in which we'll store the updated rows from the table we are deletingUPDATE SET FROM with OUTPUT
- updates the rows from the table and inserts the updated rows to the temporary table from (1)SELECT
- constructs thereturning
query from the temporary table, including relationships with other tables.