Copyright | Flipstone Technology Partners 2023 |
---|---|
License | MIT |
Stability | Stable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
This module provides access to functions and types intended to help build SQL
statements directly in a relatively safe manner while also always providing a
way to write exactly the SQL you need. The SQL construction functions all
require specific types as their arguments to communicate what particular
fragment of SQL they expect to take as an argument. These types generally
provide a SqlExpression
instance, however,
meaning that if Orville does not support constructing the exact SQL fragment
you want to pass for that argument directly you can always use
unsafeSqlExpression
to construct a value of the
required type. This means you can use as many of the "safe" construction
functions provided here as possible while substituting in hand-written SQL at
only the exact points you need.
For instance, the following code snippet shows how you could construct a BEGIN
TRANSACTION ISOLATION LEVEL SOME NEW ISOLATION LEVEL
statement if PostgreSQL
added SOME NEW ISOLATION LEVEL
and Orville did not yet support it.
import qualified Orville.PostgreSQL.Expr as Expr import qualified Orville.PostgreSQL.Raw.RawSql as RawSql customerBeginTransaction :: Expr.BeginTransactionExpr customerBeginTransaction = Expr.beginTransaction (Just (Expr.isolationLevel (RawSql.unsafeSqlExpression "SOME NEW ISOLATION LEVEL")))
Since: 1.0.0.0
Documentation
module Orville.PostgreSQL.Expr.Math
module Orville.PostgreSQL.Expr.Name
module Orville.PostgreSQL.Expr.Time