graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellNone
LanguageHaskell2010

Hasura.Backends.MSSQL.Instances.Execute

Description

MSSQL Instances Execute

Defines a BackendExecute type class instance for MSSQL.

This module implements the needed functionality for implementing a BackendExecute instance for MSSQL, which defines an interface for translating a root field into an execution plan and interacting with a database.

This module includes the MSSQL implementation of queries, mutations, and more.

Synopsis

Multiplexed query

Query

runShowplan :: MonadIO m => Query -> TxET QErr m [Text] Source #

multiplexRootReselect :: [(CohortId, CohortVariables)] -> Reselect -> Select Source #

Producing the correct SQL-level list comprehension to multiplex a query Problem description:

Generate a query that repeats the same query N times but with certain slots replaced:

Select x y | (x,y) <- [..
]

Caution: Be aware that this query has a FOR JSON clause at the top-level and hence its results may be split up across multiple rows. Use forJsonQueryE to handle this.

Mutation

Subscription

validateVariables :: (MonadError QErr m, MonadIO m, MonadBaseControl IO m) => SourceConfig 'MSSQL -> SessionVariables -> PrepareState -> m (ValidatedQueryVariables, ValidatedSyntheticVariables) Source #

Ensure that the set of variables (with value instantiations) that occur in a (RQL) query produce a well-formed and executable (SQL) query when considered in isolation.

This helps avoiding cascading failures in multiplexed queries.

c.f. https://github.com/hasura/graphql-engine-mono/issues/1210.

Remote Relationships (e.g. DB-to-DB Joins, remote schema joins, etc.)

msDBRemoteRelationshipPlan Source #

Arguments

:: forall m. MonadError QErr m 
=> UserInfo 
-> SourceName 
-> SourceConfig 'MSSQL 
-> NonEmpty Object

List of json objects, each of which becomes a row of the table.

-> HashMap FieldName (Column 'MSSQL, ScalarType 'MSSQL)

The above objects have this schema

XXX: What is this for/what does this mean?

-> FieldName

This is a field name from the lhs that *has* to be selected in the response along with the relationship.

-> (FieldName, SourceRelationshipSelection 'MSSQL Void UnpreparedValue) 
-> m (DBStepInfo 'MSSQL) 

Construct an action (i.e. DBStepInfo) which can marshal some remote relationship information into a form that SQL Server can query against.

XXX: Currently unimplemented; the Postgres implementation uses jsonb_to_recordset to query the remote relationship, however this functionality doesn't exist in SQL Server.

NOTE: The following typeclass constraints will be necessary when implementing this function for real:

  MonadQueryTags m
  Backend 'MSSQL

Orphan instances

BackendExecute 'MSSQL Source # 
Instance details

Methods

mkDBQueryPlan :: (MonadError QErr m, MonadQueryTags m, MonadReader QueryTagsComment m) => UserInfo -> Environment -> SourceName -> SourceConfig 'MSSQL -> QueryDB 'MSSQL Void (UnpreparedValue 'MSSQL) -> m (DBStepInfo 'MSSQL) Source #

mkDBMutationPlan :: (MonadError QErr m, MonadQueryTags m, MonadReader QueryTagsComment m) => UserInfo -> StringifyNumbers -> SourceName -> SourceConfig 'MSSQL -> MutationDB 'MSSQL Void (UnpreparedValue 'MSSQL) -> m (DBStepInfo 'MSSQL) Source #

mkLiveQuerySubscriptionPlan :: (MonadError QErr m, MonadIO m, MonadBaseControl IO m, MonadReader QueryTagsComment m) => UserInfo -> SourceName -> SourceConfig 'MSSQL -> Maybe Name -> RootFieldMap (QueryDB 'MSSQL Void (UnpreparedValue 'MSSQL)) -> m (SubscriptionQueryPlan 'MSSQL (MultiplexedQuery 'MSSQL)) Source #

mkDBStreamingSubscriptionPlan :: (MonadError QErr m, MonadIO m, MonadBaseControl IO m, MonadReader QueryTagsComment m) => UserInfo -> SourceName -> SourceConfig 'MSSQL -> (RootFieldAlias, QueryDB 'MSSQL Void (UnpreparedValue 'MSSQL)) -> m (SubscriptionQueryPlan 'MSSQL (MultiplexedQuery 'MSSQL)) Source #

mkDBQueryExplain :: MonadError QErr m => RootFieldAlias -> UserInfo -> SourceName -> SourceConfig 'MSSQL -> QueryDB 'MSSQL Void (UnpreparedValue 'MSSQL) -> m (AnyBackend DBStepInfo) Source #

mkSubscriptionExplain :: (MonadError QErr m, MonadIO m, MonadBaseControl IO m) => SubscriptionQueryPlan 'MSSQL (MultiplexedQuery 'MSSQL) -> m SubscriptionQueryPlanExplanation Source #

mkDBRemoteRelationshipPlan :: (MonadError QErr m, MonadQueryTags m) => UserInfo -> SourceName -> SourceConfig 'MSSQL -> NonEmpty Object -> HashMap FieldName (Column 'MSSQL, ScalarType 'MSSQL) -> FieldName -> (FieldName, SourceRelationshipSelection 'MSSQL Void UnpreparedValue) -> m (DBStepInfo 'MSSQL) Source #