Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type Projectible = ProjectibleWithPredicate AnyType
- data Aggregation syntax s a
- data QWindow syntax s
- type QWindowFrame = QGenExpr QWindowFrameContext
- type QExpr = QGenExpr QValueContext
- newtype QGenExpr context syntax s t = QExpr (TablePrefix -> syntax)
- data Q syntax (db :: (* -> *) -> *) s a
- class IsSql92SelectSyntax selectSyntax => HasQBuilder selectSyntax where
- type family QExprToField x
- type family QExprToIdentity x
- data QAggregateContext
- data QGroupingContext
- data QValueContext
- data QWindowingContext
- data QWindowFrameContext
- type QueryableSqlSyntax cmd = (IsSql92Syntax cmd, Sql92SanityCheck cmd, HasQBuilder (Sql92SelectSyntax cmd))
- type QGenExprTable ctxt syntax s tbl = tbl (QGenExpr ctxt syntax s)
- type QExprTable syntax s tbl = QGenExprTable QValueContext syntax s tbl
- coalesce_ :: IsSql92ExpressionSyntax expr => [QGenExpr ctxt expr s (Maybe a)] -> QGenExpr ctxt expr s a -> QGenExpr ctxt expr s a
- fromMaybe_ :: IsSql92ExpressionSyntax expr => QGenExpr ctxt expr s a -> QGenExpr ctxt expr s (Maybe a) -> QGenExpr ctxt expr s a
- position_ :: (IsSqlExpressionSyntaxStringType syntax text, IsSql92ExpressionSyntax syntax, Integral b) => QExpr syntax s text -> QExpr syntax s text -> QExpr syntax s b
- charLength_ :: (IsSqlExpressionSyntaxStringType syntax text, IsSql92ExpressionSyntax syntax) => QGenExpr context syntax s text -> QGenExpr context syntax s Int
- octetLength_ :: (IsSqlExpressionSyntaxStringType syntax text, IsSql92ExpressionSyntax syntax) => QGenExpr context syntax s text -> QGenExpr context syntax s Int
- bitLength_ :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s SqlBitString -> QGenExpr context syntax s Int
- currentTimestamp_ :: IsSql92ExpressionSyntax syntax => QGenExpr ctxt syntax s LocalTime
- lower_ :: (IsSqlExpressionSyntaxStringType syntax text, IsSql92ExpressionSyntax syntax) => QGenExpr context syntax s text -> QGenExpr context syntax s text
- upper_ :: (IsSqlExpressionSyntaxStringType syntax text, IsSql92ExpressionSyntax syntax) => QGenExpr context syntax s text -> QGenExpr context syntax s text
- trim_ :: (IsSqlExpressionSyntaxStringType syntax text, IsSql92ExpressionSyntax syntax) => QGenExpr context syntax s text -> QGenExpr context syntax s text
- if_ :: IsSql92ExpressionSyntax expr => [QIfCond context expr s a] -> QIfElse context expr s a -> QGenExpr context expr s a
- then_ :: QGenExpr context expr s Bool -> QGenExpr context expr s a -> QIfCond context expr s a
- else_ :: QGenExpr context expr s a -> QIfElse context expr s a
- then_' :: QGenExpr context expr s SqlBool -> QGenExpr context expr s a -> QIfCond context expr s a
- (<-.) :: forall fieldName. (SqlUpdatable expr s lhs rhs, IsSql92FieldNameSyntax fieldName) => lhs -> rhs -> QAssignment fieldName expr s
- current_ :: IsSql92ExpressionSyntax expr => QField s ty -> QExpr expr s ty
- type family HaskellLiteralForQExpr x = a
- class SqlValable a where
- type SqlValableTable table expr = (Beamable table, IsSql92ExpressionSyntax expr, FieldsFulfillConstraint (HasSqlValueSyntax (Sql92ExpressionValueSyntax expr)) table)
- default_ :: IsSql92ExpressionSyntax expr => QGenExpr ctxt expr s a
- all_ :: forall be (db :: (* -> *) -> *) table select s. (Database be db, IsSql92SelectSyntax select, IsSql92FromSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select)), IsSql92TableSourceSyntax (Sql92FromTableSourceSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select))), Sql92FromExpressionSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select)) ~ Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select), Table table) => DatabaseEntity be db (TableEntity table) -> Q select db s (table (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s))
- allFromView_ :: forall be (db :: (* -> *) -> *) table select s. (Database be db, IsSql92SelectSyntax select, IsSql92FromSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select)), IsSql92TableSourceSyntax (Sql92FromTableSourceSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select))), Sql92FromExpressionSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select)) ~ Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select), Beamable table) => DatabaseEntity be db (ViewEntity table) -> Q select db s (table (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s))
- join_ :: (Database be db, Table table, IsSql92SelectSyntax select, IsSql92FromSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select)), Sql92FromExpressionSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select)) ~ Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select), IsSql92TableSourceSyntax (Sql92FromTableSourceSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select)))) => DatabaseEntity be db (TableEntity table) -> (table (QExpr (Sql92SelectExpressionSyntax select) s) -> QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s Bool) -> Q select db s (table (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s))
- join_' :: (Database be db, Table table, IsSql92SelectSyntax select, IsSql92FromSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select)), Sql92FromExpressionSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select)) ~ Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select), IsSql92TableSourceSyntax (Sql92FromTableSourceSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select)))) => DatabaseEntity be db (TableEntity table) -> (table (QExpr (Sql92SelectExpressionSyntax select) s) -> QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s SqlBool) -> Q select db s (table (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s))
- guard_ :: forall select db s. IsSql92SelectSyntax select => QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s Bool -> Q select db s ()
- guard_' :: forall select db s. IsSql92SelectSyntax select => QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s SqlBool -> Q select db s ()
- filter_ :: forall r select db s. IsSql92SelectSyntax select => (r -> QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s Bool) -> Q select db s r -> Q select db s r
- filter_' :: forall r select db s. IsSql92SelectSyntax select => (r -> QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s SqlBool) -> Q select db s r -> Q select db s r
- related_ :: forall be db rel select s. (IsSql92SelectSyntax select, HasTableEquality (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) (PrimaryKey rel), HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select))) Bool, Database be db, Table rel) => DatabaseEntity be db (TableEntity rel) -> PrimaryKey rel (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s) -> Q select db s (rel (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s))
- relatedBy_ :: forall be db rel select s. (Database be db, Table rel, HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select))) Bool, IsSql92SelectSyntax select) => DatabaseEntity be db (TableEntity rel) -> (rel (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s) -> QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s Bool) -> Q select db s (rel (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s))
- relatedBy_' :: forall be db rel select s. (Database be db, Table rel, HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select))) Bool, IsSql92SelectSyntax select) => DatabaseEntity be db (TableEntity rel) -> (rel (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s) -> QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s SqlBool) -> Q select db s (rel (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s))
- leftJoin_ :: forall s r select db. (Projectible (Sql92SelectExpressionSyntax select) r, IsSql92SelectSyntax select, ThreadRewritable (QNested s) r, Retaggable (QExpr (Sql92SelectExpressionSyntax select) s) (WithRewrittenThread (QNested s) s r)) => Q select db (QNested s) r -> (WithRewrittenThread (QNested s) s r -> QExpr (Sql92SelectExpressionSyntax select) s Bool) -> Q select db s (Retag Nullable (WithRewrittenThread (QNested s) s r))
- leftJoin_' :: forall s r select db. (Projectible (Sql92SelectExpressionSyntax select) r, IsSql92SelectSyntax select, ThreadRewritable (QNested s) r, Retaggable (QExpr (Sql92SelectExpressionSyntax select) s) (WithRewrittenThread (QNested s) s r)) => Q select db (QNested s) r -> (WithRewrittenThread (QNested s) s r -> QExpr (Sql92SelectExpressionSyntax select) s SqlBool) -> Q select db s (Retag Nullable (WithRewrittenThread (QNested s) s r))
- perhaps_ :: forall s r select db. (Projectible (Sql92SelectExpressionSyntax select) r, IsSql92SelectSyntax select, ThreadRewritable (QNested s) r, Retaggable (QExpr (Sql92SelectExpressionSyntax select) s) (WithRewrittenThread (QNested s) s r)) => Q select db (QNested s) r -> Q select db s (Retag Nullable (WithRewrittenThread (QNested s) s r))
- outerJoin_ :: forall s a b select db. (Projectible (Sql92SelectExpressionSyntax select) a, Projectible (Sql92SelectExpressionSyntax select) b, ThreadRewritable (QNested s) a, ThreadRewritable (QNested s) b, Retaggable (QExpr (Sql92SelectExpressionSyntax select) s) (WithRewrittenThread (QNested s) s a), Retaggable (QExpr (Sql92SelectExpressionSyntax select) s) (WithRewrittenThread (QNested s) s b), IsSql92FromOuterJoinSyntax (Sql92SelectFromSyntax select)) => Q select db (QNested s) a -> Q select db (QNested s) b -> ((WithRewrittenThread (QNested s) s a, WithRewrittenThread (QNested s) s b) -> QExpr (Sql92SelectExpressionSyntax select) s Bool) -> Q select db s (Retag Nullable (WithRewrittenThread (QNested s) s a), Retag Nullable (WithRewrittenThread (QNested s) s b))
- outerJoin_' :: forall s a b select db. (Projectible (Sql92SelectExpressionSyntax select) a, Projectible (Sql92SelectExpressionSyntax select) b, ThreadRewritable (QNested s) a, ThreadRewritable (QNested s) b, Retaggable (QExpr (Sql92SelectExpressionSyntax select) s) (WithRewrittenThread (QNested s) s a), Retaggable (QExpr (Sql92SelectExpressionSyntax select) s) (WithRewrittenThread (QNested s) s b), IsSql92FromOuterJoinSyntax (Sql92SelectFromSyntax select)) => Q select db (QNested s) a -> Q select db (QNested s) b -> ((WithRewrittenThread (QNested s) s a, WithRewrittenThread (QNested s) s b) -> QExpr (Sql92SelectExpressionSyntax select) s SqlBool) -> Q select db s (Retag Nullable (WithRewrittenThread (QNested s) s a), Retag Nullable (WithRewrittenThread (QNested s) s b))
- subselect_ :: forall s r select db. (ThreadRewritable (QNested s) r, ProjectibleInSelectSyntax select r) => Q select db (QNested s) r -> Q select db s (WithRewrittenThread (QNested s) s r)
- references_ :: (IsSql92ExpressionSyntax expr, HasTableEquality expr (PrimaryKey t), HasSqlValueSyntax (Sql92ExpressionValueSyntax expr) Bool, Table t) => PrimaryKey t (QGenExpr ctxt expr s) -> t (QGenExpr ctxt expr s) -> QGenExpr ctxt expr s Bool
- nub_ :: (IsSql92SelectSyntax select, Projectible (Sql92SelectExpressionSyntax select) r) => Q select db s r -> Q select db s r
- class SqlJustable a b | b -> a where
- class IsSql92ExpressionSyntax syntax => SqlDeconstructMaybe syntax a nonNullA s | a s -> syntax, a -> nonNullA, a -> s, nonNullA -> s where
- class SqlOrderable syntax a | a -> syntax
- data QIfCond context expr s a
- data QIfElse context expr s a
- limit_ :: forall s a select db. (ProjectibleInSelectSyntax select a, ThreadRewritable (QNested s) a) => Integer -> Q select db (QNested s) a -> Q select db s (WithRewrittenThread (QNested s) s a)
- offset_ :: forall s a select db. (ProjectibleInSelectSyntax select a, ThreadRewritable (QNested s) a) => Integer -> Q select db (QNested s) a -> Q select db s (WithRewrittenThread (QNested s) s a)
- as_ :: forall a ctxt syntax s. QGenExpr ctxt syntax s a -> QGenExpr ctxt syntax s a
- exists_ :: (IsSql92SelectSyntax select, HasQBuilder select, ProjectibleInSelectSyntax select a, Sql92ExpressionSelectSyntax (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) ~ select) => Q select db s a -> QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s Bool
- unique_ :: (IsSql92SelectSyntax select, HasQBuilder select, ProjectibleInSelectSyntax select a, Sql92ExpressionSelectSyntax (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) ~ select) => Q select db s a -> QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s Bool
- distinct_ :: (IsSql99ExpressionSyntax (Sql92SelectExpressionSyntax select), HasQBuilder select, ProjectibleInSelectSyntax select a, Sql92ExpressionSelectSyntax (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) ~ select) => Q select db s a -> QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s Bool
- subquery_ :: (IsSql92SelectSyntax select, HasQBuilder select, ProjectibleInSelectSyntax select (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s a), Sql92ExpressionSelectSyntax (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) ~ select) => Q select (db :: (* -> *) -> *) s (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s a) -> QGenExpr ctxt (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s a
- union_ :: forall select db s a. (IsSql92SelectSyntax select, Projectible (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) a, ProjectibleInSelectSyntax select a, ThreadRewritable (QNested s) a) => Q select db (QNested s) a -> Q select db (QNested s) a -> Q select db s (WithRewrittenThread (QNested s) s a)
- unionAll_ :: forall select db s a. (IsSql92SelectSyntax select, Projectible (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) a, ProjectibleInSelectSyntax select a, ThreadRewritable (QNested s) a) => Q select db (QNested s) a -> Q select db (QNested s) a -> Q select db s (WithRewrittenThread (QNested s) s a)
- intersect_ :: forall select db s a. (IsSql92SelectSyntax select, Projectible (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) a, ProjectibleInSelectSyntax select a, ThreadRewritable (QNested s) a) => Q select db (QNested s) a -> Q select db (QNested s) a -> Q select db s (WithRewrittenThread (QNested s) s a)
- intersectAll_ :: forall select db s a. (IsSql92SelectSyntax select, Projectible (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) a, ProjectibleInSelectSyntax select a, ThreadRewritable (QNested s) a) => Q select db (QNested s) a -> Q select db (QNested s) a -> Q select db s (WithRewrittenThread (QNested s) s a)
- except_ :: forall select db s a. (IsSql92SelectSyntax select, Projectible (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) a, ProjectibleInSelectSyntax select a, ThreadRewritable (QNested s) a) => Q select db (QNested s) a -> Q select db (QNested s) a -> Q select db s (WithRewrittenThread (QNested s) s a)
- exceptAll_ :: forall select db s a. (IsSql92SelectSyntax select, Projectible (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) a, ProjectibleInSelectSyntax select a, ThreadRewritable (QNested s) a) => Q select db (QNested s) a -> Q select db (QNested s) a -> Q select db s (WithRewrittenThread (QNested s) s a)
- over_ :: IsSql2003ExpressionSyntax syntax => QAgg syntax s a -> QWindow (Sql2003ExpressionWindowFrameSyntax syntax) s -> QWindowExpr syntax s a
- frame_ :: (IsSql2003ExpressionSyntax syntax, SqlOrderable (Sql2003WindowFrameOrderingSyntax (Sql2003ExpressionWindowFrameSyntax syntax)) ordering, Projectible syntax partition, Sql2003ExpressionSanityCheck syntax) => Maybe partition -> Maybe ordering -> QFrameBounds (Sql2003WindowFrameBoundsSyntax (Sql2003ExpressionWindowFrameSyntax syntax)) -> QWindow (Sql2003ExpressionWindowFrameSyntax syntax) s
- bounds_ :: IsSql2003WindowFrameBoundsSyntax syntax => QFrameBound (Sql2003WindowFrameBoundsBoundSyntax syntax) -> Maybe (QFrameBound (Sql2003WindowFrameBoundsBoundSyntax syntax)) -> QFrameBounds syntax
- unbounded_ :: IsSql2003WindowFrameBoundSyntax syntax => QFrameBound syntax
- nrows_ :: IsSql2003WindowFrameBoundSyntax syntax => Int -> QFrameBound syntax
- fromBound_ :: IsSql2003WindowFrameBoundsSyntax syntax => QFrameBound (Sql2003WindowFrameBoundsBoundSyntax syntax) -> QFrameBounds syntax
- noBounds_ :: QFrameBounds syntax
- noOrder_ :: Maybe (QOrd syntax s Int)
- noPartition_ :: Maybe (QOrd syntax s Int)
- partitionBy_ :: partition -> Maybe partition
- orderPartitionBy_ :: partition -> Maybe partition
- withWindow_ :: forall window a s r select db. (ProjectibleWithPredicate WindowFrameContext (Sql2003ExpressionWindowFrameSyntax (Sql92SelectExpressionSyntax select)) window, Projectible (Sql92SelectExpressionSyntax select) r, Projectible (Sql92SelectExpressionSyntax select) a, ContextRewritable a, ThreadRewritable (QNested s) (WithRewrittenContext a QValueContext), IsSql92SelectSyntax select) => (r -> window) -> (r -> window -> a) -> Q select db (QNested s) r -> Q select db s (WithRewrittenThread (QNested s) s (WithRewrittenContext a QValueContext))
- orderBy_ :: forall s a ordering syntax db. (Projectible (Sql92SelectExpressionSyntax syntax) a, SqlOrderable (Sql92SelectOrderingSyntax syntax) ordering, ThreadRewritable (QNested s) a) => (a -> ordering) -> Q syntax db (QNested s) a -> Q syntax db s (WithRewrittenThread (QNested s) s a)
- asc_ :: forall syntax s a. IsSql92OrderingSyntax syntax => QExpr (Sql92OrderingExpressionSyntax syntax) s a -> QOrd syntax s a
- desc_ :: forall syntax s a. IsSql92OrderingSyntax syntax => QExpr (Sql92OrderingExpressionSyntax syntax) s a -> QOrd syntax s a
- nullsFirst_ :: IsSql2003OrderingElementaryOLAPOperationsSyntax syntax => QOrd syntax s a -> QOrd syntax s a
- nullsLast_ :: IsSql2003OrderingElementaryOLAPOperationsSyntax syntax => QOrd syntax s a -> QOrd syntax s a
- ntile_ :: (Integral a, IsSql2003NtileExpressionSyntax syntax) => QExpr syntax s Int -> QAgg syntax s a
- lead1_ :: IsSql2003LeadAndLagExpressionSyntax syntax => QExpr syntax s a -> QAgg syntax s a
- lag1_ :: IsSql2003LeadAndLagExpressionSyntax syntax => QExpr syntax s a -> QAgg syntax s a
- lead_ :: IsSql2003LeadAndLagExpressionSyntax syntax => QExpr syntax s a -> QExpr syntax s Int -> QAgg syntax s a
- lag_ :: IsSql2003LeadAndLagExpressionSyntax syntax => QExpr syntax s a -> QExpr syntax s Int -> QAgg syntax s a
- leadWithDefault_ :: IsSql2003LeadAndLagExpressionSyntax syntax => QExpr syntax s a -> QExpr syntax s Int -> QExpr syntax s a -> QAgg syntax s a
- lagWithDefault_ :: IsSql2003LeadAndLagExpressionSyntax syntax => QExpr syntax s a -> QExpr syntax s Int -> QExpr syntax s a -> QAgg syntax s a
- firstValue_ :: IsSql2003FirstValueAndLastValueExpressionSyntax syntax => QExpr syntax s a -> QAgg syntax s a
- lastValue_ :: IsSql2003FirstValueAndLastValueExpressionSyntax syntax => QExpr syntax s a -> QAgg syntax s a
- nthValue_ :: IsSql2003NthValueExpressionSyntax syntax => QExpr syntax s a -> QExpr syntax s Int -> QAgg syntax s a
- (**.) :: (Floating a, IsSql2003EnhancedNumericFunctionsExpressionSyntax syntax) => QGenExpr ctxt syntax s a -> QGenExpr ctxt syntax s a -> QGenExpr ctxt syntax s a
- ln_ :: (Floating a, IsSql2003EnhancedNumericFunctionsExpressionSyntax syntax) => QGenExpr ctxt syntax s a -> QGenExpr ctxt syntax s a
- exp_ :: (Floating a, IsSql2003EnhancedNumericFunctionsExpressionSyntax syntax) => QGenExpr ctxt syntax s a -> QGenExpr ctxt syntax s a
- sqrt_ :: (Floating a, IsSql2003EnhancedNumericFunctionsExpressionSyntax syntax) => QGenExpr ctxt syntax s a -> QGenExpr ctxt syntax s a
- ceiling_ :: (RealFrac a, Integral b, IsSql2003EnhancedNumericFunctionsExpressionSyntax syntax) => QGenExpr ctxt syntax s a -> QGenExpr ctxt syntax s b
- floor_ :: (RealFrac a, Integral b, IsSql2003EnhancedNumericFunctionsExpressionSyntax syntax) => QGenExpr ctxt syntax s a -> QGenExpr ctxt syntax s b
- stddevPopOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QAgg syntax s b
- stddevSampOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QAgg syntax s b
- varPopOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QAgg syntax s b
- varSampOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QAgg syntax s b
- stddevPop_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QAgg syntax s b
- stddevSamp_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QAgg syntax s b
- varPop_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QAgg syntax s b
- varSamp_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QAgg syntax s b
- covarPopOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- covarSampOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- corrOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- regrSlopeOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- regrInterceptOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- regrCountOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- regrRSquaredOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- regrAvgXOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- regrAvgYOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- regrSXXOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- regrSYYOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- regrSXYOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- covarPop_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- covarSamp_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- corr_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- regrSlope_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- regrIntercept_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- regrCount_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- regrRSquared_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- regrAvgX_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- regrAvgY_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- regrSXX_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- regrSYY_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- regrSXY_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b
- type ManyToMany db left right = forall syntax s. (Sql92SelectSanityCheck syntax, IsSql92SelectSyntax syntax, SqlEq (QExpr (Sql92SelectExpressionSyntax syntax) s) (PrimaryKey left (QExpr (Sql92SelectExpressionSyntax syntax) s)), SqlEq (QExpr (Sql92SelectExpressionSyntax syntax) s) (PrimaryKey right (QExpr (Sql92SelectExpressionSyntax syntax) s))) => Q syntax db s (left (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> Q syntax db s (right (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> Q syntax db s (left (QExpr (Sql92SelectExpressionSyntax syntax) s), right (QExpr (Sql92SelectExpressionSyntax syntax) s))
- type ManyToManyThrough db through left right = forall syntax s. (Sql92SelectSanityCheck syntax, IsSql92SelectSyntax syntax, SqlEq (QExpr (Sql92SelectExpressionSyntax syntax) s) (PrimaryKey left (QExpr (Sql92SelectExpressionSyntax syntax) s)), SqlEq (QExpr (Sql92SelectExpressionSyntax syntax) s) (PrimaryKey right (QExpr (Sql92SelectExpressionSyntax syntax) s))) => Q syntax db s (left (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> Q syntax db s (right (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> Q syntax db s (through (QExpr (Sql92SelectExpressionSyntax syntax) s), left (QExpr (Sql92SelectExpressionSyntax syntax) s), right (QExpr (Sql92SelectExpressionSyntax syntax) s))
- manyToMany_ :: (Database be db, Table joinThrough, Table left, Table right, Sql92SelectSanityCheck syntax, IsSql92SelectSyntax syntax, SqlEq (QExpr (Sql92SelectExpressionSyntax syntax) s) (PrimaryKey left (QExpr (Sql92SelectExpressionSyntax syntax) s)), SqlEq (QExpr (Sql92SelectExpressionSyntax syntax) s) (PrimaryKey right (QExpr (Sql92SelectExpressionSyntax syntax) s))) => DatabaseEntity be db (TableEntity joinThrough) -> (joinThrough (QExpr (Sql92SelectExpressionSyntax syntax) s) -> PrimaryKey left (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> (joinThrough (QExpr (Sql92SelectExpressionSyntax syntax) s) -> PrimaryKey right (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> Q syntax db s (left (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> Q syntax db s (right (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> Q syntax db s (left (QExpr (Sql92SelectExpressionSyntax syntax) s), right (QExpr (Sql92SelectExpressionSyntax syntax) s))
- manyToManyPassthrough_ :: (Database be db, Table joinThrough, Table left, Table right, Sql92SelectSanityCheck syntax, IsSql92SelectSyntax syntax, SqlEq (QExpr (Sql92SelectExpressionSyntax syntax) s) (PrimaryKey left (QExpr (Sql92SelectExpressionSyntax syntax) s)), SqlEq (QExpr (Sql92SelectExpressionSyntax syntax) s) (PrimaryKey right (QExpr (Sql92SelectExpressionSyntax syntax) s))) => DatabaseEntity be db (TableEntity joinThrough) -> (joinThrough (QExpr (Sql92SelectExpressionSyntax syntax) s) -> PrimaryKey left (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> (joinThrough (QExpr (Sql92SelectExpressionSyntax syntax) s) -> PrimaryKey right (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> Q syntax db s (left (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> Q syntax db s (right (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> Q syntax db s (joinThrough (QExpr (Sql92SelectExpressionSyntax syntax) s), left (QExpr (Sql92SelectExpressionSyntax syntax) s), right (QExpr (Sql92SelectExpressionSyntax syntax) s))
- type OneToMany db s one many = forall syntax. (IsSql92SelectSyntax syntax, HasTableEquality (Sql92SelectExpressionSyntax syntax) (PrimaryKey one), HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectExpressionSyntax syntax)) Bool) => one (QExpr (Sql92SelectExpressionSyntax syntax) s) -> Q syntax db s (many (QExpr (Sql92SelectExpressionSyntax syntax) s))
- type OneToManyOptional db s tbl rel = forall syntax. (IsSql92SelectSyntax syntax, HasTableEqualityNullable (Sql92SelectExpressionSyntax syntax) (PrimaryKey tbl), HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectExpressionSyntax syntax)) Bool, HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectExpressionSyntax syntax)) SqlNull) => tbl (QExpr (Sql92SelectExpressionSyntax syntax) s) -> Q syntax db s (rel (Nullable (QExpr (Sql92SelectExpressionSyntax syntax) s)))
- oneToMany_ :: (IsSql92SelectSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectExpressionSyntax syntax)) Bool, Database be db, HasTableEquality (Sql92SelectExpressionSyntax syntax) (PrimaryKey tbl), Table tbl, Table rel) => DatabaseEntity be db (TableEntity rel) -> (rel (QExpr (Sql92SelectExpressionSyntax syntax) s) -> PrimaryKey tbl (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> tbl (QExpr (Sql92SelectExpressionSyntax syntax) s) -> Q syntax db s (rel (QExpr (Sql92SelectExpressionSyntax syntax) s))
- oneToManyOptional_ :: (IsSql92SelectSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectExpressionSyntax syntax)) Bool, HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectExpressionSyntax syntax)) SqlNull, HasTableEqualityNullable (Sql92SelectExpressionSyntax syntax) (PrimaryKey tbl), Database be db, Table tbl, Table rel) => DatabaseEntity be db (TableEntity rel) -> (rel (QExpr (Sql92SelectExpressionSyntax syntax) s) -> PrimaryKey tbl (Nullable (QExpr (Sql92SelectExpressionSyntax syntax) s))) -> tbl (QExpr (Sql92SelectExpressionSyntax syntax) s) -> Q syntax db s (rel (Nullable (QExpr (Sql92SelectExpressionSyntax syntax) s)))
- type OneToOne db s one many = OneToMany db s one many
- type OneToMaybe db s tbl rel = OneToManyOptional db s tbl rel
- oneToOne_ :: (IsSql92SelectSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectExpressionSyntax syntax)) Bool, Database be db, HasTableEquality (Sql92SelectExpressionSyntax syntax) (PrimaryKey tbl), Table tbl, Table rel) => DatabaseEntity be db (TableEntity rel) -> (rel (QExpr (Sql92SelectExpressionSyntax syntax) s) -> PrimaryKey tbl (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> tbl (QExpr (Sql92SelectExpressionSyntax syntax) s) -> Q syntax db s (rel (QExpr (Sql92SelectExpressionSyntax syntax) s))
- oneToMaybe_ :: (IsSql92SelectSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectExpressionSyntax syntax)) Bool, HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectExpressionSyntax syntax)) SqlNull, HasTableEqualityNullable (Sql92SelectExpressionSyntax syntax) (PrimaryKey tbl), Database be db, Table tbl, Table rel) => DatabaseEntity be db (TableEntity rel) -> (rel (QExpr (Sql92SelectExpressionSyntax syntax) s) -> PrimaryKey tbl (Nullable (QExpr (Sql92SelectExpressionSyntax syntax) s))) -> tbl (QExpr (Sql92SelectExpressionSyntax syntax) s) -> Q syntax db s (rel (Nullable (QExpr (Sql92SelectExpressionSyntax syntax) s)))
- (&&.) :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s Bool -> QGenExpr context syntax s Bool -> QGenExpr context syntax s Bool
- (||.) :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s Bool -> QGenExpr context syntax s Bool -> QGenExpr context syntax s Bool
- (&&?.) :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s SqlBool -> QGenExpr context syntax s SqlBool -> QGenExpr context syntax s SqlBool
- (||?.) :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s SqlBool -> QGenExpr context syntax s SqlBool -> QGenExpr context syntax s SqlBool
- like_ :: (IsSqlExpressionSyntaxStringType syntax text, IsSql92ExpressionSyntax syntax) => QExpr syntax s text -> QExpr syntax s text -> QExpr syntax s Bool
- similarTo_ :: (IsSqlExpressionSyntaxStringType syntax text, IsSql99ExpressionSyntax syntax) => QExpr syntax s text -> QExpr syntax s text -> QExpr syntax s text
- not_ :: forall syntax context s. IsSql92ExpressionSyntax syntax => QGenExpr context syntax s Bool -> QGenExpr context syntax s Bool
- sqlNot_ :: forall syntax context s. IsSql92ExpressionSyntax syntax => QGenExpr context syntax s SqlBool -> QGenExpr context syntax s SqlBool
- div_ :: (Integral a, IsSql92ExpressionSyntax syntax) => QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s a
- mod_ :: (Integral a, IsSql92ExpressionSyntax syntax) => QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s a
- concat_ :: IsSql99ConcatExpressionSyntax syntax => [QGenExpr context syntax s Text] -> QGenExpr context syntax s Text
- data SqlBool
- isTrue_ :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s SqlBool -> QGenExpr context syntax s Bool
- isNotTrue_ :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s SqlBool -> QGenExpr context syntax s Bool
- isFalse_ :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s SqlBool -> QGenExpr context syntax s Bool
- isNotFalse_ :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s SqlBool -> QGenExpr context syntax s Bool
- isUnknown_ :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s SqlBool -> QGenExpr context syntax s Bool
- isNotUnknown_ :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s SqlBool -> QGenExpr context syntax s Bool
- unknownAs_ :: IsSql92ExpressionSyntax syntax => Bool -> QGenExpr context syntax s SqlBool -> QGenExpr context syntax s Bool
- sqlBool_ :: QGenExpr context syntax s Bool -> QGenExpr context syntax s SqlBool
- class (IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) Bool) => HasSqlEqualityCheck syntax a where
- class HasSqlEqualityCheck syntax a => HasSqlQuantifiedEqualityCheck syntax a where
- class SqlEq expr a | a -> expr where
- class SqlOrd expr e | e -> expr where
- class SqlEq expr a => SqlEqQuantified expr quantified a | a -> expr quantified where
- class SqlOrd expr e => SqlOrdQuantified expr quantified e | e -> expr quantified where
- data QQuantified expr s r
- anyOf_ :: forall s a select expr db. (IsSql92SelectSyntax select, IsSql92ExpressionSyntax expr, HasQBuilder select, Sql92ExpressionSelectSyntax expr ~ select) => Q select db (QNested s) (QExpr (Sql92SelectExpressionSyntax select) (QNested s) a) -> QQuantified expr s a
- allOf_ :: forall s a select expr db. (IsSql92SelectSyntax select, IsSql92ExpressionSyntax expr, HasQBuilder select, Sql92ExpressionSelectSyntax expr ~ select) => Q select db (QNested s) (QExpr (Sql92SelectExpressionSyntax select) (QNested s) a) -> QQuantified expr s a
- anyIn_ :: forall s a expr. IsSql92ExpressionSyntax expr => [QExpr expr s a] -> QQuantified expr s a
- allIn_ :: forall s a expr. IsSql92ExpressionSyntax expr => [QExpr expr s a] -> QQuantified expr s a
- between_ :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s Bool
- in_ :: (IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) Bool) => QGenExpr context syntax s a -> [QGenExpr context syntax s a] -> QGenExpr context syntax s Bool
- aggregate_ :: forall select a r db s. (ProjectibleWithPredicate AggregateContext (Sql92SelectExpressionSyntax select) a, Projectible (Sql92SelectExpressionSyntax select) r, Projectible (Sql92SelectExpressionSyntax select) a, ContextRewritable a, ThreadRewritable (QNested s) (WithRewrittenContext a QValueContext), IsSql92SelectSyntax select) => (r -> a) -> Q select db (QNested s) r -> Q select db s (WithRewrittenThread (QNested s) s (WithRewrittenContext a QValueContext))
- filterWhere_ :: IsSql2003ExpressionElementaryOLAPOperationsSyntax expr => QAgg expr s a -> QExpr expr s Bool -> QAgg expr s a
- filterWhere_' :: IsSql2003ExpressionElementaryOLAPOperationsSyntax expr => QAgg expr s a -> QExpr expr s SqlBool -> QAgg expr s a
- class QGroupable expr grouped | expr -> grouped, grouped -> expr where
- sum_ :: (IsSql92AggregationExpressionSyntax expr, Num a) => QExpr expr s a -> QAgg expr s (Maybe a)
- avg_ :: (IsSql92AggregationExpressionSyntax expr, Num a) => QExpr expr s a -> QAgg expr s (Maybe a)
- min_ :: IsSql92AggregationExpressionSyntax expr => QExpr expr s a -> QAgg expr s (Maybe a)
- max_ :: IsSql92AggregationExpressionSyntax expr => QExpr expr s a -> QAgg expr s (Maybe a)
- count_ :: (IsSql92AggregationExpressionSyntax expr, Integral b) => QExpr expr s a -> QAgg expr s b
- countAll_ :: IsSql92AggregationExpressionSyntax expr => QAgg expr s Int
- rank_ :: IsSql2003ExpressionElementaryOLAPOperationsSyntax expr => QAgg expr s Int
- cumeDist_ :: IsSql2003ExpressionAdvancedOLAPOperationsSyntax expr => QAgg expr s Double
- percentRank_ :: IsSql2003ExpressionAdvancedOLAPOperationsSyntax expr => QAgg expr s Double
- denseRank_ :: IsSql2003ExpressionAdvancedOLAPOperationsSyntax expr => QAgg expr s Int
- every_ :: IsSql99AggregationExpressionSyntax expr => QExpr expr s SqlBool -> QAgg expr s SqlBool
- any_ :: IsSql99AggregationExpressionSyntax expr => QExpr expr s SqlBool -> QAgg expr s SqlBool
- some_ :: IsSql99AggregationExpressionSyntax expr => QExpr expr s SqlBool -> QAgg expr s SqlBool
- sumOver_ :: (IsSql92AggregationExpressionSyntax expr, Num a) => Maybe (Sql92AggregationSetQuantifierSyntax expr) -> QExpr expr s a -> QAgg expr s (Maybe a)
- avgOver_ :: (IsSql92AggregationExpressionSyntax expr, Num a) => Maybe (Sql92AggregationSetQuantifierSyntax expr) -> QExpr expr s a -> QAgg expr s (Maybe a)
- minOver_ :: IsSql92AggregationExpressionSyntax expr => Maybe (Sql92AggregationSetQuantifierSyntax expr) -> QExpr expr s a -> QAgg expr s (Maybe a)
- maxOver_ :: IsSql92AggregationExpressionSyntax expr => Maybe (Sql92AggregationSetQuantifierSyntax expr) -> QExpr expr s a -> QAgg expr s (Maybe a)
- countOver_ :: (IsSql92AggregationExpressionSyntax expr, Integral b) => Maybe (Sql92AggregationSetQuantifierSyntax expr) -> QExpr expr s a -> QAgg expr s b
- everyOver_ :: IsSql99AggregationExpressionSyntax expr => Maybe (Sql92AggregationSetQuantifierSyntax expr) -> QExpr expr s SqlBool -> QAgg expr s SqlBool
- anyOver_ :: IsSql99AggregationExpressionSyntax expr => Maybe (Sql92AggregationSetQuantifierSyntax expr) -> QExpr expr s SqlBool -> QAgg expr s SqlBool
- someOver_ :: IsSql99AggregationExpressionSyntax expr => Maybe (Sql92AggregationSetQuantifierSyntax expr) -> QExpr expr s SqlBool -> QAgg expr s SqlBool
- distinctInGroup_ :: IsSql92AggregationSetQuantifierSyntax s => Maybe s
- allInGroup_ :: IsSql92AggregationSetQuantifierSyntax s => Maybe s
- allInGroupExplicitly_ :: IsSql92AggregationSetQuantifierSyntax s => Maybe s
- module Database.Beam.Query.CustomSQL
- newtype SqlSelect select a = SqlSelect select
- select :: forall syntax db res. (ProjectibleInSelectSyntax syntax res, IsSql92SelectSyntax syntax, HasQBuilder syntax) => Q syntax db QueryInaccessible res -> SqlSelect syntax (QExprToIdentity res)
- lookup_ :: (HasQBuilder syntax, Sql92SelectSanityCheck syntax, SqlValableTable (PrimaryKey table) (Sql92SelectExpressionSyntax syntax), HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectExpressionSyntax syntax)) Bool, HasTableEquality (Sql92SelectExpressionSyntax syntax) (PrimaryKey table), Beamable table, Table table, Database be db) => DatabaseEntity be db (TableEntity table) -> PrimaryKey table Identity -> SqlSelect syntax (table Identity)
- runSelectReturningList :: (IsSql92Syntax cmd, MonadBeam cmd be hdl m, FromBackendRow be a) => SqlSelect (Sql92SelectSyntax cmd) a -> m [a]
- runSelectReturningOne :: (IsSql92Syntax cmd, MonadBeam cmd be hdl m, FromBackendRow be a) => SqlSelect (Sql92SelectSyntax cmd) a -> m (Maybe a)
- dumpSqlSelect :: ProjectibleInSelectSyntax SqlSyntaxBuilder res => Q SqlSyntaxBuilder db QueryInaccessible res -> IO ()
- data SqlInsert syntax
- = SqlInsert syntax
- | SqlInsertNoRows
- insert :: (IsSql92InsertSyntax syntax, Projectible Text (table (QField s))) => DatabaseEntity be db (TableEntity table) -> SqlInsertValues (Sql92InsertValuesSyntax syntax) (table (QExpr (Sql92InsertExpressionSyntax syntax) s)) -> SqlInsert syntax
- insertOnly :: (IsSql92InsertSyntax syntax, Projectible Text (QExprToField r)) => DatabaseEntity be db (TableEntity table) -> (table (QField s) -> QExprToField r) -> SqlInsertValues (Sql92InsertValuesSyntax syntax) r -> SqlInsert syntax
- runInsert :: (IsSql92Syntax cmd, MonadBeam cmd be hdl m) => SqlInsert (Sql92InsertSyntax cmd) -> m ()
- data SqlInsertValues insertValues proj
- = SqlInsertValues insertValues
- | SqlInsertValuesEmpty
- insertExpressions :: forall syntax table s. (Beamable table, IsSql92InsertValuesSyntax syntax) => (forall s'. [table (QExpr (Sql92InsertValuesExpressionSyntax syntax) s')]) -> SqlInsertValues syntax (table (QExpr (Sql92InsertValuesExpressionSyntax syntax) s))
- insertValues :: forall table syntax s. (Beamable table, IsSql92InsertValuesSyntax syntax, FieldsFulfillConstraint (HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92InsertValuesExpressionSyntax syntax))) table) => [table Identity] -> SqlInsertValues syntax (table (QExpr (Sql92InsertValuesExpressionSyntax syntax) s))
- insertFrom :: (IsSql92InsertValuesSyntax syntax, HasQBuilder (Sql92InsertValuesSelectSyntax syntax), Projectible (Sql92SelectExpressionSyntax (Sql92InsertValuesSelectSyntax syntax)) r) => Q (Sql92InsertValuesSelectSyntax syntax) db QueryInaccessible r -> SqlInsertValues syntax r
- insertData :: forall syntax r. (Projectible (Sql92InsertValuesExpressionSyntax syntax) r, IsSql92InsertValuesSyntax syntax) => [r] -> SqlInsertValues syntax r
- data SqlUpdate syntax (table :: (* -> *) -> *)
- = SqlUpdate syntax
- | SqlIdentityUpdate
- update :: (Beamable table, IsSql92UpdateSyntax syntax) => DatabaseEntity be db (TableEntity table) -> (forall s. table (QField s) -> [QAssignment (Sql92UpdateFieldNameSyntax syntax) (Sql92UpdateExpressionSyntax syntax) s]) -> (forall s. table (QExpr (Sql92UpdateExpressionSyntax syntax) s) -> QExpr (Sql92UpdateExpressionSyntax syntax) s Bool) -> SqlUpdate syntax table
- save :: forall table syntax be db. (Table table, IsSql92UpdateSyntax syntax, SqlValableTable (PrimaryKey table) (Sql92UpdateExpressionSyntax syntax), SqlValableTable table (Sql92UpdateExpressionSyntax syntax), HasTableEquality (Sql92UpdateExpressionSyntax syntax) (PrimaryKey table), HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92UpdateExpressionSyntax syntax)) Bool) => DatabaseEntity be db (TableEntity table) -> table Identity -> SqlUpdate syntax table
- runUpdate :: (IsSql92Syntax cmd, MonadBeam cmd be hdl m) => SqlUpdate (Sql92UpdateSyntax cmd) tbl -> m ()
- newtype SqlDelete syntax (table :: (* -> *) -> *) = SqlDelete syntax
- delete :: forall be db delete table. IsSql92DeleteSyntax delete => DatabaseEntity be db (TableEntity table) -> (forall s. (forall s'. table (QExpr (Sql92DeleteExpressionSyntax delete) s')) -> QExpr (Sql92DeleteExpressionSyntax delete) s Bool) -> SqlDelete delete table
- runDelete :: (IsSql92Syntax cmd, MonadBeam cmd be hdl m) => SqlDelete (Sql92DeleteSyntax cmd) table -> m ()
Query type
data Aggregation syntax s a Source #
data QWindow syntax s Source #
Instances
ProjectibleWithPredicate WindowFrameContext syntax (QWindow syntax s) Source # | |
Defined in Database.Beam.Query.Internal project' :: Monad m => Proxy WindowFrameContext -> (forall context. WindowFrameContext context => Proxy context -> WithExprContext syntax -> m (WithExprContext syntax)) -> QWindow syntax s -> m (QWindow syntax s) Source # |
newtype QGenExpr context syntax s t Source #
The type of lifted beam expressions that will yield the haskell type t
.
context
is a type-level representation of the types of expressions this
can contain. For example, QAggregateContext
represents expressions that
may contain aggregates, and QWindowingContext
represents expressions that
may contain OVER
.
syntax
is the expression syntax being built (usually a type that
implements IsSql92ExpressionSyntax
at least, but not always).
s
is a state threading parameter that prevents QExpr
s from incompatible
sources to be combined. For example, this is used to prevent monadic joins
from depending on the result of previous joins (so-called LATERAL
joins).
QExpr (TablePrefix -> syntax) |
Instances
(Beamable t, contextPredicate context) => ProjectibleWithPredicate contextPredicate syntax (t (Nullable (QGenExpr context syntax s))) Source # | |
Defined in Database.Beam.Query.Internal | |
(Beamable t, contextPredicate context) => ProjectibleWithPredicate contextPredicate syntax (t (QGenExpr context syntax s)) Source # | |
Defined in Database.Beam.Query.Internal project' :: Monad m => Proxy contextPredicate -> (forall context0. contextPredicate context0 => Proxy context0 -> WithExprContext syntax -> m (WithExprContext syntax)) -> t (QGenExpr context syntax s) -> m (t (QGenExpr context syntax s)) Source # | |
contextPredicate context => ProjectibleWithPredicate contextPredicate syntax (QGenExpr context syntax s a) Source # | |
Defined in Database.Beam.Query.Internal project' :: Monad m => Proxy contextPredicate -> (forall context0. contextPredicate context0 => Proxy context0 -> WithExprContext syntax -> m (WithExprContext syntax)) -> QGenExpr context syntax s a -> m (QGenExpr context syntax s a) Source # | |
Beamable tbl => ThreadRewritable s (tbl (Nullable (QGenExpr ctxt syntax s))) Source # | |
Defined in Database.Beam.Query.Internal rewriteThread :: Proxy s' -> tbl (Nullable (QGenExpr ctxt syntax s)) -> WithRewrittenThread s s' (tbl (Nullable (QGenExpr ctxt syntax s))) Source # | |
Beamable tbl => ThreadRewritable s (tbl (QGenExpr ctxt syntax s)) Source # | |
Defined in Database.Beam.Query.Internal type WithRewrittenThread s s' (tbl (QGenExpr ctxt syntax s)) :: * Source # rewriteThread :: Proxy s' -> tbl (QGenExpr ctxt syntax s) -> WithRewrittenThread s s' (tbl (QGenExpr ctxt syntax s)) Source # | |
(IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) Bool, Beamable t) => SqlDeconstructMaybe syntax (t (Nullable (QGenExpr ctxt syntax s))) (t (QGenExpr ctxt syntax s)) s Source # | |
Defined in Database.Beam.Query.Combinators isJust_ :: t (Nullable (QGenExpr ctxt syntax s)) -> QGenExpr ctxt0 syntax s Bool Source # isNothing_ :: t (Nullable (QGenExpr ctxt syntax s)) -> QGenExpr ctxt0 syntax s Bool Source # maybe_ :: QGenExpr ctxt0 syntax s y -> (t (QGenExpr ctxt syntax s) -> QGenExpr ctxt0 syntax s y) -> t (Nullable (QGenExpr ctxt syntax s)) -> QGenExpr ctxt0 syntax s y Source # | |
SqlOrderable syntax (QOrd syntax s a) Source # | |
Defined in Database.Beam.Query.Combinators makeSQLOrdering :: QOrd syntax s a -> [WithExprContext syntax] | |
ThreadRewritable s (QGenExpr ctxt syntax s a) Source # | |
Defined in Database.Beam.Query.Internal type WithRewrittenThread s s' (QGenExpr ctxt syntax s a) :: * Source # rewriteThread :: Proxy s' -> QGenExpr ctxt syntax s a -> WithRewrittenThread s s' (QGenExpr ctxt syntax s a) Source # | |
IsSql92ExpressionSyntax syntax => SqlDeconstructMaybe syntax (QGenExpr ctxt syntax s (Maybe x)) (QGenExpr ctxt syntax s x) s Source # | |
Defined in Database.Beam.Query.Combinators isJust_ :: QGenExpr ctxt syntax s (Maybe x) -> QGenExpr ctxt0 syntax s Bool Source # isNothing_ :: QGenExpr ctxt syntax s (Maybe x) -> QGenExpr ctxt0 syntax s Bool Source # maybe_ :: QGenExpr ctxt0 syntax s y -> (QGenExpr ctxt syntax s x -> QGenExpr ctxt0 syntax s y) -> QGenExpr ctxt syntax s (Maybe x) -> QGenExpr ctxt0 syntax s y Source # | |
Beamable tbl => ContextRewritable (tbl (Nullable (QGenExpr old syntax s))) Source # | |
Defined in Database.Beam.Query.Internal rewriteContext :: Proxy ctxt -> tbl (Nullable (QGenExpr old syntax s)) -> WithRewrittenContext (tbl (Nullable (QGenExpr old syntax s))) ctxt Source # | |
Beamable tbl => ContextRewritable (tbl (QGenExpr old syntax s)) Source # | |
Defined in Database.Beam.Query.Internal type WithRewrittenContext (tbl (QGenExpr old syntax s)) ctxt :: * Source # rewriteContext :: Proxy ctxt -> tbl (QGenExpr old syntax s) -> WithRewrittenContext (tbl (QGenExpr old syntax s)) ctxt Source # | |
(Beamable table, IsSql92ExpressionSyntax syntax, FieldsFulfillConstraintNullable (HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax)) table) => SqlValable (table (Nullable (QGenExpr ctxt syntax s))) Source # | |
Defined in Database.Beam.Query.Combinators | |
(Beamable table, IsSql92ExpressionSyntax syntax, FieldsFulfillConstraint (HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax)) table) => SqlValable (table (QGenExpr ctxt syntax s)) Source # | |
Defined in Database.Beam.Query.Combinators | |
(Table t, IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) SqlNull) => SqlJustable (t (QExpr syntax s)) (t (Nullable (QExpr syntax s))) Source # | |
Beamable tbl => QGroupable (tbl (QExpr expr s)) (tbl (QGroupExpr expr s)) Source # |
|
Defined in Database.Beam.Query.Aggregate group_ :: tbl (QExpr expr s) -> tbl (QGroupExpr expr s) Source # | |
(Table t, IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) SqlNull) => SqlJustable (PrimaryKey t (QExpr syntax s)) (PrimaryKey t (Nullable (QExpr syntax s))) Source # | |
Defined in Database.Beam.Query.Combinators just_ :: PrimaryKey t (QExpr syntax s) -> PrimaryKey t (Nullable (QExpr syntax s)) Source # nothing_ :: PrimaryKey t (Nullable (QExpr syntax s)) Source # | |
(IsSql92ExpressionSyntax syntax, FieldsFulfillConstraintNullable (HasSqlEqualityCheck syntax) tbl, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) Bool, Beamable tbl) => SqlEq (QGenExpr context syntax s) (tbl (Nullable (QGenExpr context syntax s))) Source # | |
Defined in Database.Beam.Query.Ord (==.) :: tbl (Nullable (QGenExpr context syntax s)) -> tbl (Nullable (QGenExpr context syntax s)) -> QGenExpr context syntax s Bool Source # (/=.) :: tbl (Nullable (QGenExpr context syntax s)) -> tbl (Nullable (QGenExpr context syntax s)) -> QGenExpr context syntax s Bool Source # (==?.) :: tbl (Nullable (QGenExpr context syntax s)) -> tbl (Nullable (QGenExpr context syntax s)) -> QGenExpr context syntax s SqlBool Source # (/=?.) :: tbl (Nullable (QGenExpr context syntax s)) -> tbl (Nullable (QGenExpr context syntax s)) -> QGenExpr context syntax s SqlBool Source # | |
(IsSql92ExpressionSyntax syntax, FieldsFulfillConstraint (HasSqlEqualityCheck syntax) tbl, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) Bool, Beamable tbl) => SqlEq (QGenExpr context syntax s) (tbl (QGenExpr context syntax s)) Source # | Compare two arbitrary |
Defined in Database.Beam.Query.Ord (==.) :: tbl (QGenExpr context syntax s) -> tbl (QGenExpr context syntax s) -> QGenExpr context syntax s Bool Source # (/=.) :: tbl (QGenExpr context syntax s) -> tbl (QGenExpr context syntax s) -> QGenExpr context syntax s Bool Source # (==?.) :: tbl (QGenExpr context syntax s) -> tbl (QGenExpr context syntax s) -> QGenExpr context syntax s SqlBool Source # (/=?.) :: tbl (QGenExpr context syntax s) -> tbl (QGenExpr context syntax s) -> QGenExpr context syntax s SqlBool Source # | |
(IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) SqlNull) => SqlJustable (QExpr syntax s a) (QExpr syntax s (Maybe a)) Source # | |
QGroupable (QExpr expr s a) (QGroupExpr expr s a) Source # |
|
Defined in Database.Beam.Query.Aggregate group_ :: QExpr expr s a -> QGroupExpr expr s a Source # | |
IsSql92ExpressionSyntax syntax => SqlOrdQuantified (QGenExpr context syntax s) (QQuantified syntax s a) (QGenExpr context syntax s a) Source # | |
Defined in Database.Beam.Query.Ord (<*.) :: QGenExpr context syntax s a -> QQuantified syntax s a -> QGenExpr context syntax s Bool Source # (>*.) :: QGenExpr context syntax s a -> QQuantified syntax s a -> QGenExpr context syntax s Bool Source # (<=*.) :: QGenExpr context syntax s a -> QQuantified syntax s a -> QGenExpr context syntax s Bool Source # (>=*.) :: QGenExpr context syntax s a -> QQuantified syntax s a -> QGenExpr context syntax s Bool Source # | |
(IsSql92ExpressionSyntax syntax, HasSqlQuantifiedEqualityCheck syntax a) => SqlEqQuantified (QGenExpr context syntax s) (QQuantified syntax s a) (QGenExpr context syntax s a) Source # | Two arbitrary expressions can be quantifiably compared for equality. |
Defined in Database.Beam.Query.Ord | |
Retaggable (QGenExpr ctxt expr s) (QGenExpr ctxt expr s t) Source # | |
IsSql92ExpressionSyntax syntax => SqlOrd (QGenExpr context syntax s) (QGenExpr context syntax s a) Source # | |
Defined in Database.Beam.Query.Ord (<.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s Bool Source # (>.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s Bool Source # (<=.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s Bool Source # (>=.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s Bool Source # | |
(IsSql92ExpressionSyntax syntax, HasSqlEqualityCheck syntax a) => SqlEq (QGenExpr context syntax s) (QGenExpr context syntax s a) Source # | Compare two arbitrary expressions (of the same type) for equality |
Defined in Database.Beam.Query.Ord (==.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s Bool Source # (/=.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s Bool Source # (==?.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s SqlBool Source # (/=?.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s SqlBool Source # | |
Eq syntax => Eq (QGenExpr context syntax s t) Source # | |
(Fractional a, IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) a) => Fractional (QGenExpr context syntax s a) Source # | |
(Num a, IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) a) => Num (QGenExpr context syntax s a) Source # | |
Defined in Database.Beam.Query.Internal (+) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s a # (-) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s a # (*) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s a # negate :: QGenExpr context syntax s a -> QGenExpr context syntax s a # abs :: QGenExpr context syntax s a -> QGenExpr context syntax s a # signum :: QGenExpr context syntax s a -> QGenExpr context syntax s a # fromInteger :: Integer -> QGenExpr context syntax s a # | |
(IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) [Char]) => IsString (QGenExpr context syntax s Text) Source # | |
Defined in Database.Beam.Query.Internal fromString :: String -> QGenExpr context syntax s Text # | |
ContextRewritable (QGenExpr old syntax s a) Source # | |
Defined in Database.Beam.Query.Internal type WithRewrittenContext (QGenExpr old syntax s a) ctxt :: * Source # rewriteContext :: Proxy ctxt -> QGenExpr old syntax s a -> WithRewrittenContext (QGenExpr old syntax s a) ctxt Source # | |
(HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) a, IsSql92ExpressionSyntax syntax) => SqlValable (QGenExpr ctxt syntax s a) Source # | |
Defined in Database.Beam.Query.Combinators | |
type WithRewrittenThread s s' (tbl (Nullable (QGenExpr ctxt syntax s))) Source # | |
Defined in Database.Beam.Query.Internal type WithRewrittenThread s s' (tbl (Nullable (QGenExpr ctxt syntax s))) = tbl (Nullable (QGenExpr ctxt syntax s')) | |
type WithRewrittenThread s s' (tbl (QGenExpr ctxt syntax s)) Source # | |
Defined in Database.Beam.Query.Internal | |
type WithRewrittenThread s s' (QGenExpr ctxt syntax s a) Source # | |
Defined in Database.Beam.Query.Internal | |
type Retag tag (QGenExpr ctxt expr s t) Source # | |
Defined in Database.Beam.Query.Internal | |
type QExprToField (table (Nullable (QGenExpr context syntax s))) Source # | |
Defined in Database.Beam.Query.Types | |
type QExprToField (table (QGenExpr context syntax s)) Source # | |
Defined in Database.Beam.Query.Types | |
type QExprToIdentity (table (QGenExpr context syntax s)) Source # | |
Defined in Database.Beam.Query.Types | |
type HaskellLiteralForQExpr (table (QGenExpr context syntax s)) Source # | |
Defined in Database.Beam.Query.Combinators | |
type WithRewrittenContext (tbl (Nullable (QGenExpr old syntax s))) ctxt Source # | |
Defined in Database.Beam.Query.Internal type WithRewrittenContext (tbl (Nullable (QGenExpr old syntax s))) ctxt = tbl (Nullable (QGenExpr ctxt syntax s)) | |
type WithRewrittenContext (tbl (QGenExpr old syntax s)) ctxt Source # | |
Defined in Database.Beam.Query.Internal | |
type QExprToField (QGenExpr ctxt syntax s a) Source # | |
Defined in Database.Beam.Query.Types | |
type QExprToIdentity (QGenExpr context syntax s a) Source # | |
Defined in Database.Beam.Query.Types | |
type HaskellLiteralForQExpr (QGenExpr context syntax s a) Source # | |
Defined in Database.Beam.Query.Combinators | |
type WithRewrittenContext (QGenExpr old syntax s a) ctxt Source # | |
Defined in Database.Beam.Query.Internal |
data Q syntax (db :: (* -> *) -> *) s a Source #
The type of queries over the database db
returning results of type a
.
The s
argument is a threading argument meant to restrict cross-usage of
QExpr
s. syntax
represents the SQL syntax that this query is building.
Instances
Monad (Q syntax db s) Source # | |
Functor (Q syntax db s) Source # | |
Applicative (Q syntax db s) Source # | |
Defined in Database.Beam.Query.Internal pure :: a -> Q syntax db s a # (<*>) :: Q syntax db s (a -> b) -> Q syntax db s a -> Q syntax db s b # liftA2 :: (a -> b -> c) -> Q syntax db s a -> Q syntax db s b -> Q syntax db s c # (*>) :: Q syntax db s a -> Q syntax db s b -> Q syntax db s b # (<*) :: Q syntax db s a -> Q syntax db s b -> Q syntax db s a # |
class IsSql92SelectSyntax selectSyntax => HasQBuilder selectSyntax where Source #
buildSqlQuery :: Projectible (Sql92SelectExpressionSyntax selectSyntax) a => TablePrefix -> Q selectSyntax db s a -> selectSyntax Source #
Instances
HasQBuilder Select Source # | |
Defined in Database.Beam.Query.Types buildSqlQuery :: Projectible (Sql92SelectExpressionSyntax Select) a => TablePrefix -> Q Select db s a -> Select Source # | |
HasQBuilder SqlSyntaxBuilder Source # | |
Defined in Database.Beam.Query.Types buildSqlQuery :: Projectible (Sql92SelectExpressionSyntax SqlSyntaxBuilder) a => TablePrefix -> Q SqlSyntaxBuilder db s a -> SqlSyntaxBuilder Source # |
type family QExprToField x Source #
Instances
type family QExprToIdentity x Source #
Instances
Query expression contexts
A context is a type-level value that signifies where an expression can
be used. For example, QExpr
corresponds to QGenExpr
s that result in
values. In reality, QExpr
is really QGenExpr
parameterized over the
QValueContext
. Similarly, QAgg
represents expressions that contain
aggregates, but it is just QGenExpr
parameterized over
QAggregateContext
data QAggregateContext Source #
Instances
type ContextName QAggregateContext Source # | |
Defined in Database.Beam.Query.Internal |
data QGroupingContext Source #
Instances
Beamable tbl => QGroupable (tbl (QExpr expr s)) (tbl (QGroupExpr expr s)) Source # |
|
Defined in Database.Beam.Query.Aggregate group_ :: tbl (QExpr expr s) -> tbl (QGroupExpr expr s) Source # | |
QGroupable (QExpr expr s a) (QGroupExpr expr s a) Source # |
|
Defined in Database.Beam.Query.Aggregate group_ :: QExpr expr s a -> QGroupExpr expr s a Source # | |
type ContextName QGroupingContext Source # | |
Defined in Database.Beam.Query.Internal |
data QValueContext Source #
Instances
data QWindowingContext Source #
Instances
type ContextName QWindowingContext Source # | |
Defined in Database.Beam.Query.Internal |
data QWindowFrameContext Source #
Instances
type ContextName QWindowFrameContext Source # | |
Defined in Database.Beam.Query.Internal |
type QueryableSqlSyntax cmd = (IsSql92Syntax cmd, Sql92SanityCheck cmd, HasQBuilder (Sql92SelectSyntax cmd)) Source #
type QGenExprTable ctxt syntax s tbl = tbl (QGenExpr ctxt syntax s) Source #
A version of the table where each field is a QGenExpr
type QExprTable syntax s tbl = QGenExprTable QValueContext syntax s tbl Source #
Various SQL functions and constructs
coalesce_ :: IsSql92ExpressionSyntax expr => [QGenExpr ctxt expr s (Maybe a)] -> QGenExpr ctxt expr s a -> QGenExpr ctxt expr s a Source #
SQL COALESCE
support
fromMaybe_ :: IsSql92ExpressionSyntax expr => QGenExpr ctxt expr s a -> QGenExpr ctxt expr s (Maybe a) -> QGenExpr ctxt expr s a Source #
Converta a Maybe
value to a concrete value, by suppling a default
position_ :: (IsSqlExpressionSyntaxStringType syntax text, IsSql92ExpressionSyntax syntax, Integral b) => QExpr syntax s text -> QExpr syntax s text -> QExpr syntax s b Source #
SQL POSITION(.. IN ..)
function
charLength_ :: (IsSqlExpressionSyntaxStringType syntax text, IsSql92ExpressionSyntax syntax) => QGenExpr context syntax s text -> QGenExpr context syntax s Int Source #
SQL CHAR_LENGTH
function
octetLength_ :: (IsSqlExpressionSyntaxStringType syntax text, IsSql92ExpressionSyntax syntax) => QGenExpr context syntax s text -> QGenExpr context syntax s Int Source #
SQL OCTET_LENGTH
function
bitLength_ :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s SqlBitString -> QGenExpr context syntax s Int Source #
SQL BIT_LENGTH
function
currentTimestamp_ :: IsSql92ExpressionSyntax syntax => QGenExpr ctxt syntax s LocalTime Source #
SQL CURRENT_TIMESTAMP
function
lower_ :: (IsSqlExpressionSyntaxStringType syntax text, IsSql92ExpressionSyntax syntax) => QGenExpr context syntax s text -> QGenExpr context syntax s text Source #
SQL LOWER
function
upper_ :: (IsSqlExpressionSyntaxStringType syntax text, IsSql92ExpressionSyntax syntax) => QGenExpr context syntax s text -> QGenExpr context syntax s text Source #
SQL UPPER
function
trim_ :: (IsSqlExpressionSyntaxStringType syntax text, IsSql92ExpressionSyntax syntax) => QGenExpr context syntax s text -> QGenExpr context syntax s text Source #
SQL TRIM
function
IF-THEN-ELSE
support
if_ :: IsSql92ExpressionSyntax expr => [QIfCond context expr s a] -> QIfElse context expr s a -> QGenExpr context expr s a Source #
then_ :: QGenExpr context expr s Bool -> QGenExpr context expr s a -> QIfCond context expr s a Source #
then_' :: QGenExpr context expr s SqlBool -> QGenExpr context expr s a -> QIfCond context expr s a Source #
SQL UPDATE
assignments
(<-.) :: forall fieldName. (SqlUpdatable expr s lhs rhs, IsSql92FieldNameSyntax fieldName) => lhs -> rhs -> QAssignment fieldName expr s infix 4 Source #
current_ :: IsSql92ExpressionSyntax expr => QField s ty -> QExpr expr s ty Source #
Extract an expression representing the current (non-UPDATEd) value of a QField
Project Haskell values to QGenExpr
s
type family HaskellLiteralForQExpr x = a Source #
Instances
type HaskellLiteralForQExpr (table (QGenExpr context syntax s)) Source # | |
Defined in Database.Beam.Query.Combinators | |
type HaskellLiteralForQExpr (table (Nullable f)) Source # | |
Defined in Database.Beam.Query.Combinators | |
type HaskellLiteralForQExpr (QGenExpr context syntax s a) Source # | |
Defined in Database.Beam.Query.Combinators |
class SqlValable a where Source #
val_ :: HaskellLiteralForQExpr a -> a Source #
Instances
(Beamable table, IsSql92ExpressionSyntax syntax, FieldsFulfillConstraintNullable (HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax)) table) => SqlValable (table (Nullable (QGenExpr ctxt syntax s))) Source # | |
Defined in Database.Beam.Query.Combinators | |
(Beamable table, IsSql92ExpressionSyntax syntax, FieldsFulfillConstraint (HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax)) table) => SqlValable (table (QGenExpr ctxt syntax s)) Source # | |
Defined in Database.Beam.Query.Combinators | |
(HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) a, IsSql92ExpressionSyntax syntax) => SqlValable (QGenExpr ctxt syntax s a) Source # | |
Defined in Database.Beam.Query.Combinators |
type SqlValableTable table expr = (Beamable table, IsSql92ExpressionSyntax expr, FieldsFulfillConstraint (HasSqlValueSyntax (Sql92ExpressionValueSyntax expr)) table) Source #
default_ :: IsSql92ExpressionSyntax expr => QGenExpr ctxt expr s a Source #
General query combinators
all_ :: forall be (db :: (* -> *) -> *) table select s. (Database be db, IsSql92SelectSyntax select, IsSql92FromSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select)), IsSql92TableSourceSyntax (Sql92FromTableSourceSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select))), Sql92FromExpressionSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select)) ~ Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select), Table table) => DatabaseEntity be db (TableEntity table) -> Q select db s (table (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s)) Source #
Introduce all entries of a table into the Q
monad
allFromView_ :: forall be (db :: (* -> *) -> *) table select s. (Database be db, IsSql92SelectSyntax select, IsSql92FromSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select)), IsSql92TableSourceSyntax (Sql92FromTableSourceSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select))), Sql92FromExpressionSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select)) ~ Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select), Beamable table) => DatabaseEntity be db (ViewEntity table) -> Q select db s (table (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s)) Source #
Introduce all entries of a view into the Q
monad
join_ :: (Database be db, Table table, IsSql92SelectSyntax select, IsSql92FromSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select)), Sql92FromExpressionSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select)) ~ Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select), IsSql92TableSourceSyntax (Sql92FromTableSourceSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select)))) => DatabaseEntity be db (TableEntity table) -> (table (QExpr (Sql92SelectExpressionSyntax select) s) -> QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s Bool) -> Q select db s (table (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s)) Source #
join_' :: (Database be db, Table table, IsSql92SelectSyntax select, IsSql92FromSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select)), Sql92FromExpressionSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select)) ~ Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select), IsSql92TableSourceSyntax (Sql92FromTableSourceSyntax (Sql92SelectTableFromSyntax (Sql92SelectSelectTableSyntax select)))) => DatabaseEntity be db (TableEntity table) -> (table (QExpr (Sql92SelectExpressionSyntax select) s) -> QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s SqlBool) -> Q select db s (table (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s)) Source #
guard_ :: forall select db s. IsSql92SelectSyntax select => QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s Bool -> Q select db s () Source #
guard_' :: forall select db s. IsSql92SelectSyntax select => QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s SqlBool -> Q select db s () Source #
filter_ :: forall r select db s. IsSql92SelectSyntax select => (r -> QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s Bool) -> Q select db s r -> Q select db s r Source #
filter_' :: forall r select db s. IsSql92SelectSyntax select => (r -> QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s SqlBool) -> Q select db s r -> Q select db s r Source #
related_ :: forall be db rel select s. (IsSql92SelectSyntax select, HasTableEquality (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) (PrimaryKey rel), HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select))) Bool, Database be db, Table rel) => DatabaseEntity be db (TableEntity rel) -> PrimaryKey rel (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s) -> Q select db s (rel (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s)) Source #
Introduce all entries of the given table which are referenced by the given PrimaryKey
relatedBy_ :: forall be db rel select s. (Database be db, Table rel, HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select))) Bool, IsSql92SelectSyntax select) => DatabaseEntity be db (TableEntity rel) -> (rel (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s) -> QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s Bool) -> Q select db s (rel (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s)) Source #
Introduce all entries of the given table which for which the expression (which can depend on the queried table returns true)
relatedBy_' :: forall be db rel select s. (Database be db, Table rel, HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select))) Bool, IsSql92SelectSyntax select) => DatabaseEntity be db (TableEntity rel) -> (rel (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s) -> QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s SqlBool) -> Q select db s (rel (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s)) Source #
Introduce all entries of the given table which for which the expression (which can depend on the queried table returns true)
leftJoin_ :: forall s r select db. (Projectible (Sql92SelectExpressionSyntax select) r, IsSql92SelectSyntax select, ThreadRewritable (QNested s) r, Retaggable (QExpr (Sql92SelectExpressionSyntax select) s) (WithRewrittenThread (QNested s) s r)) => Q select db (QNested s) r -> (WithRewrittenThread (QNested s) s r -> QExpr (Sql92SelectExpressionSyntax select) s Bool) -> Q select db s (Retag Nullable (WithRewrittenThread (QNested s) s r)) Source #
Introduce a table using a left join. The ON clause is required here.Because this is not an inner join, the resulting table is made nullable. This means that each field that would normally have type 'QExpr x' will now have type 'QExpr (Maybe x)'.
The ON
condition given must return Bool
. For a version that
accepts an ON
condition returning SqlBool
, see leftJoin_'
.
leftJoin_' :: forall s r select db. (Projectible (Sql92SelectExpressionSyntax select) r, IsSql92SelectSyntax select, ThreadRewritable (QNested s) r, Retaggable (QExpr (Sql92SelectExpressionSyntax select) s) (WithRewrittenThread (QNested s) s r)) => Q select db (QNested s) r -> (WithRewrittenThread (QNested s) s r -> QExpr (Sql92SelectExpressionSyntax select) s SqlBool) -> Q select db s (Retag Nullable (WithRewrittenThread (QNested s) s r)) Source #
perhaps_ :: forall s r select db. (Projectible (Sql92SelectExpressionSyntax select) r, IsSql92SelectSyntax select, ThreadRewritable (QNested s) r, Retaggable (QExpr (Sql92SelectExpressionSyntax select) s) (WithRewrittenThread (QNested s) s r)) => Q select db (QNested s) r -> Q select db s (Retag Nullable (WithRewrittenThread (QNested s) s r)) Source #
Introduce a table using a left join with no ON clause. Because this is not an inner join, the resulting table is made nullable. This means that each field that would normally have type 'QExpr x' will now have type 'QExpr (Maybe x)'.
outerJoin_ :: forall s a b select db. (Projectible (Sql92SelectExpressionSyntax select) a, Projectible (Sql92SelectExpressionSyntax select) b, ThreadRewritable (QNested s) a, ThreadRewritable (QNested s) b, Retaggable (QExpr (Sql92SelectExpressionSyntax select) s) (WithRewrittenThread (QNested s) s a), Retaggable (QExpr (Sql92SelectExpressionSyntax select) s) (WithRewrittenThread (QNested s) s b), IsSql92FromOuterJoinSyntax (Sql92SelectFromSyntax select)) => Q select db (QNested s) a -> Q select db (QNested s) b -> ((WithRewrittenThread (QNested s) s a, WithRewrittenThread (QNested s) s b) -> QExpr (Sql92SelectExpressionSyntax select) s Bool) -> Q select db s (Retag Nullable (WithRewrittenThread (QNested s) s a), Retag Nullable (WithRewrittenThread (QNested s) s b)) Source #
Outer join. every row of each table, returning NULL
for any row
of either table for which the join condition finds no related rows.
This expects a join expression returning Bool
, for a version that
accepts a SqlBool
(a possibly UNKNOWN
boolean, that maps more
closely to the SQL standard), see outerJoin_'
outerJoin_' :: forall s a b select db. (Projectible (Sql92SelectExpressionSyntax select) a, Projectible (Sql92SelectExpressionSyntax select) b, ThreadRewritable (QNested s) a, ThreadRewritable (QNested s) b, Retaggable (QExpr (Sql92SelectExpressionSyntax select) s) (WithRewrittenThread (QNested s) s a), Retaggable (QExpr (Sql92SelectExpressionSyntax select) s) (WithRewrittenThread (QNested s) s b), IsSql92FromOuterJoinSyntax (Sql92SelectFromSyntax select)) => Q select db (QNested s) a -> Q select db (QNested s) b -> ((WithRewrittenThread (QNested s) s a, WithRewrittenThread (QNested s) s b) -> QExpr (Sql92SelectExpressionSyntax select) s SqlBool) -> Q select db s (Retag Nullable (WithRewrittenThread (QNested s) s a), Retag Nullable (WithRewrittenThread (QNested s) s b)) Source #
Like outerJoin_
, but accepting SqlBool
. Pairs of rows for
which the join condition is unknown are considered to be unrelated,
by SQL compliant databases at least.
subselect_ :: forall s r select db. (ThreadRewritable (QNested s) r, ProjectibleInSelectSyntax select r) => Q select db (QNested s) r -> Q select db s (WithRewrittenThread (QNested s) s r) Source #
references_ :: (IsSql92ExpressionSyntax expr, HasTableEquality expr (PrimaryKey t), HasSqlValueSyntax (Sql92ExpressionValueSyntax expr) Bool, Table t) => PrimaryKey t (QGenExpr ctxt expr s) -> t (QGenExpr ctxt expr s) -> QGenExpr ctxt expr s Bool Source #
Generate an appropriate boolean QGenExpr
comparing the given foreign key
to the given table. Useful for creating join conditions.
nub_ :: (IsSql92SelectSyntax select, Projectible (Sql92SelectExpressionSyntax select) r) => Q select db s r -> Q select db s r Source #
Only return distinct values from a query
class SqlJustable a b | b -> a where Source #
Type class for things that can be nullable. This includes 'QExpr (Maybe a)', 'tbl (Nullable QExpr)', and 'PrimaryKey tbl (Nullable QExpr)'
Given something of type 'QExpr a', 'tbl QExpr', or 'PrimaryKey tbl QExpr', turn it into a 'QExpr (Maybe a)', 'tbl (Nullable QExpr)', or 'PrimaryKey t (Nullable QExpr)' respectively that contains the same values.
Return either a 'QExpr (Maybe x)' representing Nothing
or a nullable Table
or
PrimaryKey
filled with Nothing
.
Instances
class IsSql92ExpressionSyntax syntax => SqlDeconstructMaybe syntax a nonNullA s | a s -> syntax, a -> nonNullA, a -> s, nonNullA -> s where Source #
Type class for anything which can be checked for null-ness. This includes 'QExpr (Maybe a)' as
well as Table
s or PrimaryKey
s over 'Nullable QExpr'.
isJust_ :: a -> QGenExpr ctxt syntax s Bool Source #
Returns a QExpr
that evaluates to true when the first argument is not null
isNothing_ :: a -> QGenExpr ctxt syntax s Bool Source #
Returns a QExpr
that evaluates to true when the first argument is null
maybe_ :: QGenExpr ctxt syntax s y -> (nonNullA -> QGenExpr ctxt syntax s y) -> a -> QGenExpr ctxt syntax s y Source #
Given an object (third argument) which may or may not be null, return the default value if null (first argument), or transform the value that could be null to yield the result of the expression (second argument)
Instances
(IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) Bool, Beamable t) => SqlDeconstructMaybe syntax (t (Nullable (QGenExpr ctxt syntax s))) (t (QGenExpr ctxt syntax s)) s Source # | |
Defined in Database.Beam.Query.Combinators isJust_ :: t (Nullable (QGenExpr ctxt syntax s)) -> QGenExpr ctxt0 syntax s Bool Source # isNothing_ :: t (Nullable (QGenExpr ctxt syntax s)) -> QGenExpr ctxt0 syntax s Bool Source # maybe_ :: QGenExpr ctxt0 syntax s y -> (t (QGenExpr ctxt syntax s) -> QGenExpr ctxt0 syntax s y) -> t (Nullable (QGenExpr ctxt syntax s)) -> QGenExpr ctxt0 syntax s y Source # | |
IsSql92ExpressionSyntax syntax => SqlDeconstructMaybe syntax (QGenExpr ctxt syntax s (Maybe x)) (QGenExpr ctxt syntax s x) s Source # | |
Defined in Database.Beam.Query.Combinators isJust_ :: QGenExpr ctxt syntax s (Maybe x) -> QGenExpr ctxt0 syntax s Bool Source # isNothing_ :: QGenExpr ctxt syntax s (Maybe x) -> QGenExpr ctxt0 syntax s Bool Source # maybe_ :: QGenExpr ctxt0 syntax s y -> (QGenExpr ctxt syntax s x -> QGenExpr ctxt0 syntax s y) -> QGenExpr ctxt syntax s (Maybe x) -> QGenExpr ctxt0 syntax s y Source # |
class SqlOrderable syntax a | a -> syntax Source #
makeSQLOrdering
Instances
limit_ :: forall s a select db. (ProjectibleInSelectSyntax select a, ThreadRewritable (QNested s) a) => Integer -> Q select db (QNested s) a -> Q select db s (WithRewrittenThread (QNested s) s a) Source #
Limit the number of results returned by a query.
offset_ :: forall s a select db. (ProjectibleInSelectSyntax select a, ThreadRewritable (QNested s) a) => Integer -> Q select db (QNested s) a -> Q select db s (WithRewrittenThread (QNested s) s a) Source #
Drop the first offset'
results.
as_ :: forall a ctxt syntax s. QGenExpr ctxt syntax s a -> QGenExpr ctxt syntax s a Source #
Convenience function that allows you to use type applications to specify
the result of a QGenExpr
.
Useful to disambiguate the types of QGenExpr
s without having to provide a
complete type signature. As an example, the countAll_
aggregate can
return a result of any Integral
type. Without further constraints, the
type is ambiguous. You can use as_
to disambiguate the return type.
For example, this is ambiguous
aggregate_ (\_ -> countAll_) ..
But this is not
aggregate_ (\_ -> as_ @Int countAll_) ..
Subqueries
exists_ :: (IsSql92SelectSyntax select, HasQBuilder select, ProjectibleInSelectSyntax select a, Sql92ExpressionSelectSyntax (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) ~ select) => Q select db s a -> QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s Bool Source #
Use the SQL EXISTS
operator to determine if the given query returns any results
unique_ :: (IsSql92SelectSyntax select, HasQBuilder select, ProjectibleInSelectSyntax select a, Sql92ExpressionSelectSyntax (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) ~ select) => Q select db s a -> QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s Bool Source #
Use the SQL UNIQUE
operator to determine if the given query produces a unique result
distinct_ :: (IsSql99ExpressionSyntax (Sql92SelectExpressionSyntax select), HasQBuilder select, ProjectibleInSelectSyntax select a, Sql92ExpressionSelectSyntax (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) ~ select) => Q select db s a -> QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s Bool Source #
Use the SQL99 DISTINCT
operator to determine if the given query produces a distinct result
subquery_ :: (IsSql92SelectSyntax select, HasQBuilder select, ProjectibleInSelectSyntax select (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s a), Sql92ExpressionSelectSyntax (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) ~ select) => Q select (db :: (* -> *) -> *) s (QExpr (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s a) -> QGenExpr ctxt (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) s a Source #
Project the (presumably) singular result of the given query as an expression
Set operations
Q
values can be combined using a variety of set operations. See the
manual section.
union_ :: forall select db s a. (IsSql92SelectSyntax select, Projectible (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) a, ProjectibleInSelectSyntax select a, ThreadRewritable (QNested s) a) => Q select db (QNested s) a -> Q select db (QNested s) a -> Q select db s (WithRewrittenThread (QNested s) s a) Source #
SQL UNION
operator
unionAll_ :: forall select db s a. (IsSql92SelectSyntax select, Projectible (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) a, ProjectibleInSelectSyntax select a, ThreadRewritable (QNested s) a) => Q select db (QNested s) a -> Q select db (QNested s) a -> Q select db s (WithRewrittenThread (QNested s) s a) Source #
SQL UNION ALL
operator
intersect_ :: forall select db s a. (IsSql92SelectSyntax select, Projectible (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) a, ProjectibleInSelectSyntax select a, ThreadRewritable (QNested s) a) => Q select db (QNested s) a -> Q select db (QNested s) a -> Q select db s (WithRewrittenThread (QNested s) s a) Source #
SQL INTERSECT
operator
intersectAll_ :: forall select db s a. (IsSql92SelectSyntax select, Projectible (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) a, ProjectibleInSelectSyntax select a, ThreadRewritable (QNested s) a) => Q select db (QNested s) a -> Q select db (QNested s) a -> Q select db s (WithRewrittenThread (QNested s) s a) Source #
SQL INTERSECT ALL
operator
except_ :: forall select db s a. (IsSql92SelectSyntax select, Projectible (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) a, ProjectibleInSelectSyntax select a, ThreadRewritable (QNested s) a) => Q select db (QNested s) a -> Q select db (QNested s) a -> Q select db s (WithRewrittenThread (QNested s) s a) Source #
SQL EXCEPT
operator
exceptAll_ :: forall select db s a. (IsSql92SelectSyntax select, Projectible (Sql92SelectTableExpressionSyntax (Sql92SelectSelectTableSyntax select)) a, ProjectibleInSelectSyntax select a, ThreadRewritable (QNested s) a) => Q select db (QNested s) a -> Q select db (QNested s) a -> Q select db s (WithRewrittenThread (QNested s) s a) Source #
SQL EXCEPT ALL
operator
Window functions
See the corresponding manual section for more.
over_ :: IsSql2003ExpressionSyntax syntax => QAgg syntax s a -> QWindow (Sql2003ExpressionWindowFrameSyntax syntax) s -> QWindowExpr syntax s a Source #
Produce a window expression given an aggregate function and a window.
:: (IsSql2003ExpressionSyntax syntax, SqlOrderable (Sql2003WindowFrameOrderingSyntax (Sql2003ExpressionWindowFrameSyntax syntax)) ordering, Projectible syntax partition, Sql2003ExpressionSanityCheck syntax) | |
=> Maybe partition | PARTITION BY |
-> Maybe ordering | ORDER BY |
-> QFrameBounds (Sql2003WindowFrameBoundsSyntax (Sql2003ExpressionWindowFrameSyntax syntax)) | RANGE / ROWS |
-> QWindow (Sql2003ExpressionWindowFrameSyntax syntax) s |
Specify a window frame with all the options
bounds_ :: IsSql2003WindowFrameBoundsSyntax syntax => QFrameBound (Sql2003WindowFrameBoundsBoundSyntax syntax) -> Maybe (QFrameBound (Sql2003WindowFrameBoundsBoundSyntax syntax)) -> QFrameBounds syntax Source #
unbounded_ :: IsSql2003WindowFrameBoundSyntax syntax => QFrameBound syntax Source #
nrows_ :: IsSql2003WindowFrameBoundSyntax syntax => Int -> QFrameBound syntax Source #
fromBound_ :: IsSql2003WindowFrameBoundsSyntax syntax => QFrameBound (Sql2003WindowFrameBoundsBoundSyntax syntax) -> QFrameBounds syntax Source #
noBounds_ :: QFrameBounds syntax Source #
partitionBy_ :: partition -> Maybe partition Source #
orderPartitionBy_ :: partition -> Maybe partition Source #
:: (ProjectibleWithPredicate WindowFrameContext (Sql2003ExpressionWindowFrameSyntax (Sql92SelectExpressionSyntax select)) window, Projectible (Sql92SelectExpressionSyntax select) r, Projectible (Sql92SelectExpressionSyntax select) a, ContextRewritable a, ThreadRewritable (QNested s) (WithRewrittenContext a QValueContext), IsSql92SelectSyntax select) | |
=> (r -> window) | Window builder function |
-> (r -> window -> a) | Projection builder function. Has access to the windows generated above |
-> Q select db (QNested s) r | Query to window over |
-> Q select db s (WithRewrittenThread (QNested s) s (WithRewrittenContext a QValueContext)) |
Compute a query over windows.
The first function builds window frames using the frame_
, partitionBy_
,
etc functions. The return type can be a single frame, tuples of frame, or
any arbitrarily nested tuple of the above. Instances up to 8-tuples are
provided.
The second function builds the resulting projection using the result of the
subquery as well as the window frames built in the first function. In this
function, window expressions can be included in the output using the
over_
function.
Ordering primitives
orderBy_ :: forall s a ordering syntax db. (Projectible (Sql92SelectExpressionSyntax syntax) a, SqlOrderable (Sql92SelectOrderingSyntax syntax) ordering, ThreadRewritable (QNested s) a) => (a -> ordering) -> Q syntax db (QNested s) a -> Q syntax db s (WithRewrittenThread (QNested s) s a) Source #
Order by the given expressions. The return type of the ordering key should
either be the result of asc_
or desc_
(or another ordering QOrd
generated by a backend-specific ordering) or an (possibly nested) tuple of
results of the former.
The manual section has more information.
asc_ :: forall syntax s a. IsSql92OrderingSyntax syntax => QExpr (Sql92OrderingExpressionSyntax syntax) s a -> QOrd syntax s a Source #
Produce a QOrd
corresponding to a SQL ASC
ordering
desc_ :: forall syntax s a. IsSql92OrderingSyntax syntax => QExpr (Sql92OrderingExpressionSyntax syntax) s a -> QOrd syntax s a Source #
Produce a QOrd
corresponding to a SQL DESC
ordering
nullsFirst_ :: IsSql2003OrderingElementaryOLAPOperationsSyntax syntax => QOrd syntax s a -> QOrd syntax s a Source #
nullsLast_ :: IsSql2003OrderingElementaryOLAPOperationsSyntax syntax => QOrd syntax s a -> QOrd syntax s a Source #
Various combinators corresponding to SQL extensions
T614 NTILE function
ntile_ :: (Integral a, IsSql2003NtileExpressionSyntax syntax) => QExpr syntax s Int -> QAgg syntax s a Source #
T615 LEAD and LAG function
lead1_ :: IsSql2003LeadAndLagExpressionSyntax syntax => QExpr syntax s a -> QAgg syntax s a Source #
lead_ :: IsSql2003LeadAndLagExpressionSyntax syntax => QExpr syntax s a -> QExpr syntax s Int -> QAgg syntax s a Source #
lag_ :: IsSql2003LeadAndLagExpressionSyntax syntax => QExpr syntax s a -> QExpr syntax s Int -> QAgg syntax s a Source #
leadWithDefault_ :: IsSql2003LeadAndLagExpressionSyntax syntax => QExpr syntax s a -> QExpr syntax s Int -> QExpr syntax s a -> QAgg syntax s a Source #
lagWithDefault_ :: IsSql2003LeadAndLagExpressionSyntax syntax => QExpr syntax s a -> QExpr syntax s Int -> QExpr syntax s a -> QAgg syntax s a Source #
T616 FIRST_VALUE and LAST_VALUE functions
firstValue_ :: IsSql2003FirstValueAndLastValueExpressionSyntax syntax => QExpr syntax s a -> QAgg syntax s a Source #
lastValue_ :: IsSql2003FirstValueAndLastValueExpressionSyntax syntax => QExpr syntax s a -> QAgg syntax s a Source #
T618 NTH_VALUE function
nthValue_ :: IsSql2003NthValueExpressionSyntax syntax => QExpr syntax s a -> QExpr syntax s Int -> QAgg syntax s a Source #
T621 Enhanced numeric functions
(**.) :: (Floating a, IsSql2003EnhancedNumericFunctionsExpressionSyntax syntax) => QGenExpr ctxt syntax s a -> QGenExpr ctxt syntax s a -> QGenExpr ctxt syntax s a infixr 8 Source #
ln_ :: (Floating a, IsSql2003EnhancedNumericFunctionsExpressionSyntax syntax) => QGenExpr ctxt syntax s a -> QGenExpr ctxt syntax s a Source #
exp_ :: (Floating a, IsSql2003EnhancedNumericFunctionsExpressionSyntax syntax) => QGenExpr ctxt syntax s a -> QGenExpr ctxt syntax s a Source #
sqrt_ :: (Floating a, IsSql2003EnhancedNumericFunctionsExpressionSyntax syntax) => QGenExpr ctxt syntax s a -> QGenExpr ctxt syntax s a Source #
ceiling_ :: (RealFrac a, Integral b, IsSql2003EnhancedNumericFunctionsExpressionSyntax syntax) => QGenExpr ctxt syntax s a -> QGenExpr ctxt syntax s b Source #
floor_ :: (RealFrac a, Integral b, IsSql2003EnhancedNumericFunctionsExpressionSyntax syntax) => QGenExpr ctxt syntax s a -> QGenExpr ctxt syntax s b Source #
stddevPopOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QAgg syntax s b Source #
stddevSampOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QAgg syntax s b Source #
varPopOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QAgg syntax s b Source #
varSampOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QAgg syntax s b Source #
stddevPop_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QAgg syntax s b Source #
stddevSamp_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QAgg syntax s b Source #
varPop_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QAgg syntax s b Source #
varSamp_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QAgg syntax s b Source #
covarPopOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
covarSampOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
corrOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
regrSlopeOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
regrInterceptOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
regrCountOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
regrRSquaredOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
regrAvgXOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
regrAvgYOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
regrSXXOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
regrSYYOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
regrSXYOver_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => Maybe (Sql92AggregationSetQuantifierSyntax syntax) -> QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
covarPop_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
covarSamp_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
corr_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
regrSlope_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
regrIntercept_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
regrCount_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
regrRSquared_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
regrAvgX_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
regrAvgY_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
regrSXX_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
regrSYY_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
regrSXY_ :: (Num a, Floating b, IsSql2003EnhancedNumericFunctionsAggregationExpressionSyntax syntax) => QExpr syntax s a -> QExpr syntax s a -> QExpr syntax s b Source #
Relationships
Many-to-many relationships
type ManyToMany db left right = forall syntax s. (Sql92SelectSanityCheck syntax, IsSql92SelectSyntax syntax, SqlEq (QExpr (Sql92SelectExpressionSyntax syntax) s) (PrimaryKey left (QExpr (Sql92SelectExpressionSyntax syntax) s)), SqlEq (QExpr (Sql92SelectExpressionSyntax syntax) s) (PrimaryKey right (QExpr (Sql92SelectExpressionSyntax syntax) s))) => Q syntax db s (left (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> Q syntax db s (right (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> Q syntax db s (left (QExpr (Sql92SelectExpressionSyntax syntax) s), right (QExpr (Sql92SelectExpressionSyntax syntax) s)) Source #
Convenience type to declare many-to-many relationships. See the manual section on relationships for more information
type ManyToManyThrough db through left right = forall syntax s. (Sql92SelectSanityCheck syntax, IsSql92SelectSyntax syntax, SqlEq (QExpr (Sql92SelectExpressionSyntax syntax) s) (PrimaryKey left (QExpr (Sql92SelectExpressionSyntax syntax) s)), SqlEq (QExpr (Sql92SelectExpressionSyntax syntax) s) (PrimaryKey right (QExpr (Sql92SelectExpressionSyntax syntax) s))) => Q syntax db s (left (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> Q syntax db s (right (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> Q syntax db s (through (QExpr (Sql92SelectExpressionSyntax syntax) s), left (QExpr (Sql92SelectExpressionSyntax syntax) s), right (QExpr (Sql92SelectExpressionSyntax syntax) s)) Source #
Convenience type to declare many-to-many relationships with additional data. See the manual section on relationships for more information
manyToMany_ :: (Database be db, Table joinThrough, Table left, Table right, Sql92SelectSanityCheck syntax, IsSql92SelectSyntax syntax, SqlEq (QExpr (Sql92SelectExpressionSyntax syntax) s) (PrimaryKey left (QExpr (Sql92SelectExpressionSyntax syntax) s)), SqlEq (QExpr (Sql92SelectExpressionSyntax syntax) s) (PrimaryKey right (QExpr (Sql92SelectExpressionSyntax syntax) s))) => DatabaseEntity be db (TableEntity joinThrough) -> (joinThrough (QExpr (Sql92SelectExpressionSyntax syntax) s) -> PrimaryKey left (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> (joinThrough (QExpr (Sql92SelectExpressionSyntax syntax) s) -> PrimaryKey right (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> Q syntax db s (left (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> Q syntax db s (right (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> Q syntax db s (left (QExpr (Sql92SelectExpressionSyntax syntax) s), right (QExpr (Sql92SelectExpressionSyntax syntax) s)) Source #
Used to define many-to-many relationships without any additional data.
Takes the join table and two key extraction functions from that table to the
related tables. Also takes two Q
s representing the table sources to relate.
See the manual for more indformation.
manyToManyPassthrough_ :: (Database be db, Table joinThrough, Table left, Table right, Sql92SelectSanityCheck syntax, IsSql92SelectSyntax syntax, SqlEq (QExpr (Sql92SelectExpressionSyntax syntax) s) (PrimaryKey left (QExpr (Sql92SelectExpressionSyntax syntax) s)), SqlEq (QExpr (Sql92SelectExpressionSyntax syntax) s) (PrimaryKey right (QExpr (Sql92SelectExpressionSyntax syntax) s))) => DatabaseEntity be db (TableEntity joinThrough) -> (joinThrough (QExpr (Sql92SelectExpressionSyntax syntax) s) -> PrimaryKey left (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> (joinThrough (QExpr (Sql92SelectExpressionSyntax syntax) s) -> PrimaryKey right (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> Q syntax db s (left (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> Q syntax db s (right (QExpr (Sql92SelectExpressionSyntax syntax) s)) -> Q syntax db s (joinThrough (QExpr (Sql92SelectExpressionSyntax syntax) s), left (QExpr (Sql92SelectExpressionSyntax syntax) s), right (QExpr (Sql92SelectExpressionSyntax syntax) s)) Source #
Used to define many-to-many relationships with additional data. Takes the
join table and two key extraction functions from that table to the related
tables. Also takes two Q
s representing the table sources to relate.
See the manual for more indformation.
One-to-many relationships
type OneToMany db s one many = forall syntax. (IsSql92SelectSyntax syntax, HasTableEquality (Sql92SelectExpressionSyntax syntax) (PrimaryKey one), HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectExpressionSyntax syntax)) Bool) => one (QExpr (Sql92SelectExpressionSyntax syntax) s) -> Q syntax db s (many (QExpr (Sql92SelectExpressionSyntax syntax) s)) Source #
Convenience type to declare one-to-many relationships. See the manual section on relationships for more information
type OneToManyOptional db s tbl rel = forall syntax. (IsSql92SelectSyntax syntax, HasTableEqualityNullable (Sql92SelectExpressionSyntax syntax) (PrimaryKey tbl), HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectExpressionSyntax syntax)) Bool, HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectExpressionSyntax syntax)) SqlNull) => tbl (QExpr (Sql92SelectExpressionSyntax syntax) s) -> Q syntax db s (rel (Nullable (QExpr (Sql92SelectExpressionSyntax syntax) s))) Source #
Convenience type to declare one-to-many relationships with a nullable foreign key. See the manual section on relationships for more information
:: (IsSql92SelectSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectExpressionSyntax syntax)) Bool, Database be db, HasTableEquality (Sql92SelectExpressionSyntax syntax) (PrimaryKey tbl), Table tbl, Table rel) | |
=> DatabaseEntity be db (TableEntity rel) | Table to fetch (many) |
-> (rel (QExpr (Sql92SelectExpressionSyntax syntax) s) -> PrimaryKey tbl (QExpr (Sql92SelectExpressionSyntax syntax) s)) | Foreign key |
-> tbl (QExpr (Sql92SelectExpressionSyntax syntax) s) | |
-> Q syntax db s (rel (QExpr (Sql92SelectExpressionSyntax syntax) s)) |
Used to define one-to-many (or one-to-one) relationships. Takes the table to fetch, a way to extract the foreign key from that table, and the table to relate to.
:: (IsSql92SelectSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectExpressionSyntax syntax)) Bool, HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectExpressionSyntax syntax)) SqlNull, HasTableEqualityNullable (Sql92SelectExpressionSyntax syntax) (PrimaryKey tbl), Database be db, Table tbl, Table rel) | |
=> DatabaseEntity be db (TableEntity rel) | Table to fetch |
-> (rel (QExpr (Sql92SelectExpressionSyntax syntax) s) -> PrimaryKey tbl (Nullable (QExpr (Sql92SelectExpressionSyntax syntax) s))) | Foreign key |
-> tbl (QExpr (Sql92SelectExpressionSyntax syntax) s) | |
-> Q syntax db s (rel (Nullable (QExpr (Sql92SelectExpressionSyntax syntax) s))) |
Used to define one-to-many (or one-to-one) relationships with a nullable foreign key. Takes the table to fetch, a way to extract the foreign key from that table, and the table to relate to.
One-to-one relationshships
type OneToOne db s one many = OneToMany db s one many Source #
Synonym of OneToMany
. Useful for giving more meaningful types, when the
relationship is meant to be one-to-one.
type OneToMaybe db s tbl rel = OneToManyOptional db s tbl rel Source #
Synonym of OneToManyOptional
. Useful for giving more meaningful types,
when the relationship is meant to be one-to-one.
:: (IsSql92SelectSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectExpressionSyntax syntax)) Bool, Database be db, HasTableEquality (Sql92SelectExpressionSyntax syntax) (PrimaryKey tbl), Table tbl, Table rel) | |
=> DatabaseEntity be db (TableEntity rel) | Table to fetch (many) |
-> (rel (QExpr (Sql92SelectExpressionSyntax syntax) s) -> PrimaryKey tbl (QExpr (Sql92SelectExpressionSyntax syntax) s)) | Foreign key |
-> tbl (QExpr (Sql92SelectExpressionSyntax syntax) s) | |
-> Q syntax db s (rel (QExpr (Sql92SelectExpressionSyntax syntax) s)) |
Used to define one-to-many (or one-to-one) relationships. Takes the table to fetch, a way to extract the foreign key from that table, and the table to relate to.
:: (IsSql92SelectSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectExpressionSyntax syntax)) Bool, HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectExpressionSyntax syntax)) SqlNull, HasTableEqualityNullable (Sql92SelectExpressionSyntax syntax) (PrimaryKey tbl), Database be db, Table tbl, Table rel) | |
=> DatabaseEntity be db (TableEntity rel) | Table to fetch |
-> (rel (QExpr (Sql92SelectExpressionSyntax syntax) s) -> PrimaryKey tbl (Nullable (QExpr (Sql92SelectExpressionSyntax syntax) s))) | Foreign key |
-> tbl (QExpr (Sql92SelectExpressionSyntax syntax) s) | |
-> Q syntax db s (rel (Nullable (QExpr (Sql92SelectExpressionSyntax syntax) s))) |
Used to define one-to-many (or one-to-one) relationships with a nullable foreign key. Takes the table to fetch, a way to extract the foreign key from that table, and the table to relate to.
Operators
(&&.) :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s Bool -> QGenExpr context syntax s Bool -> QGenExpr context syntax s Bool infixr 3 Source #
SQL AND
operator
(||.) :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s Bool -> QGenExpr context syntax s Bool -> QGenExpr context syntax s Bool infixr 2 Source #
SQL OR
operator
(&&?.) :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s SqlBool -> QGenExpr context syntax s SqlBool -> QGenExpr context syntax s SqlBool infixr 3 Source #
SQL AND
operator for SqlBool
(||?.) :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s SqlBool -> QGenExpr context syntax s SqlBool -> QGenExpr context syntax s SqlBool infixr 2 Source #
SQL OR
operator
like_ :: (IsSqlExpressionSyntaxStringType syntax text, IsSql92ExpressionSyntax syntax) => QExpr syntax s text -> QExpr syntax s text -> QExpr syntax s Bool infix 4 Source #
SQL LIKE
operator
similarTo_ :: (IsSqlExpressionSyntaxStringType syntax text, IsSql99ExpressionSyntax syntax) => QExpr syntax s text -> QExpr syntax s text -> QExpr syntax s text infix 4 Source #
SQL99 SIMILAR TO
operator
not_ :: forall syntax context s. IsSql92ExpressionSyntax syntax => QGenExpr context syntax s Bool -> QGenExpr context syntax s Bool Source #
SQL NOT
operator
sqlNot_ :: forall syntax context s. IsSql92ExpressionSyntax syntax => QGenExpr context syntax s SqlBool -> QGenExpr context syntax s SqlBool Source #
SQL NOT
operator, but operating on SqlBool
instead
div_ :: (Integral a, IsSql92ExpressionSyntax syntax) => QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s a infixl 7 Source #
SQL /
operator
mod_ :: (Integral a, IsSql92ExpressionSyntax syntax) => QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s a infixl 7 Source #
SQL %
operator
concat_ :: IsSql99ConcatExpressionSyntax syntax => [QGenExpr context syntax s Text] -> QGenExpr context syntax s Text Source #
SQL CONCAT
function
ANSI SQL Booleans
Phantom type representing a SQL Tri-state boolean -- true, false, and unknown
This type has no values because it cannot be sent to or retrieved
from the database directly. Use isTrue_
, isFalse_
,
isNotTrue_
, isNotFalse_
, isUnknown_
, isNotUnknown_
, and
unknownAs_
to retrieve the corresponding Bool
value.
isTrue_ :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s SqlBool -> QGenExpr context syntax s Bool Source #
SQL IS TRUE
operator
isNotTrue_ :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s SqlBool -> QGenExpr context syntax s Bool Source #
SQL IS NOT TRUE
operator
isFalse_ :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s SqlBool -> QGenExpr context syntax s Bool Source #
SQL IS FALSE
operator
isNotFalse_ :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s SqlBool -> QGenExpr context syntax s Bool Source #
SQL IS NOT FALSE
operator
isUnknown_ :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s SqlBool -> QGenExpr context syntax s Bool Source #
SQL IS UNKNOWN
operator
isNotUnknown_ :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s SqlBool -> QGenExpr context syntax s Bool Source #
SQL IS NOT UNKNOWN
operator
unknownAs_ :: IsSql92ExpressionSyntax syntax => Bool -> QGenExpr context syntax s SqlBool -> QGenExpr context syntax s Bool Source #
Return the first argument if the expression has the unknown SQL value
See sqlBool_
for the inverse
sqlBool_ :: QGenExpr context syntax s Bool -> QGenExpr context syntax s SqlBool Source #
Convert a known not null bool to a SqlBool
. See unknownAs_
for the inverse
Unquantified comparison operators
class (IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) Bool) => HasSqlEqualityCheck syntax a where Source #
Class for Haskell types that can be compared for equality in the given expression syntax
sqlEqE :: Proxy a -> syntax -> syntax -> syntax Source #
sqlNeqE :: Proxy a -> syntax -> syntax -> syntax Source #
sqlEqTriE :: Proxy a -> syntax -> syntax -> syntax Source #
Tri-state equality
sqlNeqTriE :: Proxy a -> syntax -> syntax -> syntax Source #
Tri-state equality
Instances
class HasSqlEqualityCheck syntax a => HasSqlQuantifiedEqualityCheck syntax a where Source #
Class for Haskell types that can be compared for quantified equality in the given expression syntax
sqlQEqE :: Proxy a -> Maybe (Sql92ExpressionQuantifierSyntax syntax) -> syntax -> syntax -> syntax Source #
sqlQNeqE :: Proxy a -> Maybe (Sql92ExpressionQuantifierSyntax syntax) -> syntax -> syntax -> syntax Source #
Instances
class SqlEq expr a | a -> expr where Source #
Class for expression types or expression containers for which there is a notion of equality.
Instances are provided to check the equality of expressions of the same
type as well as entire Beamable
types parameterized over QGenExpr
(==.) :: a -> a -> expr Bool infix 4 Source #
Given two expressions, returns whether they are equal, using Haskell semantics (NULLs handled properly)
(/=.) :: a -> a -> expr Bool infix 4 Source #
Given two expressions, returns whether they are not equal, using Haskell semantics (NULLs handled properly)
(==?.) :: a -> a -> expr SqlBool Source #
Given two expressions, returns the SQL tri-state boolean when compared for equality
(/=?.) :: a -> a -> expr SqlBool Source #
Given two expressions, returns the SQL tri-state boolean when compared for inequality
Instances
(IsSql92ExpressionSyntax syntax, FieldsFulfillConstraintNullable (HasSqlEqualityCheck syntax) tbl, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) Bool, Beamable tbl) => SqlEq (QGenExpr context syntax s) (tbl (Nullable (QGenExpr context syntax s))) Source # | |
Defined in Database.Beam.Query.Ord (==.) :: tbl (Nullable (QGenExpr context syntax s)) -> tbl (Nullable (QGenExpr context syntax s)) -> QGenExpr context syntax s Bool Source # (/=.) :: tbl (Nullable (QGenExpr context syntax s)) -> tbl (Nullable (QGenExpr context syntax s)) -> QGenExpr context syntax s Bool Source # (==?.) :: tbl (Nullable (QGenExpr context syntax s)) -> tbl (Nullable (QGenExpr context syntax s)) -> QGenExpr context syntax s SqlBool Source # (/=?.) :: tbl (Nullable (QGenExpr context syntax s)) -> tbl (Nullable (QGenExpr context syntax s)) -> QGenExpr context syntax s SqlBool Source # | |
(IsSql92ExpressionSyntax syntax, FieldsFulfillConstraint (HasSqlEqualityCheck syntax) tbl, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) Bool, Beamable tbl) => SqlEq (QGenExpr context syntax s) (tbl (QGenExpr context syntax s)) Source # | Compare two arbitrary |
Defined in Database.Beam.Query.Ord (==.) :: tbl (QGenExpr context syntax s) -> tbl (QGenExpr context syntax s) -> QGenExpr context syntax s Bool Source # (/=.) :: tbl (QGenExpr context syntax s) -> tbl (QGenExpr context syntax s) -> QGenExpr context syntax s Bool Source # (==?.) :: tbl (QGenExpr context syntax s) -> tbl (QGenExpr context syntax s) -> QGenExpr context syntax s SqlBool Source # (/=?.) :: tbl (QGenExpr context syntax s) -> tbl (QGenExpr context syntax s) -> QGenExpr context syntax s SqlBool Source # | |
(IsSql92ExpressionSyntax syntax, HasSqlEqualityCheck syntax a) => SqlEq (QGenExpr context syntax s) (QGenExpr context syntax s a) Source # | Compare two arbitrary expressions (of the same type) for equality |
Defined in Database.Beam.Query.Ord (==.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s Bool Source # (/=.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s Bool Source # (==?.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s SqlBool Source # (/=?.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s SqlBool Source # |
class SqlOrd expr e | e -> expr where Source #
Class for expression types or expression containers for which there is a notion of ordering.
Instances are provided to check the ordering of expressions of the same
type. Since there is no universal notion of ordering for an arbitrary
number of expressions, no instance is provided for Beamable
types.
(<.) :: e -> e -> expr Bool infix 4 Source #
(>.) :: e -> e -> expr Bool infix 4 Source #
Instances
IsSql92ExpressionSyntax syntax => SqlOrd (QGenExpr context syntax s) (QGenExpr context syntax s a) Source # | |
Defined in Database.Beam.Query.Ord (<.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s Bool Source # (>.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s Bool Source # (<=.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s Bool Source # (>=.) :: QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s Bool Source # |
Quantified Comparison Operators
class SqlEq expr a => SqlEqQuantified expr quantified a | a -> expr quantified where Source #
Class for expression types for which there is a notion of quantified equality.
(==*.) :: a -> quantified -> expr SqlBool infix 4 Source #
Quantified equality and inequality using SQL semantics (tri-state boolean)
(/=*.) :: a -> quantified -> expr SqlBool infix 4 Source #
Quantified equality and inequality using SQL semantics (tri-state boolean)
Instances
(IsSql92ExpressionSyntax syntax, HasSqlQuantifiedEqualityCheck syntax a) => SqlEqQuantified (QGenExpr context syntax s) (QQuantified syntax s a) (QGenExpr context syntax s a) Source # | Two arbitrary expressions can be quantifiably compared for equality. |
Defined in Database.Beam.Query.Ord |
class SqlOrd expr e => SqlOrdQuantified expr quantified e | e -> expr quantified where Source #
Class for things which can be quantifiably compared.
(<*.) :: e -> quantified -> expr Bool infix 4 Source #
(>*.) :: e -> quantified -> expr Bool infix 4 Source #
Instances
IsSql92ExpressionSyntax syntax => SqlOrdQuantified (QGenExpr context syntax s) (QQuantified syntax s a) (QGenExpr context syntax s a) Source # | |
Defined in Database.Beam.Query.Ord (<*.) :: QGenExpr context syntax s a -> QQuantified syntax s a -> QGenExpr context syntax s Bool Source # (>*.) :: QGenExpr context syntax s a -> QQuantified syntax s a -> QGenExpr context syntax s Bool Source # (<=*.) :: QGenExpr context syntax s a -> QQuantified syntax s a -> QGenExpr context syntax s Bool Source # (>=*.) :: QGenExpr context syntax s a -> QQuantified syntax s a -> QGenExpr context syntax s Bool Source # |
data QQuantified expr s r Source #
A data structure representing the set to quantify a comparison operator over.
Instances
IsSql92ExpressionSyntax syntax => SqlOrdQuantified (QGenExpr context syntax s) (QQuantified syntax s a) (QGenExpr context syntax s a) Source # | |
Defined in Database.Beam.Query.Ord (<*.) :: QGenExpr context syntax s a -> QQuantified syntax s a -> QGenExpr context syntax s Bool Source # (>*.) :: QGenExpr context syntax s a -> QQuantified syntax s a -> QGenExpr context syntax s Bool Source # (<=*.) :: QGenExpr context syntax s a -> QQuantified syntax s a -> QGenExpr context syntax s Bool Source # (>=*.) :: QGenExpr context syntax s a -> QQuantified syntax s a -> QGenExpr context syntax s Bool Source # | |
(IsSql92ExpressionSyntax syntax, HasSqlQuantifiedEqualityCheck syntax a) => SqlEqQuantified (QGenExpr context syntax s) (QQuantified syntax s a) (QGenExpr context syntax s a) Source # | Two arbitrary expressions can be quantifiably compared for equality. |
Defined in Database.Beam.Query.Ord |
anyOf_ :: forall s a select expr db. (IsSql92SelectSyntax select, IsSql92ExpressionSyntax expr, HasQBuilder select, Sql92ExpressionSelectSyntax expr ~ select) => Q select db (QNested s) (QExpr (Sql92SelectExpressionSyntax select) (QNested s) a) -> QQuantified expr s a Source #
A QQuantified
representing a SQL ANY(..)
for use with a
quantified comparison operator
Accepts a subquery. Use anyIn_
for an explicit list
allOf_ :: forall s a select expr db. (IsSql92SelectSyntax select, IsSql92ExpressionSyntax expr, HasQBuilder select, Sql92ExpressionSelectSyntax expr ~ select) => Q select db (QNested s) (QExpr (Sql92SelectExpressionSyntax select) (QNested s) a) -> QQuantified expr s a Source #
A QQuantified
representing a SQL ALL(..)
for use with a
quantified comparison operator
Accepts a subquery. Use allIn_
for an explicit list
anyIn_ :: forall s a expr. IsSql92ExpressionSyntax expr => [QExpr expr s a] -> QQuantified expr s a Source #
A QQuantified
representing a SQL ANY(..)
for use with a
quantified comparison operator
Accepts an explicit list of typed expressions. Use anyOf_
for
a subquery
allIn_ :: forall s a expr. IsSql92ExpressionSyntax expr => [QExpr expr s a] -> QQuantified expr s a Source #
A QQuantified
representing a SQL ALL(..)
for use with a
quantified comparison operator
Accepts an explicit list of typed expressions. Use allOf_
for
a subquery
between_ :: IsSql92ExpressionSyntax syntax => QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s a -> QGenExpr context syntax s Bool infix 4 Source #
SQL BETWEEN
clause
in_ :: (IsSql92ExpressionSyntax syntax, HasSqlValueSyntax (Sql92ExpressionValueSyntax syntax) Bool) => QGenExpr context syntax s a -> [QGenExpr context syntax s a] -> QGenExpr context syntax s Bool infix 4 Source #
SQL IN
predicate
Aggregates
See the corresponding manual section for more detail
:: (ProjectibleWithPredicate AggregateContext (Sql92SelectExpressionSyntax select) a, Projectible (Sql92SelectExpressionSyntax select) r, Projectible (Sql92SelectExpressionSyntax select) a, ContextRewritable a, ThreadRewritable (QNested s) (WithRewrittenContext a QValueContext), IsSql92SelectSyntax select) | |
=> (r -> a) | Aggregate projection |
-> Q select db (QNested s) r | Query to aggregate over |
-> Q select db s (WithRewrittenThread (QNested s) s (WithRewrittenContext a QValueContext)) |
Compute an aggregate over a query.
The supplied aggregate projection should return an aggregate expression (an
expression containing an aggregate function such as count_
, sum_
,
countAll_
, etc), a grouping key (specified with the group_
function),
or a combination of tuples of the above.
Appropriate instances are provided up to 8-tuples.
Semantically, all grouping expressions in the projection will be added to a
SQL GROUP BY
clause and all aggregate expressions will be computed.
The return value will be the type of the aggregate projection, but
transformed to be in the normal value context (i.e., everything will become
QExpr
s).
For usage examples, see the manual.
filterWhere_ :: IsSql2003ExpressionElementaryOLAPOperationsSyntax expr => QAgg expr s a -> QExpr expr s Bool -> QAgg expr s a Source #
Support for FILTER (WHERE ...) syntax for aggregates. Part of SQL2003 Advanced OLAP operations feature (T612).
See filterWhere_'
for a version that accepts SqlBool
.
filterWhere_' :: IsSql2003ExpressionElementaryOLAPOperationsSyntax expr => QAgg expr s a -> QExpr expr s SqlBool -> QAgg expr s a Source #
Like filterWhere_
but accepting SqlBool
.
class QGroupable expr grouped | expr -> grouped, grouped -> expr where Source #
Type class for grouping keys. expr
is the type of the grouping key after
projection. grouped
is the type of the grouping key in the aggregate
expression (usually something that contains QGenExpr
s in the
QGroupingContext
).
Instances
Beamable tbl => QGroupable (tbl (QExpr expr s)) (tbl (QGroupExpr expr s)) Source # |
|
Defined in Database.Beam.Query.Aggregate group_ :: tbl (QExpr expr s) -> tbl (QGroupExpr expr s) Source # | |
QGroupable (QExpr expr s a) (QGroupExpr expr s a) Source # |
|
Defined in Database.Beam.Query.Aggregate group_ :: QExpr expr s a -> QGroupExpr expr s a Source # |
General-purpose aggregate functions
sum_ :: (IsSql92AggregationExpressionSyntax expr, Num a) => QExpr expr s a -> QAgg expr s (Maybe a) Source #
SQL SUM(ALL ..)
function (but without the explicit ALL)
avg_ :: (IsSql92AggregationExpressionSyntax expr, Num a) => QExpr expr s a -> QAgg expr s (Maybe a) Source #
SQL AVG(ALL ..)
function (but without the explicit ALL)
min_ :: IsSql92AggregationExpressionSyntax expr => QExpr expr s a -> QAgg expr s (Maybe a) Source #
SQL MIN(ALL ..)
function (but without the explicit ALL)
max_ :: IsSql92AggregationExpressionSyntax expr => QExpr expr s a -> QAgg expr s (Maybe a) Source #
SQL MAX(ALL ..)
function (but without the explicit ALL)
count_ :: (IsSql92AggregationExpressionSyntax expr, Integral b) => QExpr expr s a -> QAgg expr s b Source #
SQL COUNT(ALL ..)
function (but without the explicit ALL)
countAll_ :: IsSql92AggregationExpressionSyntax expr => QAgg expr s Int Source #
SQL COUNT(*)
function
rank_ :: IsSql2003ExpressionElementaryOLAPOperationsSyntax expr => QAgg expr s Int Source #
SQL2003 RANK
function (Requires T611 Elementary OLAP operations support)
cumeDist_ :: IsSql2003ExpressionAdvancedOLAPOperationsSyntax expr => QAgg expr s Double Source #
SQL2003 CUME_DIST
function (Requires T612 Advanced OLAP operations support)
percentRank_ :: IsSql2003ExpressionAdvancedOLAPOperationsSyntax expr => QAgg expr s Double Source #
SQL2003 PERCENT_RANK
function (Requires T612 Advanced OLAP operations support)
denseRank_ :: IsSql2003ExpressionAdvancedOLAPOperationsSyntax expr => QAgg expr s Int Source #
every_ :: IsSql99AggregationExpressionSyntax expr => QExpr expr s SqlBool -> QAgg expr s SqlBool Source #
SQL99 EVERY(ALL ..)
function (but without the explicit ALL)
any_ :: IsSql99AggregationExpressionSyntax expr => QExpr expr s SqlBool -> QAgg expr s SqlBool Source #
SQL99 ANY(ALL ..)
function (but without the explicit ALL)
some_ :: IsSql99AggregationExpressionSyntax expr => QExpr expr s SqlBool -> QAgg expr s SqlBool Source #
SQL99 SOME(ALL ..)
function (but without the explicit ALL)
Quantified aggregate functions
These functions correspond one-to-one with the <#gp-agg-funcs general-purpose aggregate functions>. However, they each take a mandatory "set quantifier", which is any of the set quantifier values.
sumOver_ :: (IsSql92AggregationExpressionSyntax expr, Num a) => Maybe (Sql92AggregationSetQuantifierSyntax expr) -> QExpr expr s a -> QAgg expr s (Maybe a) Source #
avgOver_ :: (IsSql92AggregationExpressionSyntax expr, Num a) => Maybe (Sql92AggregationSetQuantifierSyntax expr) -> QExpr expr s a -> QAgg expr s (Maybe a) Source #
minOver_ :: IsSql92AggregationExpressionSyntax expr => Maybe (Sql92AggregationSetQuantifierSyntax expr) -> QExpr expr s a -> QAgg expr s (Maybe a) Source #
maxOver_ :: IsSql92AggregationExpressionSyntax expr => Maybe (Sql92AggregationSetQuantifierSyntax expr) -> QExpr expr s a -> QAgg expr s (Maybe a) Source #
countOver_ :: (IsSql92AggregationExpressionSyntax expr, Integral b) => Maybe (Sql92AggregationSetQuantifierSyntax expr) -> QExpr expr s a -> QAgg expr s b Source #
everyOver_ :: IsSql99AggregationExpressionSyntax expr => Maybe (Sql92AggregationSetQuantifierSyntax expr) -> QExpr expr s SqlBool -> QAgg expr s SqlBool Source #
SQL EVERY
, SOME
, and ANY
aggregates. Operates over
SqlBool
only, as the result can be NULL
, even if all inputs are
known (no input rows).
anyOver_ :: IsSql99AggregationExpressionSyntax expr => Maybe (Sql92AggregationSetQuantifierSyntax expr) -> QExpr expr s SqlBool -> QAgg expr s SqlBool Source #
SQL EVERY
, SOME
, and ANY
aggregates. Operates over
SqlBool
only, as the result can be NULL
, even if all inputs are
known (no input rows).
someOver_ :: IsSql99AggregationExpressionSyntax expr => Maybe (Sql92AggregationSetQuantifierSyntax expr) -> QExpr expr s SqlBool -> QAgg expr s SqlBool Source #
SQL EVERY
, SOME
, and ANY
aggregates. Operates over
SqlBool
only, as the result can be NULL
, even if all inputs are
known (no input rows).
Set quantifiers
distinctInGroup_ :: IsSql92AggregationSetQuantifierSyntax s => Maybe s Source #
Compute an aggregate only over distinct values in a group. Corresponds to
the AGG(DISTINCT ..)
syntax.
allInGroup_ :: IsSql92AggregationSetQuantifierSyntax s => Maybe s Source #
Compute an aggregate over all values in a group. Corresponds semantically
to the AGG(ALL ..)
syntax, but doesn't produce an explicit ALL
. To
produce ALL
expicitly, see allInGroupExplicitly_
.
allInGroupExplicitly_ :: IsSql92AggregationSetQuantifierSyntax s => Maybe s Source #
Compute an aggregate over all values in a group. Corresponds to the
AGG(ALL ..)
syntax. Note that ALL
is the default for most aggregations,
so you don't normally explicitly specify ALL
. However, if you need to,
you can use this function. To be explicit about quantification in the beam
query DSL, but not produce an explicit ALL
, use allInGroup_
.
allInGroup_
has the same semantic meaning, but does not produce an
explicit ALL
.
SQL Command construction and execution
SELECT
newtype SqlSelect select a Source #
Represents a select statement over the syntax select
that will return
rows of type a
.
SqlSelect select |
select :: forall syntax db res. (ProjectibleInSelectSyntax syntax res, IsSql92SelectSyntax syntax, HasQBuilder syntax) => Q syntax db QueryInaccessible res -> SqlSelect syntax (QExprToIdentity res) Source #
lookup_ :: (HasQBuilder syntax, Sql92SelectSanityCheck syntax, SqlValableTable (PrimaryKey table) (Sql92SelectExpressionSyntax syntax), HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92SelectExpressionSyntax syntax)) Bool, HasTableEquality (Sql92SelectExpressionSyntax syntax) (PrimaryKey table), Beamable table, Table table, Database be db) => DatabaseEntity be db (TableEntity table) -> PrimaryKey table Identity -> SqlSelect syntax (table Identity) Source #
Convenience function to generate a SqlSelect
that looks up a table row
given a primary key.
runSelectReturningList :: (IsSql92Syntax cmd, MonadBeam cmd be hdl m, FromBackendRow be a) => SqlSelect (Sql92SelectSyntax cmd) a -> m [a] Source #
runSelectReturningOne :: (IsSql92Syntax cmd, MonadBeam cmd be hdl m, FromBackendRow be a) => SqlSelect (Sql92SelectSyntax cmd) a -> m (Maybe a) Source #
dumpSqlSelect :: ProjectibleInSelectSyntax SqlSyntaxBuilder res => Q SqlSyntaxBuilder db QueryInaccessible res -> IO () Source #
Use a special debug syntax to print out an ANSI Standard SELECT
statement
that may be generated for a given Q
.
INSERT
data SqlInsert syntax Source #
Represents a SQL INSERT
command that has not yet been run
SqlInsert syntax | |
SqlInsertNoRows |
:: (IsSql92InsertSyntax syntax, Projectible Text (table (QField s))) | |
=> DatabaseEntity be db (TableEntity table) | Table to insert into |
-> SqlInsertValues (Sql92InsertValuesSyntax syntax) (table (QExpr (Sql92InsertExpressionSyntax syntax) s)) | Values to insert. See |
-> SqlInsert syntax |
Generate a SqlInsert
given a table and a source of values.
:: (IsSql92InsertSyntax syntax, Projectible Text (QExprToField r)) | |
=> DatabaseEntity be db (TableEntity table) | Table to insert into |
-> (table (QField s) -> QExprToField r) | |
-> SqlInsertValues (Sql92InsertValuesSyntax syntax) r | Values to insert. See |
-> SqlInsert syntax |
Generate a SqlInsert
over only certain fields of a table
runInsert :: (IsSql92Syntax cmd, MonadBeam cmd be hdl m) => SqlInsert (Sql92InsertSyntax cmd) -> m () Source #
data SqlInsertValues insertValues proj Source #
Represents a source of values that can be inserted into a table shaped like
tbl
.
SqlInsertValues insertValues | |
SqlInsertValuesEmpty |
insertExpressions :: forall syntax table s. (Beamable table, IsSql92InsertValuesSyntax syntax) => (forall s'. [table (QExpr (Sql92InsertValuesExpressionSyntax syntax) s')]) -> SqlInsertValues syntax (table (QExpr (Sql92InsertValuesExpressionSyntax syntax) s)) Source #
Build a SqlInsertValues
from series of expressions in tables
insertValues :: forall table syntax s. (Beamable table, IsSql92InsertValuesSyntax syntax, FieldsFulfillConstraint (HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92InsertValuesExpressionSyntax syntax))) table) => [table Identity] -> SqlInsertValues syntax (table (QExpr (Sql92InsertValuesExpressionSyntax syntax) s)) Source #
Build a SqlInsertValues
from concrete table values
insertFrom :: (IsSql92InsertValuesSyntax syntax, HasQBuilder (Sql92InsertValuesSelectSyntax syntax), Projectible (Sql92SelectExpressionSyntax (Sql92InsertValuesSelectSyntax syntax)) r) => Q (Sql92InsertValuesSelectSyntax syntax) db QueryInaccessible r -> SqlInsertValues syntax r Source #
Build a SqlInsertValues
from a SqlSelect
that returns the same table
insertData :: forall syntax r. (Projectible (Sql92InsertValuesExpressionSyntax syntax) r, IsSql92InsertValuesSyntax syntax) => [r] -> SqlInsertValues syntax r Source #
Build a SqlInsertValues
from arbitrarily shaped data containing expressions
UPDATE
data SqlUpdate syntax (table :: (* -> *) -> *) Source #
Represents a SQL UPDATE
statement for the given table
.
SqlUpdate syntax | |
SqlIdentityUpdate |
:: (Beamable table, IsSql92UpdateSyntax syntax) | |
=> DatabaseEntity be db (TableEntity table) | The table to insert into |
-> (forall s. table (QField s) -> [QAssignment (Sql92UpdateFieldNameSyntax syntax) (Sql92UpdateExpressionSyntax syntax) s]) | A sequence of assignments to make. |
-> (forall s. table (QExpr (Sql92UpdateExpressionSyntax syntax) s) -> QExpr (Sql92UpdateExpressionSyntax syntax) s Bool) | Build a |
-> SqlUpdate syntax table |
Build a SqlUpdate
given a table, a list of assignments, and a way to
build a WHERE
clause.
See the '(<-.)' operator for ways to build assignments. The argument to the
second argument is a the table parameterized over QField
, which
represents the left hand side of assignments. Sometimes, you'd like to also
get the current value of a particular column. You can use the current_
function to convert a QField
to a QExpr
.
:: (Table table, IsSql92UpdateSyntax syntax, SqlValableTable (PrimaryKey table) (Sql92UpdateExpressionSyntax syntax), SqlValableTable table (Sql92UpdateExpressionSyntax syntax), HasTableEquality (Sql92UpdateExpressionSyntax syntax) (PrimaryKey table), HasSqlValueSyntax (Sql92ExpressionValueSyntax (Sql92UpdateExpressionSyntax syntax)) Bool) | |
=> DatabaseEntity be db (TableEntity table) | Table to update |
-> table Identity | Value to set to |
-> SqlUpdate syntax table |
Generate a SqlUpdate
that will update the given table with the given value.
The SQL UPDATE
that is generated will set every non-primary key field for
the row where each primary key field is exactly what is given.
Note: This is a pure SQL UPDATE
command. This does not upsert or merge values.
runUpdate :: (IsSql92Syntax cmd, MonadBeam cmd be hdl m) => SqlUpdate (Sql92UpdateSyntax cmd) tbl -> m () Source #
DELETE
newtype SqlDelete syntax (table :: (* -> *) -> *) Source #
Represents a SQL DELETE
statement for the given table
SqlDelete syntax |
:: IsSql92DeleteSyntax delete | |
=> DatabaseEntity be db (TableEntity table) | Table to delete from |
-> (forall s. (forall s'. table (QExpr (Sql92DeleteExpressionSyntax delete) s')) -> QExpr (Sql92DeleteExpressionSyntax delete) s Bool) | Build a |
-> SqlDelete delete table |
Build a SqlDelete
from a table and a way to build a WHERE
clause
runDelete :: (IsSql92Syntax cmd, MonadBeam cmd be hdl m) => SqlDelete (Sql92DeleteSyntax cmd) table -> m () Source #