@@ -7,14 +7,11 @@ module Rel8.Statement.View
77where
88
99-- base
10−import Control.Exception ( throwIO )
1110import Prelude
1211
1312-- hasql
14−import Hasql.Connection ( Connection )
1513import qualified Hasql.Decoders as Hasql
1614import qualified Hasql.Encoders as Hasql
17−import qualified Hasql.Session as Hasql
1815import qualified Hasql.Statement as Hasql
1916
2017-- rel8
@@ -36,12 +33,9 @@ import Data.Text.Encoding ( encodeUtf8 )
3633-- statement that will save the given query as a view. This can be useful if
3734-- you want to share Rel8 queries with other applications.
3835createView :: Selects names exprs
39− => Connection -> TableSchema names -> Query exprs -> IO ()
40−createView connection schema query =
41− Hasql.run session connection >>= either throwIO pure
36+ => TableSchema names -> Query exprs -> Hasql.Statement () ()
37+createView schema query = Hasql.Statement bytes params decode prepare
4238 where
43− session = Hasql.statement () statement
44− statement = Hasql.Statement bytes params decode prepare
4539 bytes = encodeUtf8 (Text.pack sql)
4640 params = Hasql.noParams
4741 decode = Hasql.noResult