Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module defines the translation functions for insert and upsert mutations.
Synopsis
- fromInsert :: AnnotatedInsert 'MSSQL Void Expression -> Insert
- toMerge :: TableName -> [AnnotatedInsertRow 'MSSQL Expression] -> [ColumnInfo 'MSSQL] -> IfMatched Expression -> FromIr Merge
- toInsertValuesIntoTempTable :: TempTableName -> AnnotatedInsert 'MSSQL Void Expression -> InsertValuesIntoTempTable
Documentation
toMerge :: TableName -> [AnnotatedInsertRow 'MSSQL Expression] -> [ColumnInfo 'MSSQL] -> IfMatched Expression -> FromIr Merge Source #
Construct a MERGE statement from AnnotatedInsert information. A MERGE statement is responsible for actually inserting and/or updating the data in the table.
toInsertValuesIntoTempTable :: TempTableName -> AnnotatedInsert 'MSSQL Void Expression -> InsertValuesIntoTempTable Source #
As part of an INSERT/UPSERT process, insert VALUES into a temporary table. The content of the temporary table will later be inserted into the original table using a MERGE statement.
We insert the values into a temporary table first in order to replace the missing
fields with DEFAULT
in normalizeInsertRows
, and we can't do that in a
MERGE statement directly.