Safe Haskell | None |
---|---|
Language | Haskell2010 |
Responsible for translating and building an MSSQL execution plan for delete mutations.
This module is used by Hasura.Backends.MSSQL.Instances.Execute.
Synopsis
- executeDelete :: (MonadError QErr m, MonadReader QueryTagsComment m) => UserInfo -> StringifyNumbers -> SourceConfig 'MSSQL -> AnnDelG 'MSSQL Void (UnpreparedValue 'MSSQL) -> m (ExceptT QErr IO EncJSON)
- buildDeleteTx :: AnnDel 'MSSQL -> StringifyNumbers -> QueryTagsComment -> TxET QErr IO EncJSON
Documentation
executeDelete :: (MonadError QErr m, MonadReader QueryTagsComment m) => UserInfo -> StringifyNumbers -> SourceConfig 'MSSQL -> AnnDelG 'MSSQL Void (UnpreparedValue 'MSSQL) -> m (ExceptT QErr IO EncJSON) Source #
Executes a Delete IR AST and return results as JSON.
buildDeleteTx :: AnnDel 'MSSQL -> StringifyNumbers -> QueryTagsComment -> TxET QErr IO EncJSON Source #
Converts a Delete IR AST to a transaction of three delete sql statements.
A GraphQL delete mutation does two things:
- Deletes rows in a table according to some predicate
- (Potentially) returns the deleted 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 deleted rows from the table we are deletingDELETE FROM with OUTPUT
- deletes the rows from the table and inserts the deleted rows to the temporary table from (1)SELECT
- constructs thereturning
query from the temporary table, including relationships with other tables.