module Database.Persist.Sql
(
module Database.Persist.Sql.Class
, module Database.Persist.Sql.Run
, module Database.Persist.Sql.Migration
, module Database.Persist
, module Database.Persist.Sql.Orphan.PersistStore
, rawQuery
, rawQueryRes
, rawExecute
, rawExecuteCount
, rawSql
, deleteWhereCount
, updateWhereCount
, filterClause
, filterClauseWithVals
, orderClause
, FilterTablePrefix (..)
, transactionSave
, transactionSaveWithIsolation
, transactionUndo
, transactionUndoWithIsolation
, getStmtConn
, mkColumns
, BackendSpecificOverrides
, emptyBackendSpecificOverrides
, getBackendSpecificForeignKeyName
, setBackendSpecificForeignKeyName
, defaultAttribute
, IsolationLevel(..)
, decorateSQLWithLimitOffset
, module Database.Persist.Sql.Types
) where
import Control.Monad.IO.Class
import Control.Monad.Trans.Reader (ReaderT, ask)
import Database.Persist
import Database.Persist.Sql.Class
import Database.Persist.Sql.Internal
import Database.Persist.Sql.Migration
import Database.Persist.Sql.Raw
import Database.Persist.Sql.Run hiding (rawAcquireSqlConn, rawRunSqlPool)
import Database.Persist.Sql.Types
import Database.Persist.Sql.Types.Internal (IsolationLevel(..), SqlBackend(..))
import Database.Persist.Sql.Orphan.PersistQuery
import Database.Persist.Sql.Orphan.PersistStore
import Database.Persist.Sql.Orphan.PersistUnique ()
transactionSave :: MonadIO m => ReaderT SqlBackend m ()
transactionSave :: forall (m :: * -> *). MonadIO m => ReaderT SqlBackend m ()
transactionSave = do
SqlBackend
conn <- forall (m :: * -> *) r. Monad m => ReaderT r m r
ask
let getter :: Text -> IO Statement
getter = SqlBackend -> Text -> IO Statement
getStmtConn SqlBackend
conn
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ SqlBackend -> (Text -> IO Statement) -> IO ()
connCommit SqlBackend
conn Text -> IO Statement
getter forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> SqlBackend
-> (Text -> IO Statement) -> Maybe IsolationLevel -> IO ()
connBegin SqlBackend
conn Text -> IO Statement
getter forall a. Maybe a
Nothing
transactionSaveWithIsolation :: MonadIO m => IsolationLevel -> ReaderT SqlBackend m ()
transactionSaveWithIsolation :: forall (m :: * -> *).
MonadIO m =>
IsolationLevel -> ReaderT SqlBackend m ()
transactionSaveWithIsolation IsolationLevel
isolation = do
SqlBackend
conn <- forall (m :: * -> *) r. Monad m => ReaderT r m r
ask
let getter :: Text -> IO Statement
getter = SqlBackend -> Text -> IO Statement
getStmtConn SqlBackend
conn
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ SqlBackend -> (Text -> IO Statement) -> IO ()
connCommit SqlBackend
conn Text -> IO Statement
getter forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> SqlBackend
-> (Text -> IO Statement) -> Maybe IsolationLevel -> IO ()
connBegin SqlBackend
conn Text -> IO Statement
getter (forall a. a -> Maybe a
Just IsolationLevel
isolation)
transactionUndo :: MonadIO m => ReaderT SqlBackend m ()
transactionUndo :: forall (m :: * -> *). MonadIO m => ReaderT SqlBackend m ()
transactionUndo = do
SqlBackend
conn <- forall (m :: * -> *) r. Monad m => ReaderT r m r
ask
let getter :: Text -> IO Statement
getter = SqlBackend -> Text -> IO Statement
getStmtConn SqlBackend
conn
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ SqlBackend -> (Text -> IO Statement) -> IO ()
connRollback SqlBackend
conn Text -> IO Statement
getter forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> SqlBackend
-> (Text -> IO Statement) -> Maybe IsolationLevel -> IO ()
connBegin SqlBackend
conn Text -> IO Statement
getter forall a. Maybe a
Nothing
transactionUndoWithIsolation :: MonadIO m => IsolationLevel -> ReaderT SqlBackend m ()
transactionUndoWithIsolation :: forall (m :: * -> *).
MonadIO m =>
IsolationLevel -> ReaderT SqlBackend m ()
transactionUndoWithIsolation IsolationLevel
isolation = do
SqlBackend
conn <- forall (m :: * -> *) r. Monad m => ReaderT r m r
ask
let getter :: Text -> IO Statement
getter = SqlBackend -> Text -> IO Statement
getStmtConn SqlBackend
conn
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO forall a b. (a -> b) -> a -> b
$ SqlBackend -> (Text -> IO Statement) -> IO ()
connRollback SqlBackend
conn Text -> IO Statement
getter forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> SqlBackend
-> (Text -> IO Statement) -> Maybe IsolationLevel -> IO ()
connBegin SqlBackend
conn Text -> IO Statement
getter (forall a. a -> Maybe a
Just IsolationLevel
isolation)