Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- throwSqlError :: SqlError -> IO a
- quickQuery' :: IConnection conn => conn -> String -> [SqlValue] -> IO [[SqlValue]]
- quickQuery :: IConnection conn => conn -> String -> [SqlValue] -> IO [[SqlValue]]
- fetchAllRowsMap' :: Statement -> IO [Map String SqlValue]
- fetchAllRowsMap :: Statement -> IO [Map String SqlValue]
- fetchAllRowsAL' :: Statement -> IO [[(String, SqlValue)]]
- fetchAllRowsAL :: Statement -> IO [[(String, SqlValue)]]
- fetchRowMap :: Statement -> IO (Maybe (Map String SqlValue))
- fetchRowAL :: Statement -> IO (Maybe [(String, SqlValue)])
- sFetchAllRows' :: Statement -> IO [[Maybe String]]
- sFetchAllRows :: Statement -> IO [[Maybe String]]
- fetchAllRows' :: Statement -> IO [[SqlValue]]
- fetchAllRows :: Statement -> IO [[SqlValue]]
- withTransaction :: IConnection conn => conn -> (conn -> IO a) -> IO a
- sFetchRow :: Statement -> IO (Maybe [Maybe String])
- sExecuteMany :: Statement -> [[Maybe String]] -> IO ()
- sExecute :: Statement -> [Maybe String] -> IO Integer
- sRun :: IConnection conn => conn -> String -> [Maybe String] -> IO Integer
- handleSqlError :: IO a -> IO a
- sqlExceptions :: SqlError -> Maybe SqlError
- handleSql :: (SqlError -> IO a) -> IO a -> IO a
- catchSql :: IO a -> (SqlError -> IO a) -> IO a
- withWConn :: ConnWrapper -> (forall conn. IConnection conn => conn -> b) -> b
- class IConnection conn where
- data ConnWrapper where
- data Statement
- data SqlError = SqlError {
- seState :: String
- seNativeError :: Int
- seErrorMsg :: String
- posixToSql :: POSIXTime -> SqlValue
- iToSql :: Int -> SqlValue
- nToSql :: Integral a => a -> SqlValue
- fromSql :: Convertible SqlValue a => SqlValue -> a
- safeFromSql :: Convertible SqlValue a => SqlValue -> ConvertResult a
- toSql :: Convertible a SqlValue => a -> SqlValue
- data SqlValue
- = SqlString String
- | SqlByteString ByteString
- | SqlWord32 Word32
- | SqlWord64 Word64
- | SqlInt32 Int32
- | SqlInt64 Int64
- | SqlInteger Integer
- | SqlChar Char
- | SqlBool Bool
- | SqlDouble Double
- | SqlRational Rational
- | SqlLocalDate Day
- | SqlLocalTimeOfDay TimeOfDay
- | SqlZonedLocalTimeOfDay TimeOfDay TimeZone
- | SqlLocalTime LocalTime
- | SqlZonedTime ZonedTime
- | SqlUTCTime UTCTime
- | SqlDiffTime NominalDiffTime
- | SqlPOSIXTime POSIXTime
- | SqlEpochTime Integer
- | SqlTimeDiff Integer
- | SqlNull
- data SqlColDesc = SqlColDesc {
- colType :: SqlTypeId
- colSize :: Maybe Int
- colOctetLength :: Maybe Int
- colDecDigits :: Maybe Int
- colNullable :: Maybe Bool
- data SqlTypeId
- = SqlCharT
- | SqlVarCharT
- | SqlLongVarCharT
- | SqlWCharT
- | SqlWVarCharT
- | SqlWLongVarCharT
- | SqlDecimalT
- | SqlNumericT
- | SqlSmallIntT
- | SqlIntegerT
- | SqlRealT
- | SqlFloatT
- | SqlDoubleT
- | SqlBitT
- | SqlTinyIntT
- | SqlBigIntT
- | SqlBinaryT
- | SqlVarBinaryT
- | SqlLongVarBinaryT
- | SqlDateT
- | SqlTimeT
- | SqlTimeWithZoneT
- | SqlTimestampT
- | SqlTimestampWithZoneT
- | SqlUTCDateTimeT
- | SqlUTCTimeT
- | SqlIntervalT SqlInterval
- | SqlGUIDT
- | SqlUnknownT String
- data SqlInterval
- inlineVerifiedQuery :: IConnection conn => IO conn -> Name -> Relation p r -> Config -> QuerySuffix -> String -> Q [Dec]
- defineTableFromDB :: IConnection conn => IO conn -> Driver conn -> String -> String -> [Name] -> Q [Dec]
- defineTableFromDB' :: IConnection conn => IO conn -> Driver conn -> String -> String -> [(String, TypeQ)] -> [Name] -> Q [Dec]
- defineTableDefault :: Config -> String -> String -> [(String, TypeQ)] -> [Name] -> [Int] -> Maybe Int -> Q [Dec]
- defineTableDefault' :: Config -> String -> String -> [(String, TypeQ)] -> [Name] -> Q [Dec]
- makeRelationalRecord' :: Config -> Name -> Q [Dec]
- mapUpdate :: (IConnection conn, ToSql SqlValue a) => conn -> Update a -> [a] -> IO [Integer]
- runUpdate :: (IConnection conn, ToSql SqlValue p) => conn -> Update p -> p -> IO Integer
- runPreparedUpdate :: ToSql SqlValue p => PreparedUpdate p -> p -> IO Integer
- withPrepareUpdate :: IConnection conn => conn -> Update p -> (PreparedUpdate p -> IO a) -> IO a
- prepareUpdate :: IConnection conn => conn -> Update p -> IO (PreparedUpdate p)
- type PreparedUpdate p = PreparedStatement p ()
- runDelete :: (IConnection conn, ToSql SqlValue p) => conn -> Delete p -> p -> IO Integer
- runPreparedDelete :: ToSql SqlValue p => PreparedDelete p -> p -> IO Integer
- withPrepareDelete :: IConnection conn => conn -> Delete p -> (PreparedDelete p -> IO a) -> IO a
- prepareDelete :: IConnection conn => conn -> Delete p -> IO (PreparedDelete p)
- type PreparedDelete p = PreparedStatement p ()
- chunksInsert :: (IConnection conn, ToSql SqlValue a) => conn -> Insert a -> [a] -> IO [[Integer]]
- bulkInsert' :: (IConnection conn, ToSql SqlValue a) => conn -> Insert a -> [a] -> IO ([Integer], [Integer])
- bulkInsert :: (IConnection conn, ToSql SqlValue a) => conn -> Insert a -> [a] -> IO ()
- bulkInsertInterleave :: (IConnection conn, ToSql SqlValue a) => conn -> Insert a -> [a] -> IO ([Integer], [Integer])
- mapInsert :: (IConnection conn, ToSql SqlValue a) => conn -> Insert a -> [a] -> IO [Integer]
- runInsert :: (IConnection conn, ToSql SqlValue a) => conn -> Insert a -> a -> IO Integer
- runPreparedInsert :: ToSql SqlValue a => PreparedInsert a -> a -> IO Integer
- prepareInsert :: IConnection conn => conn -> Insert a -> IO (PreparedInsert a)
- type PreparedInsert a = PreparedStatement a ()
- runInsertQuery :: (IConnection conn, ToSql SqlValue p) => conn -> InsertQuery p -> p -> IO Integer
- runPreparedInsertQuery :: ToSql SqlValue p => PreparedInsertQuery p -> p -> IO Integer
- withPrepareInsertQuery :: IConnection conn => conn -> InsertQuery p -> (PreparedInsertQuery p -> IO a) -> IO a
- prepareInsertQuery :: IConnection conn => conn -> InsertQuery p -> IO (PreparedInsertQuery p)
- type PreparedInsertQuery p = PreparedStatement p ()
- runKeyUpdate :: (IConnection conn, ToSql SqlValue a) => conn -> KeyUpdate p a -> a -> IO Integer
- runPreparedKeyUpdate :: ToSql SqlValue a => PreparedKeyUpdate p a -> a -> IO Integer
- bindKeyUpdate :: ToSql SqlValue a => PreparedKeyUpdate p a -> a -> BoundStatement ()
- withPrepareKeyUpdate :: IConnection conn => conn -> KeyUpdate p a -> (PreparedKeyUpdate p a -> IO b) -> IO b
- prepareKeyUpdate :: IConnection conn => conn -> KeyUpdate p a -> IO (PreparedKeyUpdate p a)
- data PreparedKeyUpdate p a
- runQuery' :: (IConnection conn, ToSql SqlValue p, FromSql SqlValue a) => conn -> Query p a -> p -> IO [a]
- runQuery :: (IConnection conn, ToSql SqlValue p, FromSql SqlValue a) => conn -> Query p a -> p -> IO [a]
- runPreparedQuery' :: (ToSql SqlValue p, FromSql SqlValue a) => PreparedQuery p a -> p -> IO [a]
- runPreparedQuery :: (ToSql SqlValue p, FromSql SqlValue a) => PreparedQuery p a -> p -> IO [a]
- runStatement' :: FromSql SqlValue a => BoundStatement a -> IO [a]
- runStatement :: FromSql SqlValue a => BoundStatement a -> IO [a]
- fetchUnique' :: FromSql SqlValue a => ExecutedStatement a -> IO (Maybe a)
- listToUnique :: [a] -> IO (Maybe a)
- fetchUnique :: FromSql SqlValue a => ExecutedStatement a -> IO (Maybe a)
- fetchAll' :: FromSql SqlValue a => ExecutedStatement a -> IO [a]
- fetchAll :: FromSql SqlValue a => ExecutedStatement a -> IO [a]
- fetch :: FromSql SqlValue a => ExecutedStatement a -> IO (Maybe a)
- withPrepareQuery :: IConnection conn => conn -> Query p a -> (PreparedQuery p a -> IO b) -> IO b
- prepareQuery :: IConnection conn => conn -> Query p a -> IO (PreparedQuery p a)
- type PreparedQuery p a = PreparedStatement p a
- mapNoFetch :: (UntypeableNoFetch s, IConnection conn, ToSql SqlValue a) => conn -> s a -> [a] -> IO [Integer]
- runNoFetch :: (UntypeableNoFetch s, IConnection conn, ToSql SqlValue a) => conn -> s a -> a -> IO Integer
- runPreparedNoFetch :: ToSql SqlValue a => PreparedStatement a () -> a -> IO Integer
- executeNoFetch :: ToSql SqlValue a => PreparedStatement a () -> a -> IO Integer
- executeBoundNoFetch :: BoundStatement () -> IO Integer
- executePrepared :: ToSql SqlValue p => PreparedStatement p a -> p -> IO (ExecutedStatement a)
- executeBound :: BoundStatement a -> IO (ExecutedStatement a)
- bindTo :: ToSql SqlValue p => p -> PreparedStatement p a -> BoundStatement a
- bind :: ToSql SqlValue p => PreparedStatement p a -> p -> BoundStatement a
- withPrepareNoFetch :: (UntypeableNoFetch s, IConnection conn) => conn -> s p -> (PreparedStatement p () -> IO a) -> IO a
- withUnsafePrepare :: IConnection conn => conn -> String -> (PreparedStatement p a -> IO b) -> IO b
- prepareNoFetch :: (UntypeableNoFetch s, IConnection conn) => conn -> s p -> IO (PreparedStatement p ())
- unsafePrepare :: IConnection conn => conn -> String -> IO (PreparedStatement p a)
- untypePrepared :: PreparedStatement p a -> Statement
- data PreparedStatement p a
- data BoundStatement a = BoundStatement {}
- data ExecutedStatement a
- module Database.HDBC.Session
- module Database.HDBC.Sqlite3
- updateValuesByPrimary :: (HasKeyConstraint Primary ra, ToSql q ra) => ra -> [q]
- updateValuesByUnique :: ToSql q ra => KeyConstraint Unique ra -> ra -> [q]
- valueRecordToSql :: (a -> q) -> RecordToSql q a
- fromRecord :: ToSql q a => a -> [q]
- putEmpty :: () -> ToSqlM q ()
- putRecord :: ToSql q a => a -> ToSqlM q ()
- type ToSqlM q a = Writer (DList q) a
- data RecordToSql q a
- class PersistableWidth a => ToSql q a where
- valueRecordFromSql :: (q -> a) -> RecordFromSql q a
- toRecord :: FromSql q a => [q] -> a
- takeRecord :: FromSql q a => [q] -> (a, [q])
- data RecordFromSql q a
- class FromSql q a where
- derivedWidth :: PersistableWidth a => (PersistableRecordWidth a, Int)
- sqlNullValue :: PersistableType q => q
- data PersistableSqlType q
- type PersistableRecordWidth a = ProductConst (Sum Int) a
- class Eq q => PersistableType q where
- class PersistableWidth a where
- derivedUniqueConstraint :: HasKeyConstraint Primary r => UniqueConstraint r
- derivedCompositePrimary :: HasColumnConstraint Primary r => PrimaryConstraint r
- deriveComposite :: ColumnConstraint c r -> KeyConstraint c r
- derivedNotNullColumnConstraint :: HasColumnConstraint Primary r => NotNullColumnConstraint r
- derivedUniqueColumnConstraint :: HasColumnConstraint Primary r => UniqueColumnConstraint r
- notNullColumn :: PrimaryColumnConstraint r -> NotNullColumnConstraint r
- uniqueColumn :: PrimaryColumnConstraint r -> UniqueColumnConstraint r
- data ColumnConstraint c r
- data Unique
- data NotNull
- data Primary
- type UniqueColumnConstraint = ColumnConstraint Unique
- type NotNullColumnConstraint = ColumnConstraint NotNull
- type PrimaryColumnConstraint = ColumnConstraint Primary
- class HasColumnConstraint c a where
- data KeyConstraint c r
- type UniqueConstraint = KeyConstraint Unique
- type PrimaryConstraint = KeyConstraint Primary
- class HasKeyConstraint c a where
- data Unique
- data NotNull
- data Primary
- derivedUniqueRelation :: TableDerivable r => Key Unique r k -> Record c k -> UniqueRelation () c r
- primaryUpdate :: HasConstraintKey Primary r p => Table r -> KeyUpdate p r
- updateByConstraintKey :: Table r -> Key c r p -> KeyUpdate p r
- updateValuesWithKey :: ToSql q r => Pi r p -> r -> [q]
- primary :: HasConstraintKey Primary a p => Relation () a -> Relation p a
- primarySelect :: HasConstraintKey Primary a p => Relation () a -> Relation p a
- primary' :: PersistableWidth p => Key Primary a p -> Relation () a -> Relation p a
- uniqueSelect :: PersistableWidth p => Key Unique a p -> Relation () a -> Relation p a
- specifiedKey :: PersistableWidth p => Pi a p -> Relation () a -> Relation p a
- updateNumber :: (PersistableWidth s, Integral i, LiteralSQL i) => i -> Sequence s i -> Update ()
- updateNumber' :: (PersistableWidth s, Integral i, LiteralSQL i) => Config -> i -> Sequence s i -> Update ()
- ($$) :: Binding r s i => (i -> r) -> Number r i -> r
- ($$!) :: (i -> r) -> Number r i -> r
- extractNumber :: Number r i -> i
- unsafeSpecifyNumber :: Binding r s i => i -> Number r i
- fromRelation :: Binding r s i => Relation () r -> Sequence s i
- primaryBinding :: (TableDerivable r, SequenceDerivable s i, HasConstraintKey Primary r i) => SeqBinding r s i
- unsafeSpecifyBinding :: (TableDerivable r, SequenceDerivable s i) => Pi r i -> SeqBinding r s i
- seqRelation :: TableDerivable s => Sequence s i -> Relation () s
- unsafeSpecifySequence :: TableDerivable s => (s -> i) -> Pi s i -> Sequence s i
- data Sequence s i
- class TableDerivable s => SequenceDerivable s i | s -> i where
- data SeqBinding r s i
- class (TableDerivable r, SequenceDerivable s i) => Binding r s i | r -> s where
- data Number r i
- derivedDelete :: TableDerivable r => RestrictedStatement r (PlaceHolders p) -> Delete p
- deleteNoPH :: TableDerivable r => RestrictedStatement r () -> Delete ()
- delete :: TableDerivable r => RestrictedStatement r (PlaceHolders p) -> Delete p
- derivedDelete' :: TableDerivable r => Config -> RestrictedStatement r (PlaceHolders p) -> Delete p
- delete' :: TableDerivable r => Config -> RestrictedStatement r (PlaceHolders p) -> Delete p
- typedDelete :: Table r -> Restriction p r -> Delete p
- typedDelete' :: Config -> Table r -> Restriction p r -> Delete p
- deleteSQL :: Config -> Table r -> Restriction p r -> String
- derivedInsertQuery :: TableDerivable r => Pi r r' -> Relation p r' -> InsertQuery p
- insertQuery :: TableDerivable r => Pi r r' -> Relation p r' -> InsertQuery p
- typedInsertQuery :: Table r -> Pi r r' -> Relation p r' -> InsertQuery p
- typedInsertQuery' :: Config -> Table r -> Pi r r' -> Relation p r' -> InsertQuery p
- insertQuerySQL :: Config -> Table r -> Pi r r' -> Relation p r' -> String
- insertValueList :: (TableDerivable r, LiteralSQL r') => Pi r r' -> [r'] -> [Insert ()]
- insertValueList' :: (TableDerivable r, LiteralSQL r') => Config -> Pi r r' -> [r'] -> [Insert ()]
- derivedInsertValue :: TableDerivable r => Register r (PlaceHolders p) -> Insert p
- insertValueNoPH :: TableDerivable r => Register r () -> Insert ()
- insertValue :: TableDerivable r => Register r (PlaceHolders p) -> Insert p
- derivedInsertValue' :: TableDerivable r => Config -> Register r (PlaceHolders p) -> Insert p
- insertValue' :: TableDerivable r => Config -> Register r (PlaceHolders p) -> Insert p
- typedInsertValue :: Table r -> InsertTarget p r -> Insert p
- typedInsertValue' :: Config -> Table r -> InsertTarget p r -> Insert p
- derivedInsert :: (PersistableWidth r, TableDerivable r) => Pi r r' -> Insert r'
- insert :: (PersistableWidth r, TableDerivable r) => Pi r r' -> Insert r'
- typedInsert :: PersistableWidth r => Table r -> Pi r r' -> Insert r'
- typedInsert' :: PersistableWidth r => Config -> Table r -> Pi r r' -> Insert r'
- unsafeTypedInsert' :: String -> String -> Int -> Insert a
- chunkSizeOfInsert :: Insert a -> Int
- untypeChunkInsert :: Insert a -> String
- derivedUpdateAllColumn :: (PersistableWidth r, TableDerivable r) => RestrictedStatement r (PlaceHolders p) -> Update (r, p)
- updateAllColumnNoPH :: (PersistableWidth r, TableDerivable r) => RestrictedStatement r () -> Update r
- updateAllColumn :: (PersistableWidth r, TableDerivable r) => RestrictedStatement r (PlaceHolders p) -> Update (r, p)
- derivedUpdateAllColumn' :: (PersistableWidth r, TableDerivable r) => Config -> RestrictedStatement r (PlaceHolders p) -> Update (r, p)
- updateAllColumn' :: (PersistableWidth r, TableDerivable r) => Config -> RestrictedStatement r (PlaceHolders p) -> Update (r, p)
- typedUpdateAllColumn :: PersistableWidth r => Table r -> Restriction p r -> Update (r, p)
- derivedUpdate :: TableDerivable r => AssignStatement r (PlaceHolders p) -> Update p
- updateNoPH :: TableDerivable r => AssignStatement r () -> Update ()
- update :: TableDerivable r => AssignStatement r (PlaceHolders p) -> Update p
- derivedUpdate' :: TableDerivable r => Config -> AssignStatement r (PlaceHolders p) -> Update p
- update' :: TableDerivable r => Config -> AssignStatement r (PlaceHolders p) -> Update p
- typedUpdate :: Table r -> UpdateTarget p r -> Update p
- typedUpdate' :: Config -> Table r -> UpdateTarget p r -> Update p
- updateSQL :: Config -> Table r -> UpdateTarget p r -> String
- unsafeTypedUpdate :: String -> Update p
- derivedKeyUpdate :: TableDerivable r => Pi r p -> KeyUpdate p r
- keyUpdate :: TableDerivable r => Pi r p -> KeyUpdate p r
- typedKeyUpdateTable :: TableDerivable r => Relation () r -> Pi r p -> KeyUpdate p r
- typedKeyUpdate :: Table a -> Pi a p -> KeyUpdate p a
- relationalQuery :: Relation p r -> Query p r
- relationalQuery' :: Relation p r -> QuerySuffix -> Query p r
- relationalQuerySQL :: Config -> Relation p r -> QuerySuffix -> String
- unsafeTypedQuery :: String -> Query p a
- newtype Query p a = Query {}
- data KeyUpdate p a = KeyUpdate {
- updateKey :: Pi a p
- untypeKeyUpdate :: String
- newtype Update p = Update {}
- data Insert a = Insert {
- untypeInsert :: String
- chunkedInsert :: Maybe (String, Int)
- newtype InsertQuery p = InsertQuery {}
- newtype Delete p = Delete {}
- class UntypeableNoFetch (s :: * -> *) where
- sqlChunksFromRecordList :: LiteralSQL r' => Config -> Table r -> Pi r r' -> [r'] -> [StringSQL]
- sqlFromInsertTarget :: Config -> Table r -> InsertTarget p r -> StringSQL
- sqlChunkFromInsertTarget :: Config -> Table r -> InsertTarget p r -> (StringSQL, Int)
- piRegister :: PersistableWidth r => Pi r r' -> Register r (PlaceHolders r')
- insertTarget' :: Register r (PlaceHolders p) -> InsertTarget p r
- insertTarget :: Register r () -> InsertTarget () r
- sqlFromUpdateTarget :: Config -> Table r -> UpdateTarget p r -> StringSQL
- updateTargetAllColumn' :: PersistableWidth r => RestrictedStatement r (PlaceHolders p) -> UpdateTarget (r, p) r
- updateTargetAllColumn :: PersistableWidth r => RestrictedStatement r () -> UpdateTarget r r
- liftTargetAllColumn' :: PersistableWidth r => Restriction p r -> UpdateTarget (r, p) r
- liftTargetAllColumn :: PersistableWidth r => Restriction () r -> UpdateTarget r r
- updateTarget' :: AssignStatement r (PlaceHolders p) -> UpdateTarget p r
- updateTarget :: AssignStatement r () -> UpdateTarget () r
- sqlWhereFromRestriction :: Config -> Table r -> Restriction p r -> StringSQL
- restriction' :: RestrictedStatement r (PlaceHolders p) -> Restriction p r
- restriction :: RestrictedStatement r () -> Restriction () r
- data Restriction p r
- data UpdateTarget p r
- data InsertTarget p r
- intersectAll' :: Relation p a -> Relation q a -> Relation (p, q) a
- intersect' :: Relation p a -> Relation q a -> Relation (p, q) a
- exceptAll' :: Relation p a -> Relation q a -> Relation (p, q) a
- except' :: Relation p a -> Relation q a -> Relation (p, q) a
- unionAll' :: Relation p a -> Relation q a -> Relation (p, q) a
- union' :: Relation p a -> Relation q a -> Relation (p, q) a
- intersectAll :: Relation () a -> Relation () a -> Relation () a
- intersect :: Relation () a -> Relation () a -> Relation () a
- exceptAll :: Relation () a -> Relation () a -> Relation () a
- except :: Relation () a -> Relation () a -> Relation () a
- unionAll :: Relation () a -> Relation () a -> Relation () a
- union :: Relation () a -> Relation () a -> Relation () a
- on' :: ([JoinRestriction a b] -> Relation pc (a, b)) -> [JoinRestriction a b] -> Relation pc (a, b)
- full :: Relation () a -> Relation () b -> [JoinRestriction (Maybe a) (Maybe b)] -> Relation () (Maybe a, Maybe b)
- right :: Relation () a -> Relation () b -> [JoinRestriction (Maybe a) b] -> Relation () (Maybe a, b)
- left :: Relation () a -> Relation () b -> [JoinRestriction a (Maybe b)] -> Relation () (a, Maybe b)
- inner :: Relation () a -> Relation () b -> [JoinRestriction a b] -> Relation () (a, b)
- full' :: Relation pa a -> Relation pb b -> [JoinRestriction (Maybe a) (Maybe b)] -> Relation (pa, pb) (Maybe a, Maybe b)
- right' :: Relation pa a -> Relation pb b -> [JoinRestriction (Maybe a) b] -> Relation (pa, pb) (Maybe a, b)
- left' :: Relation pa a -> Relation pb b -> [JoinRestriction a (Maybe b)] -> Relation (pa, pb) (a, Maybe b)
- inner' :: Relation pa a -> Relation pb b -> [JoinRestriction a b] -> Relation (pa, pb) (a, b)
- type JoinRestriction a b = Record Flat a -> Record Flat b -> Predicate Flat
- queryScalar :: (MonadQualify ConfigureQuery m, ScalarDegree r) => UniqueRelation () c r -> m (Record c (Maybe r))
- queryScalar' :: (MonadQualify ConfigureQuery m, ScalarDegree r) => UniqueRelation p c r -> m (PlaceHolders p, Record c (Maybe r))
- aggregatedUnique :: Relation ph r -> Pi r a -> (Record Flat a -> Record Aggregated b) -> UniqueRelation ph Flat b
- uniqueRelation' :: QueryUnique (PlaceHolders p, Record c r) -> UniqueRelation p c r
- uniqueQueryMaybe' :: UniqueRelation p c r -> QueryUnique (PlaceHolders p, Record c (Maybe r))
- uniqueQuery' :: UniqueRelation p c r -> QueryUnique (PlaceHolders p, Record c r)
- unUnique :: UniqueRelation p c r -> Relation p r
- unsafeUnique :: Relation p r -> UniqueRelation p c r
- aggregateRelation :: QueryAggregate (Record Aggregated r) -> Relation () r
- aggregateRelation' :: AggregatedQuery p r -> Relation p r
- relation :: QuerySimple (Record Flat r) -> Relation () r
- relation' :: SimpleQuery p r -> Relation p r
- queryList :: MonadQualify ConfigureQuery m => Relation () r -> m (RecordList (Record c) r)
- queryList' :: MonadQualify ConfigureQuery m => Relation p r -> m (PlaceHolders p, RecordList (Record c) r)
- queryMaybe :: (MonadQualify ConfigureQuery m, MonadQuery m) => Relation () r -> m (Record Flat (Maybe r))
- query :: (MonadQualify ConfigureQuery m, MonadQuery m) => Relation () r -> m (Record Flat r)
- tableOf :: TableDerivable r => Relation () r -> Table r
- derivedRelation :: TableDerivable r => Relation () r
- table :: Table r -> Relation () r
- data UniqueRelation p c r
- over :: SqlContext c => Record OverWindow a -> Window c () -> Record c a
- type QueryAggregate = Orderings Aggregated (Restrictings Aggregated (AggregatingSetT QueryCore))
- type AggregatedQuery p r = OrderedQuery Aggregated (Restrictings Aggregated (AggregatingSetT QueryCore)) p r
- type Window c = Orderings c (PartitioningSet c)
- groupingSets :: AggregatingSetList a -> AggregateKey a
- cube :: AggregatingPowerSet a -> AggregateKey a
- rollup :: AggregatingPowerSet a -> AggregateKey a
- bkey :: Record Flat r -> AggregatingPowerSet (Record Aggregated (Maybe r))
- set :: AggregatingSet a -> AggregatingSetList a
- key' :: AggregateKey a -> AggregatingSet a
- key :: Record Flat r -> AggregatingSet (Record Aggregated (Maybe r))
- type Assign r = Assignings r Restrict
- type Register r = Assignings r ConfigureQuery
- (<-#) :: Monad m => AssignTarget r v -> Record Flat v -> Assignings r m ()
- assignTo :: Monad m => Record Flat v -> AssignTarget r v -> Assignings r m ()
- type QuerySimple = Orderings Flat QueryCore
- type SimpleQuery p r = OrderedQuery Flat QueryCore p r
- data QueryUnique a
- extractCore :: QueryCore a -> ConfigureQuery (((a, [Predicate Flat]), JoinProduct), Duplication)
- type QueryCore = Restrictings Flat (QueryJoin ConfigureQuery)
- type OrderedQuery c (m :: * -> *) p r = Orderings c m (PlaceHolders p, Record c r)
- desc :: Monad m => Record c t -> Orderings c m ()
- asc :: Monad m => Record c t -> Orderings c m ()
- orderBy :: Monad m => Record c t -> Order -> Orderings c m ()
- orderBy' :: Monad m => Record c t -> Order -> Nulls -> Orderings c m ()
- type Restrict = Restrictings Flat ConfigureQuery
- having :: MonadRestrict Aggregated m => Predicate Aggregated -> m ()
- wheres :: MonadRestrict Flat m => Predicate Flat -> m ()
- on :: MonadQuery m => Predicate Flat -> m ()
- distinct :: MonadQuery m => m ()
- all' :: MonadQuery m => m ()
- class (Functor m, Monad m) => MonadRestrict c (m :: * -> *) where
- class (Functor m, Monad m, MonadQualify ConfigureQuery m) => MonadQuery (m :: * -> *) where
- class (Functor q, Monad q, Functor m, Monad m) => MonadQualify (q :: * -> *) (m :: * -> *)
- class MonadQuery m => MonadAggregate (m :: * -> *) where
- class Monad m => MonadPartition c (m :: * -> *) where
- (??) :: PersistableWidth a => Record c (Maybe a) -> Pi a (Maybe b) -> Record c (Maybe b)
- (?) :: PersistableWidth a => Record c (Maybe a) -> Pi a b -> Record c (Maybe b)
- (!??) :: (PersistableWidth a, ProjectableFlattenMaybe (Maybe b) c) => Record cont (Maybe a) -> Pi a b -> Record cont c
- flattenPiMaybe :: (PersistableWidth a, ProjectableFlattenMaybe (Maybe b) c) => Record cont (Maybe a) -> Pi a b -> Record cont c
- (?!?) :: PersistableWidth a => Record c (Maybe a) -> Pi a (Maybe b) -> Record c (Maybe b)
- (?!) :: PersistableWidth a => Record c (Maybe a) -> Pi a b -> Record c (Maybe b)
- (!) :: PersistableWidth a => Record c a -> Pi a b -> Record c b
- some' :: (AggregatedContext ac, SqlContext ac) => Predicate Flat -> Record ac (Maybe Bool)
- any' :: (AggregatedContext ac, SqlContext ac) => Predicate Flat -> Record ac (Maybe Bool)
- every :: (AggregatedContext ac, SqlContext ac) => Predicate Flat -> Record ac (Maybe Bool)
- min' :: (Ord a, AggregatedContext ac, SqlContext ac) => Record Flat a -> Record ac (Maybe a)
- minMaybe :: (Ord a, AggregatedContext ac, SqlContext ac) => Record Flat (Maybe a) -> Record ac (Maybe a)
- max' :: (Ord a, AggregatedContext ac, SqlContext ac) => Record Flat a -> Record ac (Maybe a)
- maxMaybe :: (Ord a, AggregatedContext ac, SqlContext ac) => Record Flat (Maybe a) -> Record ac (Maybe a)
- avg :: (Num a, Fractional b, AggregatedContext ac, SqlContext ac) => Record Flat a -> Record ac (Maybe b)
- avgMaybe :: (Num a, Fractional b, AggregatedContext ac, SqlContext ac) => Record Flat (Maybe a) -> Record ac (Maybe b)
- sum' :: (Num a, AggregatedContext ac, SqlContext ac) => Record Flat a -> Record ac (Maybe a)
- sumMaybe :: (Num a, AggregatedContext ac, SqlContext ac) => Record Flat (Maybe a) -> Record ac (Maybe a)
- count :: (Integral b, AggregatedContext ac, SqlContext ac) => Record Flat a -> Record ac b
- unsafeAggregateOp :: (AggregatedContext ac, SqlContext ac) => Keyword -> Record Flat a -> Record ac b
- (><) :: ProductIsoApplicative p => p a -> p b -> p (a, b)
- projectZip :: ProductIsoApplicative p => p a -> p b -> p (a, b)
- placeholder :: (PersistableWidth t, SqlContext c, Monad m) => (Record c t -> m a) -> m (PlaceHolders t, a)
- placeholder' :: (PersistableWidth t, SqlContext c) => (Record c t -> a) -> (PlaceHolders t, a)
- pwPlaceholder :: SqlContext c => PersistableRecordWidth a -> (Record c a -> b) -> (PlaceHolders a, b)
- unitPH :: PlaceHolders ()
- unitPlaceHolder :: PlaceHolders ()
- unsafePlaceHolders :: PlaceHolders p
- unsafeAddPlaceHolders :: Functor f => f a -> f (PlaceHolders p, a)
- cumeDist :: Record OverWindow Double
- percentRank :: Record OverWindow Double
- rowNumber :: Integral a => Record OverWindow a
- denseRank :: Integral a => Record OverWindow a
- rank :: Integral a => Record OverWindow a
- fromMaybe :: (OperatorContext c, HasColumnConstraint NotNull r) => Record c r -> Record c (Maybe r) -> Record c r
- isJust :: (OperatorContext c, HasColumnConstraint NotNull r) => Record c (Maybe r) -> Predicate c
- isNothing :: (OperatorContext c, HasColumnConstraint NotNull r) => Record c (Maybe r) -> Predicate c
- in' :: OperatorContext c => Record c t -> RecordList (Record c) t -> Record c (Maybe Bool)
- caseMaybe :: (OperatorContext c, PersistableWidth b) => Record c a -> [(Record c a, Record c (Maybe b))] -> Record c (Maybe b)
- casesOrElse' :: OperatorContext c => (Record c a, [(Record c a, Record c b)]) -> Record c b -> Record c b
- case' :: OperatorContext c => Record c a -> [(Record c a, Record c b)] -> Record c b -> Record c b
- caseSearchMaybe :: (OperatorContext c, PersistableWidth a) => [(Predicate c, Record c (Maybe a))] -> Record c (Maybe a)
- casesOrElse :: OperatorContext c => [(Predicate c, Record c a)] -> Record c a -> Record c a
- caseSearch :: OperatorContext c => [(Predicate c, Record c a)] -> Record c a -> Record c a
- showNumMaybe :: (SqlContext c, Num a, IsString b) => Record c (Maybe a) -> Record c (Maybe b)
- fromIntegralMaybe :: (SqlContext c, Integral a, Num b) => Record c (Maybe a) -> Record c (Maybe b)
- negateMaybe :: (OperatorContext c, Num a) => Record c (Maybe a) -> Record c (Maybe a)
- (?*?) :: (OperatorContext c, Num a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe a)
- (?/?) :: (OperatorContext c, Num a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe a)
- (?-?) :: (OperatorContext c, Num a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe a)
- (?+?) :: (OperatorContext c, Num a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe a)
- showNum :: (SqlContext c, Num a, IsString b) => Record c a -> Record c b
- fromIntegral' :: (SqlContext c, Integral a, Num b) => Record c a -> Record c b
- negate' :: (OperatorContext c, Num a) => Record c a -> Record c a
- (.*.) :: (OperatorContext c, Num a) => Record c a -> Record c a -> Record c a
- (./.) :: (OperatorContext c, Num a) => Record c a -> Record c a -> Record c a
- (.-.) :: (OperatorContext c, Num a) => Record c a -> Record c a -> Record c a
- (.+.) :: (OperatorContext c, Num a) => Record c a -> Record c a -> Record c a
- likeMaybe :: (OperatorContext c, IsString a, LiteralSQL a) => Record c (Maybe a) -> a -> Record c (Maybe Bool)
- like :: (OperatorContext c, IsString a, LiteralSQL a) => Record c a -> a -> Record c (Maybe Bool)
- likeMaybe' :: (OperatorContext c, IsString a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe Bool)
- like' :: (OperatorContext c, IsString a) => Record c a -> Record c a -> Record c (Maybe Bool)
- (?||?) :: (OperatorContext c, IsString a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe a)
- (.||.) :: OperatorContext c => Record c a -> Record c a -> Record c a
- exists :: OperatorContext c => RecordList (Record Exists) r -> Record c (Maybe Bool)
- not' :: OperatorContext c => Record c (Maybe Bool) -> Record c (Maybe Bool)
- or' :: OperatorContext c => Record c (Maybe Bool) -> Record c (Maybe Bool) -> Record c (Maybe Bool)
- and' :: OperatorContext c => Record c (Maybe Bool) -> Record c (Maybe Bool) -> Record c (Maybe Bool)
- (.<>.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool)
- (.>=.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool)
- (.>.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool)
- (.<=.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool)
- (.<.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool)
- (.=.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool)
- unsafeBinOp :: SqlContext k => SqlBinOp -> Record k a -> Record k b -> Record k c
- unsafeUniOp :: SqlContext c2 => (Keyword -> Keyword) -> Record c1 a -> Record c2 b
- unsafeShowSql :: Record c a -> String
- unsafeShowSql' :: Record c a -> StringSQL
- values :: (LiteralSQL t, OperatorContext c) => [t] -> RecordList (Record c) t
- valueFalse :: OperatorContext c => Record c (Maybe Bool)
- valueTrue :: OperatorContext c => Record c (Maybe Bool)
- value :: (LiteralSQL t, OperatorContext c) => t -> Record c t
- nothing :: (OperatorContext c, SqlContext c, PersistableWidth a) => Record c (Maybe a)
- unsafeProjectSql :: SqlContext c => String -> Record c t
- unsafeProjectSql' :: SqlContext c => StringSQL -> Record c t
- type SqlBinOp = Keyword -> Keyword -> Keyword
- class ProjectableMaybe (p :: * -> *) where
- class ProjectableFlattenMaybe a b where
- snd' :: (PersistableWidth a, PersistableWidth b) => Pi (a, b) b
- fst' :: (PersistableWidth a, PersistableWidth b) => Pi (a, b) a
- tuplePi7_6' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a7
- tuplePi7_5' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a6
- tuplePi7_4' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a5
- tuplePi7_3' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a4
- tuplePi7_2' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a3
- tuplePi7_1' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a2
- tuplePi7_0' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a1
- tuplePi6_5' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a6
- tuplePi6_4' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a5
- tuplePi6_3' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a4
- tuplePi6_2' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a3
- tuplePi6_1' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a2
- tuplePi6_0' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a1
- tuplePi5_4' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5) => Pi (a1, a2, a3, a4, a5) a5
- tuplePi5_3' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5) => Pi (a1, a2, a3, a4, a5) a4
- tuplePi5_2' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5) => Pi (a1, a2, a3, a4, a5) a3
- tuplePi5_1' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5) => Pi (a1, a2, a3, a4, a5) a2
- tuplePi5_0' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5) => Pi (a1, a2, a3, a4, a5) a1
- tuplePi4_3' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4) => Pi (a1, a2, a3, a4) a4
- tuplePi4_2' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4) => Pi (a1, a2, a3, a4) a3
- tuplePi4_1' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4) => Pi (a1, a2, a3, a4) a2
- tuplePi4_0' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4) => Pi (a1, a2, a3, a4) a1
- tuplePi3_2' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3) => Pi (a1, a2, a3) a3
- tuplePi3_1' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3) => Pi (a1, a2, a3) a2
- tuplePi3_0' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3) => Pi (a1, a2, a3) a1
- tuplePi2_1' :: (PersistableWidth a1, PersistableWidth a2) => Pi (a1, a2) a2
- tuplePi2_0' :: (PersistableWidth a1, PersistableWidth a2) => Pi (a1, a2) a1
- updateOtherThanKeySQL :: Table r -> Pi r p -> String
- type QuerySuffix = [Keyword]
- list :: [p t] -> RecordList p t
- data RecordList (p :: * -> *) t
- data Table r
- class PersistableWidth r => TableDerivable r where
- dump :: Relation p r -> String
- sqlFromRelation :: Relation p r -> StringSQL
- sqlFromRelationWith :: Relation p r -> Config -> StringSQL
- leftPh :: Relation (p, ()) r -> Relation p r
- rightPh :: Relation ((), p) r -> Relation p r
- relationWidth :: Relation p r -> PersistableRecordWidth r
- untypeRelation :: Relation p r -> ConfigureQuery SubQuery
- unsafeTypeRelation :: ConfigureQuery SubQuery -> Relation p r
- askConfig :: ConfigureQuery Config
- qualifyQuery :: a -> ConfigureQuery (Qualified a)
- configureQuery :: ConfigureQuery q -> Config -> q
- type ConfigureQuery = Qualify (QueryConfig Identity)
- data Relation p r
- class SqlContext c where
- data PlaceHolders p
- unitSQL :: SubQuery -> String
- queryWidth :: Qualified SubQuery -> Int
- data Order
- data Nulls
- data AggregateKey a
- data SubQuery
- data Record c t
- type Predicate c = Record c (Maybe Bool)
- type PI c a b = Record c a -> Record c b
- class PersistableWidth ct => ScalarDegree ct
- showConstantTermsSQL :: ShowConstantTermsSQL a => a -> [StringSQL]
- showConstantTermsSQL' :: ShowConstantTermsSQL a => a -> DList StringSQL
- showLiteral :: LiteralSQL a => a -> [StringSQL]
- class LiteralSQL a where
- type ShowConstantTermsSQL = LiteralSQL
- derivedUniqueKey :: HasConstraintKey Primary r ct => Key Unique r ct
- uniqueKey :: PersistableWidth ct => Key Primary r ct -> Key Unique r ct
- projectionKey :: Key c r ct -> Pi r ct
- tableConstraint :: Key c r ct -> KeyConstraint c r
- data Key c r ct
- class PersistableWidth ct => HasConstraintKey c r ct where
- id' :: Pi a a
- (<?.?>) :: Pi a (Maybe b) -> Pi b (Maybe c) -> Pi a (Maybe c)
- (<?.>) :: Pi a (Maybe b) -> Pi b c -> Pi a (Maybe c)
- (<.>) :: Pi a b -> Pi b c -> Pi a c
- data Pi r0 r1
- type StringSQL = Keyword
- data Flat
- data Aggregated
- data Exists
- data OverWindow
- data Set
- data SetList
- data Power
- defaultConfig :: Config
- defaultNameConfig :: NameConfig
- data NameConfig
- data ProductUnitSupport
- data SchemaNameMode
- data IdentifierQuotation
- data Config
- runRelation :: (ToSql SqlValue p, IConnection conn, FromSql SqlValue a) => conn -> Relation p a -> p -> IO [a]
- makeRelationalRecord :: Name -> Q [Dec]
Documentation
throwSqlError :: SqlError -> IO a #
A utility function to throw a SqlError
. The mechanics of throwing
such a thing differ between GHC 6.8.x, Hugs, and GHC 6.10. This function
takes care of the special cases to make it simpler.
With GHC 6.10, it is a type-restricted alias for throw. On all other systems, it is a type-restricted alias for throwDyn.
quickQuery' :: IConnection conn => conn -> String -> [SqlValue] -> IO [[SqlValue]] #
Strict version of quickQuery
.
quickQuery :: IConnection conn => conn -> String -> [SqlValue] -> IO [[SqlValue]] #
A quick way to do a query. Similar to preparing, executing, and
then calling fetchAllRows
on a statement. See also quickQuery'
.
fetchAllRowsMap' :: Statement -> IO [Map String SqlValue] #
Strict version of fetchAllRowsMap
fetchAllRowsMap :: Statement -> IO [Map String SqlValue] #
Like fetchAllRowsAL
, but return a list of Maps instead of a list of
association lists.
fetchAllRowsAL' :: Statement -> IO [[(String, SqlValue)]] #
Strict version of fetchAllRowsAL
fetchAllRowsAL :: Statement -> IO [[(String, SqlValue)]] #
Like fetchAllRows
, but instead of returning a list for each
row, return an association list for each row, from column name to value.
See fetchRowAL
for more details.
fetchRowMap :: Statement -> IO (Maybe (Map String SqlValue)) #
Similar to fetchRowAL
, but return a Map instead of an association list.
fetchRowAL :: Statement -> IO (Maybe [(String, SqlValue)]) #
Like fetchRow
, but instead of returning a list, return an association
list from column name to value.
The keys of the column names are lowercase versions of the data returned
by getColumnNames
. Please heed the warnings there. Additionally,
results are undefined if multiple columns are returned with identical names.
sFetchAllRows' :: Statement -> IO [[Maybe String]] #
Strict version of sFetchAllRows
.
sFetchAllRows :: Statement -> IO [[Maybe String]] #
Like fetchAllRows
, but return Maybe Strings instead of SqlValue
s.
fetchAllRows' :: Statement -> IO [[SqlValue]] #
Strict version of fetchAllRows
. Does not have the side-effects
of fetchAllRows
, but forces the entire result set to be buffered
in memory.
fetchAllRows :: Statement -> IO [[SqlValue]] #
Lazily fetch all rows from an executed Statement
.
You can think of this as hGetContents applied to a database result set.
The result of this is a lazy list, and each new row will be read, lazily, from the database as the list is processed.
When you have exhausted the list, the Statement
will be finish
ed.
Please note that the careless use of this function can lead to some unpleasant
behavior. In particular, if you have not consumed the entire list, then
attempt to finish
or re-execute the statement, and then attempt to consume
more elements from the list, the result will almost certainly not be what
you want.
But then, similar caveats apply with hGetContents.
Bottom line: this is a very convenient abstraction; use it wisely.
Use fetchAllRows'
if you need something that is strict, without
all these caveats.
withTransaction :: IConnection conn => conn -> (conn -> IO a) -> IO a #
Execute some code. If any uncaught exception occurs, run
rollback
and re-raise it. Otherwise, run commit
and return.
This function, therefore, encapsulates the logical property that a transaction is all about: all or nothing.
The IConnection
object passed in is passed directly to the specified
function as a convenience.
This function traps all uncaught exceptions, not just SqlErrors. Therefore, you will get a rollback for any exception that you don't handle. That's probably what you want anyway.
Since all operations in HDBC are done in a transaction, this function doesn't
issue an explicit "begin" to the server. You should ideally have
called commit
or rollback
before
calling this function. If you haven't, this function will commit or rollback
more than just the changes made in the included action.
If there was an error while running rollback
, this error will not be
reported since the original exception will be propogated back. (You'd probably
like to know about the root cause for all of this anyway.) Feedback
on this behavior is solicited.
sExecuteMany :: Statement -> [[Maybe String]] -> IO () #
Like executeMany
, but take a list of Maybe Strings instead of
SqlValue
s.
handleSqlError :: IO a -> IO a #
Catches SqlError
s, and re-raises them as IO errors with fail.
Useful if you don't care to catch SQL errors, but want to see a sane
error message if one happens. One would often use this as a high-level
wrapper around SQL calls.
sqlExceptions :: SqlError -> Maybe SqlError #
Given an Exception, return Just SqlError if it was an SqlError, or Nothing otherwise. Useful with functions like catchJust.
handleSql :: (SqlError -> IO a) -> IO a -> IO a #
Like catchSql
, with the order of arguments reversed.
catchSql :: IO a -> (SqlError -> IO a) -> IO a #
Execute the given IO action.
If it raises a SqlError
, then execute the supplied handler and return its
return value. Otherwise, proceed as normal.
withWConn :: ConnWrapper -> (forall conn. IConnection conn => conn -> b) -> b #
Unwrap a ConnWrapper
and pass the embedded IConnection
to
a function. Example:
withWConn wrapped run $ "SELECT * from foo where bar = 1" []
class IConnection conn where #
Main database handle object.
An IConnection
object is created by specific functions in the module for an
individual database. That is, the connect function -- which creates
this object -- is not standardized through the HDBC interface.
A connection is closed by a call to disconnect
.
A call to commit
is required to make sure that your changes get committed
to the database. In other words, HDBC has no support for autocommit, which
we consider an outdated notion.
disconnect, commit, rollback, run, prepare, clone, hdbcDriverName, hdbcClientVer, proxiedClientName, proxiedClientVer, dbServerVer, dbTransactionSupport, getTables, describeTable
disconnect :: conn -> IO () #
Disconnect from the remote database.
You do not need to explicitly close an IConnection object, but you may do so if
you so desire. If you don't, the object will disconnect from the database
in a sane way when it is garbage-collected. However, a disconnection may
raise an error, so you are encouraged to explicitly call disconnect
. Also,
garbage collection may not run when the program terminates, and some databases
really like an explicit disconnect.
So, bottom line is, you're best off calling disconnect
directly, but the
world won't end if you forget.
This function discards any data not committed already. Database driver
implementators should explicitly call rollback
if their databases don't
do this automatically on disconnect.
Bad Things (TM) could happen if you call this while you have Statement
s
active. In more precise language, the results in such situations are undefined
and vary by database. So don't do it.
Commit any pending data to the database.
Required to make any changes take effect.
runRaw :: conn -> String -> IO () #
Execute an SQL string, which may contain multiple queries. This is intended for situations where you need to run DML or DDL queries and aren't interested in results.
prepare :: conn -> String -> IO Statement #
Prepares a statement for execution.
Question marks in the statement will be replaced by
positional parameters in a later call to execute
.
Please note that, depending on the database
and the driver, errors in your SQL may be raised
either here or by execute
. Make sure you
handle exceptions both places if necessary.
Create a new Connection
object, pointed at the same
server as this object is. This will generally establish
a separate physical connection.
When you wish to establish multiple connections to a single server, the correct way to do so is to establish the first connection with the driver-specific connection function, and then clone it for each additional connection.
This can be important when a database doesn't provide much thread support itself, and the HDBC driver module must serialize access to a particular database.
This can also be a handy utility function whenever you need a separate connection to whatever database you are connected to already.
hdbcDriverName :: conn -> String #
The name of the HDBC driver module for this connection. Ideally would be the same as the database name portion of the Cabal package name. For instance, "sqlite3" or "odbc". This is the layer that is bound most tightly to HDBC.
hdbcClientVer :: conn -> String #
The version of the C (or whatever) client library that the HDBC driver module is bound to. The meaning of this is driver-specific. For an ODBC or similar proxying driver, this should be the version of the ODBC library, not the eventual DB client driver.
proxiedClientName :: conn -> String #
In the case of a system such as ODBC, the name of
the database client/server in use, if available.
For others,
identical to hdbcDriverName
.
proxiedClientVer :: conn -> String #
In the case of a system such as ODBC, the version of
the database client in use, if available. For others,
identical to hdbcClientVer
. This is the next layer
out past the HDBC driver.
dbServerVer :: conn -> String #
The version of the database server, if available.
dbTransactionSupport :: conn -> Bool #
Whether or not the current database supports transactions.
If False, then commit
and rollback
should be expected
to raise errors.
MySQL is the only commonly-used database that is known to not support transactions entirely. Please see the MySQL notes in the ODBC driver for more information.
getTables :: conn -> IO [String] #
The names of all tables accessible by the current connection, excluding special meta-tables (system tables).
You should expect this to be returned in the same manner
as a result from fetchAllRows'
.
All results should be converted to lowercase for you before you see them.
describeTable :: conn -> String -> IO [(String, SqlColDesc)] #
Obtain information about the columns in a specific table. The String in the result set is the column name.
You should expect this to be returned in the same manner
as a result from fetchAllRows'
.
All results should be converted to lowercase for you before you see them.
Instances
data ConnWrapper where #
Sometimes, it is annoying to use typeclasses with Haskell's type system. In those situations, you can use a ConnWrapper. You can create one with:
let wrapped = ConnWrapper iconn
You can then use this directly, since a ConnWrapper is also an
IConnection
. However, you will not be able to use private database
functions on it.
Or, you can use withWConn
.
Instances
IConnection ConnWrapper | |
Defined in Database.HDBC.Types disconnect :: ConnWrapper -> IO () # commit :: ConnWrapper -> IO () # rollback :: ConnWrapper -> IO () # runRaw :: ConnWrapper -> String -> IO () # run :: ConnWrapper -> String -> [SqlValue] -> IO Integer # prepare :: ConnWrapper -> String -> IO Statement # clone :: ConnWrapper -> IO ConnWrapper # hdbcDriverName :: ConnWrapper -> String # hdbcClientVer :: ConnWrapper -> String # proxiedClientName :: ConnWrapper -> String # proxiedClientVer :: ConnWrapper -> String # dbServerVer :: ConnWrapper -> String # dbTransactionSupport :: ConnWrapper -> Bool # getTables :: ConnWrapper -> IO [String] # describeTable :: ConnWrapper -> String -> IO [(String, SqlColDesc)] # |
The main HDBC exception object. As much information as possible is passed from the database through to the application through this object.
Errors generated in the Haskell layer will have seNativeError set to -1.
SqlError | |
|
Instances
Eq SqlError | |
Read SqlError | |
Show SqlError | |
Exception SqlError | |
Defined in Database.HDBC.Statement toException :: SqlError -> SomeException # fromException :: SomeException -> Maybe SqlError # displayException :: SqlError -> String # |
posixToSql :: POSIXTime -> SqlValue #
fromSql :: Convertible SqlValue a => SqlValue -> a #
safeFromSql :: Convertible SqlValue a => SqlValue -> ConvertResult a #
Conversions to and from SqlValue
s and standard Haskell types.
This function converts from an SqlValue
to a Haskell value. Many people will use the simpler
fromSql
instead. This function is simply a restricted-type wrapper around
safeConvert
.
toSql :: Convertible a SqlValue => a -> SqlValue #
SqlValue
is the main type for expressing Haskell values to SQL databases.
INTRODUCTION TO SQLVALUE
This type is used to marshall Haskell data to and from database APIs. HDBC driver interfaces will do their best to use the most accurate and efficient way to send a particular value to the database server.
Values read back from the server are constructed with the most appropriate SqlValue
constructor. fromSql
or safeFromSql
can then be used to convert them into whatever type
is needed locally in Haskell.
Most people will use toSql
and fromSql
instead of manipulating
SqlValue
s directly.
EASY CONVERSIONS BETWEEN HASKELL TYPES
Conversions are powerful; for instance, you can call fromSql
on a SqlInt32
and get a String or a Double out of it. This class attempts to Do
The Right Thing whenever possible, and will raise an error when asked to
do something incorrect. In particular, when converting to any type
except a Maybe, SqlNull
as the input will cause an error to be raised.
Conversions are implemented in terms of the Data.Convertible module, part of the
convertible package. You can refer to its documentation, and import that module,
if you wish to parse the Left result from safeFromSql
yourself, or write your
own conversion instances.
Here are some notes about conversion:
- Fractions of a second are not preserved on time values
- There is no
safeToSql
becausetoSql
never fails.
See also toSql
, safeFromSql
, fromSql
, nToSql
, iToSql
, posixToSql
.
ERROR CONDITIONS
There may sometimes be an error during conversion. For instance, if you have a
SqlString
and are attempting to convert it to an Integer, but it doesn't parse as
an Integer, you will get an error. This will be indicated as an exception if using
fromSql
, or a Left result if using safeFromSql
.
SPECIAL NOTE ON POSIXTIME
Note that a NominalDiffTime
or POSIXTime
is converted to SqlDiffTime
by
toSql
. HDBC cannot differentiate between NominalDiffTime
and POSIXTime
since they are the same underlying type. You must construct SqlPOSIXTime
manually or via posixToSql
, or use SqlUTCTime
.
DETAILS ON SQL TYPES
HDBC database backends are expected to marshal date and time data back and forth using the appropriate representation for the underlying database engine. Databases such as PostgreSQL with builtin date and time types should see automatic conversion between these Haskell types to database types. Other databases will be presented with an integer or a string. Care should be taken to use the same type on the Haskell side as you use on the database side. For instance, if your database type lacks timezone information, you ought not to use ZonedTime, but instead LocalTime or UTCTime. Database type systems are not always as rich as Haskell. For instance, for data stored in a TIMESTAMP WITHOUT TIME ZONE column, HDBC may not be able to tell if it is intended as UTCTime or LocalTime data, and will happily convert it to both, upon your request. It is your responsibility to ensure that you treat timezone issues with due care.
This behavior also exists for other types. For instance, many databases do not have a Rational type, so they will just use the show function and store a Rational as a string.
The conversion between Haskell types and database types is complex, and generic code in HDBC or its backends cannot possibly accomodate every possible situation. In some cases, you may be best served by converting your Haskell type to a String, and passing that to the database.
UNICODE AND BYTESTRINGS
Beginning with HDBC v2.0, interactions with a database are presumed to occur in UTF-8.
To accomplish this, whenever a ByteString must be converted to or from a String,
the ByteString is assumed to be in UTF-8 encoding, and will be decoded or encoded
as appropriate. Database drivers will generally present text or string data they have
received from the database as a SqlValue holding a ByteString, which fromSql
will
automatically convert to a String, and thus automatically decode UTF-8, when
you need it. In the other direction, database drivers will generally convert
a SqlString
to a ByteString in UTF-8 encoding before passing it to the
database engine.
If you are handling some sort of binary data that is not in UTF-8, you can of course work with the ByteString directly, which will bypass any conversion.
Due to lack of support by database engines, lazy ByteStrings are not passed to database
drivers. When you use toSql
on a lazy ByteString, it will be converted to a strict
ByteString for storage. Similarly, fromSql
will convert a strict ByteString to
a lazy ByteString if you demand it.
EQUALITY OF SQLVALUE
Two SqlValues are considered to be equal if one of these hold. The first comparison that can be made is controlling; if none of these comparisons can be made, then they are not equal:
- Both are NULL
- Both represent the same type and the encapsulated values are considered equal by applying (==) to them
- The values of each, when converted to a string, are equal
STRING VERSIONS OF TIMES
Default string representations are given as comments below where such are non-obvious.
These are used for fromSql
when a String
is desired. They are also defaults for
representing data to SQL backends, though individual backends may override them
when a different format is demanded by the underlying database. Date and time formats
use ISO8601 date format, with HH:MM:SS added for time, and -HHMM added for timezone
offsets.
DEPRECATED CONSTRUCTORS
SqlEpochTime
and SqlTimeDiff
are no longer created automatically by any
toSql
or fromSql
functions or database backends. They may still be manually
constructed, but are
expected to be removed in a future version. Although these two constructures will
be removed, support for marshalling to and from the old System.Time data will be
maintained as long as System.Time is, simply using the newer data types for conversion.
SqlString String | |
SqlByteString ByteString | |
SqlWord32 Word32 | |
SqlWord64 Word64 | |
SqlInt32 Int32 | |
SqlInt64 Int64 | |
SqlInteger Integer | |
SqlChar Char | |
SqlBool Bool | |
SqlDouble Double | |
SqlRational Rational | |
SqlLocalDate Day | Local YYYY-MM-DD (no timezone). |
SqlLocalTimeOfDay TimeOfDay | Local HH:MM:SS (no timezone). |
SqlZonedLocalTimeOfDay TimeOfDay TimeZone | Local HH:MM:SS -HHMM. Converts to and from (TimeOfDay, TimeZone). |
SqlLocalTime LocalTime | Local YYYY-MM-DD HH:MM:SS (no timezone). |
SqlZonedTime ZonedTime | Local YYYY-MM-DD HH:MM:SS -HHMM. Considered equal if both convert to the same UTC time. |
SqlUTCTime UTCTime | UTC YYYY-MM-DD HH:MM:SS. |
SqlDiffTime NominalDiffTime | Calendar diff between seconds. Rendered as Integer when converted to String, but greater precision may be preserved for other types or to underlying database. |
SqlPOSIXTime POSIXTime | Time as seconds since midnight Jan 1 1970 UTC. Integer rendering as for |
SqlEpochTime Integer | DEPRECATED Representation of ClockTime or CalendarTime. Use SqlPOSIXTime instead. |
SqlTimeDiff Integer | DEPRECATED Representation of TimeDiff. Use SqlDiffTime instead. |
SqlNull | NULL in SQL or Nothing in Haskell. |
Instances
data SqlColDesc #
The description of a column.
Fields are Nothing if the database backend cannot supply the requested information.
The colSize field works like this:
For character types, the maximum width of the column. For numeric types, the total number of digits allowed. See the ODBC manual for more.
The colOctetLength field is defined for character and binary types, and gives the number of bytes the column requires, regardless of encoding.
SqlColDesc | |
|
Instances
Eq SqlColDesc | |
Defined in Database.HDBC.ColTypes (==) :: SqlColDesc -> SqlColDesc -> Bool # (/=) :: SqlColDesc -> SqlColDesc -> Bool # | |
Read SqlColDesc | |
Defined in Database.HDBC.ColTypes readsPrec :: Int -> ReadS SqlColDesc # readList :: ReadS [SqlColDesc] # readPrec :: ReadPrec SqlColDesc # readListPrec :: ReadPrec [SqlColDesc] # | |
Show SqlColDesc | |
Defined in Database.HDBC.ColTypes showsPrec :: Int -> SqlColDesc -> ShowS # show :: SqlColDesc -> String # showList :: [SqlColDesc] -> ShowS # |
The type identifier for a given column.
This represents the type of data stored in the column in the underlying
SQL engine. It does not form the entire column type; see SqlColDesc
for
that.
These types correspond mainly to those defined by ODBC.
SqlCharT | Fixed-width character strings |
SqlVarCharT | Variable-width character strings |
SqlLongVarCharT | Variable-width character strings, max length implementation dependant |
SqlWCharT | Fixed-width Unicode strings |
SqlWVarCharT | Variable-width Unicode strings |
SqlWLongVarCharT | Variable-width Unicode strings, max length implementation dependant |
SqlDecimalT | Signed exact values |
SqlNumericT | Signed exact integer values |
SqlSmallIntT | 16-bit integer values |
SqlIntegerT | 32-bit integer values |
SqlRealT | |
SqlFloatT | Signed inexact floating-point values |
SqlDoubleT | Signed inexact double-precision values |
SqlBitT | A single bit |
SqlTinyIntT | 8-bit integer values |
SqlBigIntT | 64-bit integer values |
SqlBinaryT | Fixed-length binary data |
SqlVarBinaryT | Variable-length binary data |
SqlLongVarBinaryT | Variable-length binary data, max length implementation dependant |
SqlDateT | A date |
SqlTimeT | A time, no timezone |
SqlTimeWithZoneT | A time, with timezone |
SqlTimestampT | Combined date and time, no timezone |
SqlTimestampWithZoneT | Combined date and time, with timezone |
SqlUTCDateTimeT | UTC date/time |
SqlUTCTimeT | UTC time |
SqlIntervalT SqlInterval | A time or date difference |
SqlGUIDT | Global unique identifier |
SqlUnknownT String | A type not represented here; implementation-specific information in the String |
data SqlInterval #
The different types of intervals in SQL.
SqlIntervalMonthT | Difference in months |
SqlIntervalYearT | Difference in years |
SqlIntervalYearToMonthT | Difference in years+months |
SqlIntervalDayT | Difference in days |
SqlIntervalHourT | Difference in hours |
SqlIntervalMinuteT | Difference in minutes |
SqlIntervalSecondT | Difference in seconds |
SqlIntervalDayToHourT | Difference in days+hours |
SqlIntervalDayToMinuteT | Difference in days+minutes |
SqlIntervalDayToSecondT | Difference in days+seconds |
SqlIntervalHourToMinuteT | Difference in hours+minutes |
SqlIntervalHourToSecondT | Difference in hours+seconds |
SqlIntervalMinuteToSecondT | Difference in minutes+seconds |
Instances
Eq SqlInterval | |
Defined in Database.HDBC.ColTypes (==) :: SqlInterval -> SqlInterval -> Bool # (/=) :: SqlInterval -> SqlInterval -> Bool # | |
Read SqlInterval | |
Defined in Database.HDBC.ColTypes readsPrec :: Int -> ReadS SqlInterval # readList :: ReadS [SqlInterval] # readPrec :: ReadPrec SqlInterval # readListPrec :: ReadPrec [SqlInterval] # | |
Show SqlInterval | |
Defined in Database.HDBC.ColTypes showsPrec :: Int -> SqlInterval -> ShowS # show :: SqlInterval -> String # showList :: [SqlInterval] -> ShowS # |
:: IConnection conn | |
=> IO conn | Connect action to system catalog database |
-> Name | Top-level variable name which has |
-> Relation p r | Object which has |
-> Config | Configuration to generate SQL |
-> QuerySuffix | suffix SQL words |
-> String | Variable name to define as inlined query |
-> Q [Dec] | Result declarations |
Verify composed Query
and inline it in compile type.
:: IConnection conn | |
=> IO conn | Connect action to system catalog database |
-> Driver conn | Driver definition |
-> String | Schema name |
-> String | Table name |
-> [Name] | Derivings |
-> Q [Dec] | Result declaration |
Generate all HDBC templates using system catalog informations.
:: IConnection conn | |
=> IO conn | Connect action to system catalog database |
-> Driver conn | Driver definition |
-> String | Schema name |
-> String | Table name |
-> [(String, TypeQ)] | Additional column-name and column-type mapping to overwrite default |
-> [Name] | Derivings |
-> Q [Dec] | Result declaration |
Generate all HDBC templates using system catalog informations with specified config.
:: Config | Configuration to generate query with |
-> String | Schema name |
-> String | Table name |
-> [(String, TypeQ)] | List of column name and type |
-> [Name] | Derivings |
-> [Int] | Indexes to represent primary key |
-> Maybe Int | Index of not-null key |
-> Q [Dec] | Result declaration |
Generate all HDBC templates about table.
:: Config | Configuration to generate query with |
-> String | Schema name |
-> String | Table name |
-> [(String, TypeQ)] | List of column name and type |
-> [Name] | Derivings |
-> Q [Dec] | Result declaration |
Generate all HDBC templates about table except for constraint keys.
Generate all persistable templates against defined record like type constructor.
mapUpdate :: (IConnection conn, ToSql SqlValue a) => conn -> Update a -> [a] -> IO [Integer] #
Prepare and update with each parameter list.
runUpdate :: (IConnection conn, ToSql SqlValue p) => conn -> Update p -> p -> IO Integer #
Prepare update statement, bind parameters, execute statement and get execution result.
runPreparedUpdate :: ToSql SqlValue p => PreparedUpdate p -> p -> IO Integer #
Bind parameters, execute statement and get execution result.
withPrepareUpdate :: IConnection conn => conn -> Update p -> (PreparedUpdate p -> IO a) -> IO a #
Bracketed prepare operation.
prepareUpdate :: IConnection conn => conn -> Update p -> IO (PreparedUpdate p) #
Same as prepare
.
type PreparedUpdate p = PreparedStatement p () #
Typed prepared update type.
runDelete :: (IConnection conn, ToSql SqlValue p) => conn -> Delete p -> p -> IO Integer #
Prepare delete statement, bind parameters, execute statement and get execution result.
runPreparedDelete :: ToSql SqlValue p => PreparedDelete p -> p -> IO Integer #
Bind parameters, execute statement and get execution result.
withPrepareDelete :: IConnection conn => conn -> Delete p -> (PreparedDelete p -> IO a) -> IO a #
Bracketed prepare operation.
prepareDelete :: IConnection conn => conn -> Delete p -> IO (PreparedDelete p) #
Same as prepare
.
type PreparedDelete p = PreparedStatement p () #
Typed prepared delete type.
chunksInsert :: (IConnection conn, ToSql SqlValue a) => conn -> Insert a -> [a] -> IO [[Integer]] #
Deprecated. Use bulkInsert' instead of this. Prepare and insert using chunk insert statement.
bulkInsert' :: (IConnection conn, ToSql SqlValue a) => conn -> Insert a -> [a] -> IO ([Integer], [Integer]) #
Prepare and insert using chunk insert statement, with the results of insert statements.
bulkInsert :: (IConnection conn, ToSql SqlValue a) => conn -> Insert a -> [a] -> IO () #
Prepare and insert using chunk insert statement.
bulkInsertInterleave :: (IConnection conn, ToSql SqlValue a) => conn -> Insert a -> [a] -> IO ([Integer], [Integer]) #
Prepare and insert using chunk insert statement, with the Lazy-IO results of insert statements.
mapInsert :: (IConnection conn, ToSql SqlValue a) => conn -> Insert a -> [a] -> IO [Integer] #
Prepare and insert each record.
runInsert :: (IConnection conn, ToSql SqlValue a) => conn -> Insert a -> a -> IO Integer #
Prepare insert statement, bind parameters, execute statement and get execution result.
runPreparedInsert :: ToSql SqlValue a => PreparedInsert a -> a -> IO Integer #
Bind parameters, execute statement and get execution result.
prepareInsert :: IConnection conn => conn -> Insert a -> IO (PreparedInsert a) #
Same as prepare
.
type PreparedInsert a = PreparedStatement a () #
Typed prepared insert type.
runInsertQuery :: (IConnection conn, ToSql SqlValue p) => conn -> InsertQuery p -> p -> IO Integer #
Prepare insert statement, bind parameters, execute statement and get execution result.
runPreparedInsertQuery :: ToSql SqlValue p => PreparedInsertQuery p -> p -> IO Integer #
Bind parameters, execute statement and get execution result.
withPrepareInsertQuery :: IConnection conn => conn -> InsertQuery p -> (PreparedInsertQuery p -> IO a) -> IO a #
Bracketed prepare operation.
prepareInsertQuery :: IConnection conn => conn -> InsertQuery p -> IO (PreparedInsertQuery p) #
Same as prepare
.
type PreparedInsertQuery p = PreparedStatement p () #
Typed prepared insert query type.
runKeyUpdate :: (IConnection conn, ToSql SqlValue a) => conn -> KeyUpdate p a -> a -> IO Integer #
Prepare insert statement, bind parameters, execute statement and get execution result.
runPreparedKeyUpdate :: ToSql SqlValue a => PreparedKeyUpdate p a -> a -> IO Integer #
Bind parameters, execute statement and get execution result.
bindKeyUpdate :: ToSql SqlValue a => PreparedKeyUpdate p a -> a -> BoundStatement () #
Typed operation to bind parameters for PreparedKeyUpdate
type.
withPrepareKeyUpdate :: IConnection conn => conn -> KeyUpdate p a -> (PreparedKeyUpdate p a -> IO b) -> IO b #
Bracketed prepare operation.
prepareKeyUpdate :: IConnection conn => conn -> KeyUpdate p a -> IO (PreparedKeyUpdate p a) #
Same as prepare
.
data PreparedKeyUpdate p a #
Typed prepared key-update type.
:: (IConnection conn, ToSql SqlValue p, FromSql SqlValue a) | |
=> conn | Database connection |
-> Query p a | Query to get record type |
-> p | Parameter type |
-> IO [a] | Action to get records |
Prepare SQL, bind parameters, execute statement and strictly fetch all records.
:: (IConnection conn, ToSql SqlValue p, FromSql SqlValue a) | |
=> conn | Database connection |
-> Query p a | Query to get record type |
-> p | Parameter type |
-> IO [a] | Action to get records |
Lazy-IO version of runQuery'
.
:: (ToSql SqlValue p, FromSql SqlValue a) | |
=> PreparedQuery p a | Statement to bind to |
-> p | Parameter type |
-> IO [a] | Action to get records |
Bind parameters, execute statement and strictly fetch all records.
:: (ToSql SqlValue p, FromSql SqlValue a) | |
=> PreparedQuery p a | Statement to bind to |
-> p | Parameter type |
-> IO [a] | Action to get records |
Lazy-IO version of runPreparedQuery'
.
runStatement' :: FromSql SqlValue a => BoundStatement a -> IO [a] #
Execute a parameter-bounded statement and strictly fetch all records.
runStatement :: FromSql SqlValue a => BoundStatement a -> IO [a] #
Lazy-IO version of runStatement'
.
fetchUnique' :: FromSql SqlValue a => ExecutedStatement a -> IO (Maybe a) #
Fetch all records but get only first record. Expecting result records is unique. Error when records count is more than one.
listToUnique :: [a] -> IO (Maybe a) #
Fetch expecting result records is unique.
fetchUnique :: FromSql SqlValue a => ExecutedStatement a -> IO (Maybe a) #
Fetch all records but get only first record. Expecting result records is unique.
:: IConnection conn | |
=> conn | Database connection |
-> Query p a | Typed query |
-> (PreparedQuery p a -> IO b) | Body action to use prepared statement |
-> IO b | Result action |
Bracketed prepare operation.
:: IConnection conn | |
=> conn | Database connection |
-> Query p a | Typed query |
-> IO (PreparedQuery p a) | Result typed prepared query with parameter type |
Same as prepare
.
type PreparedQuery p a = PreparedStatement p a #
Typed prepared query type.
mapNoFetch :: (UntypeableNoFetch s, IConnection conn, ToSql SqlValue a) => conn -> s a -> [a] -> IO [Integer] #
Prepare and run it against each parameter list.
runNoFetch :: (UntypeableNoFetch s, IConnection conn, ToSql SqlValue a) => conn -> s a -> a -> IO Integer #
Prepare and run sequence for polymorphic no-fetch statement.
runPreparedNoFetch :: ToSql SqlValue a => PreparedStatement a () -> a -> IO Integer #
Deprecated.
executeNoFetch :: ToSql SqlValue a => PreparedStatement a () -> a -> IO Integer #
Bind parameters, execute prepared statement and get execution result.
executeBoundNoFetch :: BoundStatement () -> IO Integer #
Typed execute operation. Only get result.
executePrepared :: ToSql SqlValue p => PreparedStatement p a -> p -> IO (ExecutedStatement a) #
Deprecated.
executeBound :: BoundStatement a -> IO (ExecutedStatement a) #
Typed execute operation.
bindTo :: ToSql SqlValue p => p -> PreparedStatement p a -> BoundStatement a #
Same as bind
except for argument is flipped.
:: ToSql SqlValue p | |
=> PreparedStatement p a | Prepared query to bind to |
-> p | Parameter to bind |
-> BoundStatement a | Result parameter bound statement |
Typed operation to bind parameters. Inferred ToSql
is used.
withPrepareNoFetch :: (UntypeableNoFetch s, IConnection conn) => conn -> s p -> (PreparedStatement p () -> IO a) -> IO a #
Bracketed prepare operation.
Generalized prepare inferred from UntypeableNoFetch
instance.
:: IConnection conn | |
=> conn | Database connection |
-> String | Raw SQL String |
-> (PreparedStatement p a -> IO b) | |
-> IO b |
Bracketed prepare operation. Unsafely make Typed prepared statement.
prepareNoFetch :: (UntypeableNoFetch s, IConnection conn) => conn -> s p -> IO (PreparedStatement p ()) #
Generalized prepare inferred from UntypeableNoFetch
instance.
:: IConnection conn | |
=> conn | Database connection |
-> String | Raw SQL String |
-> IO (PreparedStatement p a) | Result typed prepared query with parameter type |
Run prepare and unsafely make Typed prepared statement.
untypePrepared :: PreparedStatement p a -> Statement #
Unsafely untype prepared statement.
data PreparedStatement p a #
Typed prepared statement type.
data BoundStatement a #
Typed prepared statement which has bound placeholder parameters.
data ExecutedStatement a #
Typed executed statement.
module Database.HDBC.Session
module Database.HDBC.Sqlite3
updateValuesByPrimary :: (HasKeyConstraint Primary ra, ToSql q ra) => ra -> [q] #
Convert like updateValuesByUnique'
using implicit RecordToSql
and ColumnConstraint
.
:: ToSql q ra | |
=> KeyConstraint Unique ra | Unique key table constraint printer function object. |
-> ra | |
-> [q] |
Convert from Haskell type ra
into database value q
list expected by update form like
UPDATE table SET c0 = ?, c1 = ?, c2 = ? ... WHERE key0 = ? AND key1 = ? AND key2 = ? ...
using printer function object infered by ToSql ra q.
valueRecordToSql :: (a -> q) -> RecordToSql q a #
Derivation rule of RecordToSql
printer function object for value convert function.
fromRecord :: ToSql q a => a -> [q] #
Run implicit RecordToSql
printer function object.
Convert from haskell type a
into list of database value type [q
].
putEmpty :: () -> ToSqlM q () #
Run RecordToSql
empty printer.
putRecord :: ToSql q a => a -> ToSqlM q () #
Run implicit RecordToSql
printer function object.
Context to convert haskell record type a
into lib of database value type [q
].
data RecordToSql q a #
RecordToSql
q
a
is data-type wrapping function
to convert from Haskell type a
into list of database value type (to send to database) [q
].
This structure is similar to printer.
While running RecordToSql
behavior is the same as list printer.
which appends list of database value type [q
] stream.
class PersistableWidth a => ToSql q a where #
ToSql
q
a
is implicit rule to derive RecordToSql
q
a
record printer function for type a
.
Generic programming (https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#generic-programming)
with default signature is available for ToSql
class,
so you can make instance like below:
{-# LANGUAGE DeriveGeneric #-} import GHC.Generics (Generic) import Database.HDBC (SqlValue) -- data Foo = Foo { ... } deriving Generic instance ToSql SqlValue Foo
To make instances of ToSql
manually,
ToSql
q
a
and RecordToSql
'q a
are composable with monadic context.
When, you have data constructor and objects like below.
data MyRecord = MyRecord Foo Bar Baz
instance ToSql SqlValue Foo where ... instance ToSql SqlValue Bar where ... instance ToSql SqlValue Baz where ...
You can get composed ToSql
implicit rule like below.
instance ToSql SqlValue MyRecord where recordToSql = recordToSql = wrapToSql $ \ (MyRecord x y z) -> do putRecord x putRecord y putRecord z
recordToSql :: RecordToSql q a #
Derived RecordToSql
printer function object.
Instances
ToSql q () | Implicit derivation rule of |
Defined in Database.Record.ToSql recordToSql :: RecordToSql q () # | |
ToSql SqlValue Customer # | |
Defined in Customer | |
ToSql SqlValue Business # | |
Defined in Business | |
ToSql SqlValue Branch # | |
Defined in Branch | |
ToSql SqlValue Account # | |
Defined in Account | |
ToSql SqlValue Department # | |
Defined in Department | |
ToSql SqlValue Employee # | |
Defined in Employee | |
ToSql SqlValue Individual # | |
Defined in Individual | |
ToSql SqlValue Officer # | |
Defined in Officer | |
ToSql SqlValue Product # | |
Defined in Product | |
ToSql SqlValue ProductType # | |
Defined in ProductType | |
ToSql SqlValue Transaction0 # | |
Defined in Transaction | |
(PersistableType q, ToSql q a) => ToSql q (Maybe a) | Implicit derivation rule of |
Defined in Database.Record.ToSql recordToSql :: RecordToSql q (Maybe a) # |
valueRecordFromSql :: (q -> a) -> RecordFromSql q a #
Derivation rule of RecordFromSql
parser function object for value convert function.
toRecord :: FromSql q a => [q] -> a #
Run implicit RecordFromSql
parser function object.
Convert from list of database value type [q
] into haskell type a
.
takeRecord :: FromSql q a => [q] -> (a, [q]) #
Run implicit RecordFromSql
parser function object.
Convert from list of database value type [q
] into haskell type a
and rest of list [q
].
data RecordFromSql q a #
RecordFromSql
q
a
is data-type wrapping function
to convert from list of database value type (to receive from database) [q
] into Haskell type a
This structure is similar to parser.
While running RecordFromSql
behavior is the same as non-fail-able parser
which parse list of database value type [q
] stream.
So, RecordFromSql
q
is Monad
and Applicative
instance like parser monad.
When, you have data constructor and objects like below.
data MyRecord = MyRecord Foo Bar Baz
foo ::RecordFromSql
SqlValue Foo foo = ... bar ::RecordFromSql
SqlValue Bar bar = ... baz ::RecordFromSql
SqlValue Baz baz = ...
You can get composed RecordFromSql
like below.
myRecord :: RecordFromSql SqlValue MyRecord myRecord = MyRecord <$> foo <*> bar <*> baz
Instances
Monad (RecordFromSql q) | |
Defined in Database.Record.FromSql (>>=) :: RecordFromSql q a -> (a -> RecordFromSql q b) -> RecordFromSql q b # (>>) :: RecordFromSql q a -> RecordFromSql q b -> RecordFromSql q b # return :: a -> RecordFromSql q a # fail :: String -> RecordFromSql q a # | |
Functor (RecordFromSql q) | |
Defined in Database.Record.FromSql fmap :: (a -> b) -> RecordFromSql q a -> RecordFromSql q b # (<$) :: a -> RecordFromSql q b -> RecordFromSql q a # | |
Applicative (RecordFromSql q) | Derived |
Defined in Database.Record.FromSql pure :: a -> RecordFromSql q a # (<*>) :: RecordFromSql q (a -> b) -> RecordFromSql q a -> RecordFromSql q b # liftA2 :: (a -> b -> c) -> RecordFromSql q a -> RecordFromSql q b -> RecordFromSql q c # (*>) :: RecordFromSql q a -> RecordFromSql q b -> RecordFromSql q b # (<*) :: RecordFromSql q a -> RecordFromSql q b -> RecordFromSql q a # |
FromSql
q
a
is implicit rule to derive RecordFromSql
q
a
record parser function against type a
.
Generic programming (https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#generic-programming)
with default signature is available for FromSql
class,
so you can make instance like below:
{-# LANGUAGE DeriveGeneric #-} import GHC.Generics (Generic) import Database.HDBC (SqlValue) -- data Foo = Foo { ... } deriving Generic instance FromSql SqlValue Foo
recordFromSql :: RecordFromSql q a #
RecordFromSql
q
a
record parser function.
Instances
derivedWidth :: PersistableWidth a => (PersistableRecordWidth a, Int) #
Pass type parameter and inferred width value.
sqlNullValue :: PersistableType q => q #
Implicitly derived null value of database value type.
data PersistableSqlType q #
Proposition to specify type q
is database value type, contains null value
type PersistableRecordWidth a = ProductConst (Sum Int) a #
Proposition to specify width of Haskell type a
.
The width is length of database value list which is converted from Haskell type a
.
class Eq q => PersistableType q where #
Interface of derivation rule for PersistableSqlType
.
class PersistableWidth a where #
PersistableWidth
a
is implicit rule to derive PersistableRecordWidth
a
width proposition for type a
.
Generic programming (https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#generic-programming)
with default signature is available for PersistableWidth
class,
so you can make instance like below:
{-# LANGUAGE DeriveGeneric #-} import GHC.Generics (Generic) -- data Foo = Foo { ... } deriving Generic instance PersistableWidth Foo
Instances
PersistableWidth () | Inference rule of |
Defined in Database.Record.Persistable | |
PersistableWidth TableInfo | |
PersistableWidth IndexList | |
PersistableWidth IndexInfo | |
PersistableWidth Customer # | |
Defined in Customer | |
PersistableWidth Business # | |
Defined in Business | |
PersistableWidth Branch # | |
Defined in Branch | |
PersistableWidth Account # | |
Defined in Account | |
PersistableWidth Department # | |
Defined in Department | |
PersistableWidth Employee # | |
Defined in Employee | |
PersistableWidth Individual # | |
Defined in Individual | |
PersistableWidth Officer # | |
Defined in Officer | |
PersistableWidth Product # | |
Defined in Product | |
PersistableWidth ProductType # | |
Defined in ProductType | |
PersistableWidth Transaction0 # | |
Defined in Transaction | |
PersistableWidth a => PersistableWidth (Maybe a) | Inference rule of |
Defined in Database.Record.Persistable |
derivedUniqueConstraint :: HasKeyConstraint Primary r => UniqueConstraint r #
Inferred UniqueConstraint
proof object.
Record type r
has unique key which is derived r
has primary key.
derivedCompositePrimary :: HasColumnConstraint Primary r => PrimaryConstraint r #
Inferred PrimaryConstraint
proof object.
Record type r
has composite primary key which is derived r
has single column primary key.
deriveComposite :: ColumnConstraint c r -> KeyConstraint c r #
Derivation rule for KeyConstraint
. Derive from ColumnConstraint
.
derivedNotNullColumnConstraint :: HasColumnConstraint Primary r => NotNullColumnConstraint r #
Inferred NotNullColumnConstraint
proof object.
Record type r
has not-null key which is derived r
has primary key.
derivedUniqueColumnConstraint :: HasColumnConstraint Primary r => UniqueColumnConstraint r #
Inferred UniqueColumnConstraint
proof object.
Record type r
has unique key which is derived r
has primary key.
notNullColumn :: PrimaryColumnConstraint r -> NotNullColumnConstraint r #
Derivation rule for NotNullColumnConstraint
. Derive NotNull from Primary.
uniqueColumn :: PrimaryColumnConstraint r -> UniqueColumnConstraint r #
Derivation rule for UniqueColumnConstraint
. Derive Unique from Primary.
data ColumnConstraint c r #
Proof object to specify table constraint
for table record type r
and constraint c
specified by a single column.
Constraint type. Not-null key.
Instances
HasColumnConstraint NotNull Customer # | |
Defined in Customer | |
HasColumnConstraint NotNull Business # | |
Defined in Business | |
HasColumnConstraint NotNull Branch # | |
Defined in Branch | |
HasColumnConstraint NotNull Account # | |
Defined in Account | |
HasColumnConstraint NotNull Department # | |
Defined in Department | |
HasColumnConstraint NotNull Employee # | |
Defined in Employee | |
HasColumnConstraint NotNull Individual # | |
Defined in Individual | |
HasColumnConstraint NotNull Officer # | |
Defined in Officer | |
HasColumnConstraint NotNull Product # | |
Defined in Product | |
HasColumnConstraint NotNull ProductType # | |
Defined in ProductType | |
HasColumnConstraint NotNull Transaction0 # | |
Defined in Transaction | |
HasColumnConstraint NotNull a => HasColumnConstraint NotNull (a, b) | Inference rule of |
Defined in Database.Record.KeyConstraint columnConstraint :: ColumnConstraint NotNull (a, b) # |
Constraint type. Primary key.
Instances
type UniqueColumnConstraint = ColumnConstraint Unique #
Specialized unique constraint.
type NotNullColumnConstraint = ColumnConstraint NotNull #
Specialized not-null constraint.
type PrimaryColumnConstraint = ColumnConstraint Primary #
Specialized primary constraint.
class HasColumnConstraint c a where #
Interface of inference rule for ColumnConstraint
proof object.
columnConstraint :: ColumnConstraint c a #
Infer ColumnConstraint
proof object.
Instances
data KeyConstraint c r #
Proof object to specify table constraint
for table record type r
and constraint c
.
Constraint is specified by composite key.
type UniqueConstraint = KeyConstraint Unique #
Specialized unique constraint.
type PrimaryConstraint = KeyConstraint Primary #
Specialized primary constraint.
class HasKeyConstraint c a where #
Interface of inference rule for KeyConstraint
proof object.
keyConstraint :: KeyConstraint c a #
Infer ColumnConstraint
proof object.
Instances
HasKeyConstraint Primary Customer # | |
Defined in Customer | |
HasKeyConstraint Primary Business # | |
Defined in Business | |
HasKeyConstraint Primary Branch # | |
Defined in Branch | |
HasKeyConstraint Primary Account # | |
Defined in Account | |
HasKeyConstraint Primary Department # | |
Defined in Department | |
HasKeyConstraint Primary Employee # | |
Defined in Employee | |
HasKeyConstraint Primary Individual # | |
Defined in Individual | |
HasKeyConstraint Primary Officer # | |
Defined in Officer | |
HasKeyConstraint Primary Product # | |
Defined in Product | |
HasKeyConstraint Primary ProductType # | |
Defined in ProductType | |
HasKeyConstraint Primary Transaction0 # | |
Defined in Transaction |
Constraint type. Not-null key.
Instances
HasColumnConstraint NotNull Customer # | |
Defined in Customer | |
HasColumnConstraint NotNull Business # | |
Defined in Business | |
HasColumnConstraint NotNull Branch # | |
Defined in Branch | |
HasColumnConstraint NotNull Account # | |
Defined in Account | |
HasColumnConstraint NotNull Department # | |
Defined in Department | |
HasColumnConstraint NotNull Employee # | |
Defined in Employee | |
HasColumnConstraint NotNull Individual # | |
Defined in Individual | |
HasColumnConstraint NotNull Officer # | |
Defined in Officer | |
HasColumnConstraint NotNull Product # | |
Defined in Product | |
HasColumnConstraint NotNull ProductType # | |
Defined in ProductType | |
HasColumnConstraint NotNull Transaction0 # | |
Defined in Transaction | |
HasColumnConstraint NotNull a => HasColumnConstraint NotNull (a, b) | Inference rule of |
Defined in Database.Record.KeyConstraint columnConstraint :: ColumnConstraint NotNull (a, b) # |
Constraint type. Primary key.
Instances
:: TableDerivable r | |
=> Key Unique r k | Unique key proof object which record type is |
-> Record c k | Unique key value to specify. |
-> UniqueRelation () c r | Result restricted |
UniqueRelation
inferred from table.
:: HasConstraintKey Primary r p | |
=> Table r |
|
-> KeyUpdate p r | Result typed |
Typed KeyUpdate
using inferred primary key.
:: Table r |
|
-> Key c r p | Key with constraint |
-> KeyUpdate p r | Result typed |
Typed KeyUpdate
using specified constraint key.
updateValuesWithKey :: ToSql q r => Pi r p -> r -> [q] #
Convert from Haskell type r
into SQL value q
list expected by update form like
UPDATE table SET c0 = ?, c1 = ?, ..., cn = ? WHERE key0 = ? AND key1 = ? AND key2 = ? ...
using derived RecordToSql
proof object.
:: HasConstraintKey Primary a p | |
=> Relation () a |
|
-> Relation p a | Result restricted |
Query restricted with inferred primary key.
:: PersistableWidth p | |
=> Key Primary a p | Primary key proof object which record type is |
-> Relation () a |
|
-> Relation p a | Result restricted |
Deprecated.
:: PersistableWidth p | |
=> Key Unique a p | Unique key proof object which record type is |
-> Relation () a |
|
-> Relation p a | Result restricted |
Query restricted with specified unique key.
:: PersistableWidth p | |
=> Pi a p | Projection path |
-> Relation () a |
|
-> Relation p a | Result restricted |
Query restricted with specified key.
:: (PersistableWidth s, Integral i, LiteralSQL i) | |
=> i | sequence number to set. expect not SQL injectable. |
-> Sequence s i | sequence table |
-> Update () |
Update statement for sequence table
:: (PersistableWidth s, Integral i, LiteralSQL i) | |
=> Config | |
-> i | sequence number to set. expect not SQL injectable. |
-> Sequence s i | sequence table |
-> Update () |
Update statement for sequence table
:: Binding r s i | |
=> (i -> r) | sequence number should be passed to proper field of record |
-> Number r i | |
-> r |
Unsafely apply sequence number. Only safe to build corresponding record type.
:: (i -> r) | sequence number should be passed to proper field of record |
-> Number r i | |
-> r |
Unsafely apply sequence number.
extractNumber :: Number r i -> i #
Get untyped sequence number.
unsafeSpecifyNumber :: Binding r s i => i -> Number r i #
Unsafely specify sequence number.
fromRelation :: Binding r s i => Relation () r -> Sequence s i #
primaryBinding :: (TableDerivable r, SequenceDerivable s i, HasConstraintKey Primary r i) => SeqBinding r s i #
Derive binding using primary key.
unsafeSpecifyBinding :: (TableDerivable r, SequenceDerivable s i) => Pi r i -> SeqBinding r s i #
Unsafely specify binding between normal-table and sequence-table.
seqRelation :: TableDerivable s => Sequence s i -> Relation () s #
Infer Relation
of sequence table
unsafeSpecifySequence :: TableDerivable s => (s -> i) -> Pi s i -> Sequence s i #
Unsafely specify sequence table.
Basic record to express sequence-table. actual sequence-table is a table which has only one column of integer type.
class TableDerivable s => SequenceDerivable s i | s -> i where #
Sequence
derivation rule
derivedSequence :: Sequence s i #
data SeqBinding r s i #
Record to express binding between normal-table and sequence-table.
class (TableDerivable r, SequenceDerivable s i) => Binding r s i | r -> s where #
binding :: SeqBinding r s i #
Sequence number type for record type r
Instances
Eq i => Eq (Number r i) | |
Ord i => Ord (Number r i) | |
Defined in Database.Relational.Sequence | |
Show i => Show (Number r i) | |
derivedDelete :: TableDerivable r => RestrictedStatement r (PlaceHolders p) -> Delete p #
Make typed Delete
from defaultConfig
, derived table and RestrictContext
deleteNoPH :: TableDerivable r => RestrictedStatement r () -> Delete () #
Make typed Delete
from defaultConfig
, derived table and RestrictContext
with no(unit) placeholder.
delete :: TableDerivable r => RestrictedStatement r (PlaceHolders p) -> Delete p #
Make typed Delete
from defaultConfig
, derived table and RestrictContext
derivedDelete' :: TableDerivable r => Config -> RestrictedStatement r (PlaceHolders p) -> Delete p #
delete' :: TableDerivable r => Config -> RestrictedStatement r (PlaceHolders p) -> Delete p #
typedDelete :: Table r -> Restriction p r -> Delete p #
Make typed Delete
from Table
and Restriction
.
typedDelete' :: Config -> Table r -> Restriction p r -> Delete p #
Make typed Delete
from Config
, Table
and Restriction
.
deleteSQL :: Config -> Table r -> Restriction p r -> String #
Make untyped delete SQL string from Table
and Restriction
.
derivedInsertQuery :: TableDerivable r => Pi r r' -> Relation p r' -> InsertQuery p #
Table type inferred InsertQuery
.
insertQuery :: TableDerivable r => Pi r r' -> Relation p r' -> InsertQuery p #
Table type inferred InsertQuery
.
typedInsertQuery :: Table r -> Pi r r' -> Relation p r' -> InsertQuery p #
Make typed InsertQuery
from columns selector Table
, Pi
and Relation
.
typedInsertQuery' :: Config -> Table r -> Pi r r' -> Relation p r' -> InsertQuery p #
Make typed InsertQuery
from columns selector Table
, Pi
and Relation
with configuration parameter.
insertValueList :: (TableDerivable r, LiteralSQL r') => Pi r r' -> [r'] -> [Insert ()] #
Make typed Insert
list from records list.
insertValueList' :: (TableDerivable r, LiteralSQL r') => Config -> Pi r r' -> [r'] -> [Insert ()] #
derivedInsertValue :: TableDerivable r => Register r (PlaceHolders p) -> Insert p #
Make typed Insert
from defaultConfig
, derived table and monadic builded Register
object.
insertValueNoPH :: TableDerivable r => Register r () -> Insert () #
Make typed Insert
from defaultConfig
, derived table and monadic builded Register
object with no(unit) placeholder.
insertValue :: TableDerivable r => Register r (PlaceHolders p) -> Insert p #
Make typed Insert
from defaultConfig
, derived table and monadic builded Register
object.
derivedInsertValue' :: TableDerivable r => Config -> Register r (PlaceHolders p) -> Insert p #
insertValue' :: TableDerivable r => Config -> Register r (PlaceHolders p) -> Insert p #
typedInsertValue :: Table r -> InsertTarget p r -> Insert p #
Make typed Insert
from Table
and monadic builded InsertTarget
object.
typedInsertValue' :: Config -> Table r -> InsertTarget p r -> Insert p #
Make typed Insert
from Config
, Table
and monadic builded InsertTarget
object.
derivedInsert :: (PersistableWidth r, TableDerivable r) => Pi r r' -> Insert r' #
Table type inferred Insert
.
insert :: (PersistableWidth r, TableDerivable r) => Pi r r' -> Insert r' #
Table type inferred Insert
.
typedInsert :: PersistableWidth r => Table r -> Pi r r' -> Insert r' #
typedInsert' :: PersistableWidth r => Config -> Table r -> Pi r r' -> Insert r' #
unsafeTypedInsert' :: String -> String -> Int -> Insert a #
Unsafely make typed Insert
from single insert and chunked insert SQL.
chunkSizeOfInsert :: Insert a -> Int #
Size to use chunked insert
untypeChunkInsert :: Insert a -> String #
Statement to use chunked insert
derivedUpdateAllColumn :: (PersistableWidth r, TableDerivable r) => RestrictedStatement r (PlaceHolders p) -> Update (r, p) #
Make typed Update
from defaultConfig
, derived table and AssignStatement
.
Update target is all column.
updateAllColumnNoPH :: (PersistableWidth r, TableDerivable r) => RestrictedStatement r () -> Update r #
Make typed Update
from defaultConfig
, derived table and AssignStatement
without placeholder other than target table columns.
Update target is all column.
updateAllColumn :: (PersistableWidth r, TableDerivable r) => RestrictedStatement r (PlaceHolders p) -> Update (r, p) #
Make typed Update
from defaultConfig
, derived table and AssignStatement
.
Update target is all column.
derivedUpdateAllColumn' :: (PersistableWidth r, TableDerivable r) => Config -> RestrictedStatement r (PlaceHolders p) -> Update (r, p) #
Make typed Update
from Config
, derived table and AssignStatement
.
Update target is all column.
updateAllColumn' :: (PersistableWidth r, TableDerivable r) => Config -> RestrictedStatement r (PlaceHolders p) -> Update (r, p) #
Make typed Update
from Config
, derived table and AssignStatement
.
Update target is all column.
typedUpdateAllColumn :: PersistableWidth r => Table r -> Restriction p r -> Update (r, p) #
Make typed Update
from Table
and Restriction
.
Update target is all column.
derivedUpdate :: TableDerivable r => AssignStatement r (PlaceHolders p) -> Update p #
Make typed Update
from defaultConfig
, derived table and AssignStatement
updateNoPH :: TableDerivable r => AssignStatement r () -> Update () #
Make typed Update
from defaultConfig
, derived table and AssignStatement
with no(unit) placeholder.
update :: TableDerivable r => AssignStatement r (PlaceHolders p) -> Update p #
Make typed Update
from defaultConfig
, derived table and AssignStatement
derivedUpdate' :: TableDerivable r => Config -> AssignStatement r (PlaceHolders p) -> Update p #
Make typed Update
from Config
, derived table and AssignStatement
update' :: TableDerivable r => Config -> AssignStatement r (PlaceHolders p) -> Update p #
Make typed Update
from Config
, derived table and AssignStatement
typedUpdate :: Table r -> UpdateTarget p r -> Update p #
Make typed Update
using defaultConfig
, Table
and UpdateTarget
.
typedUpdate' :: Config -> Table r -> UpdateTarget p r -> Update p #
Make typed Update
from Config
, Table
and UpdateTarget
.
updateSQL :: Config -> Table r -> UpdateTarget p r -> String #
Make untyped update SQL string from Table
and UpdateTarget
.
unsafeTypedUpdate :: String -> Update p #
Unsafely make typed Update
from SQL string.
derivedKeyUpdate :: TableDerivable r => Pi r p -> KeyUpdate p r #
keyUpdate :: TableDerivable r => Pi r p -> KeyUpdate p r #
typedKeyUpdateTable :: TableDerivable r => Relation () r -> Pi r p -> KeyUpdate p r #
typedKeyUpdate :: Table a -> Pi a p -> KeyUpdate p a #
relationalQuery' :: Relation p r -> QuerySuffix -> Query p r #
relationalQuerySQL :: Config -> Relation p r -> QuerySuffix -> String #
From Relation
into untyped SQL query string.
Unsafely make typed Query
from SQL string.
Query type with place-holder parameter p
and query result type a
.
Update type with key type p
and update record type a
.
Columns to update are record columns other than key columns,
So place-holder parameter type is the same as record type a
.
KeyUpdate | |
|
Update type with place-holder parameter p
.
Insert type to insert record type a
.
Insert | |
|
newtype InsertQuery p #
InsertQuery type.
Instances
UntypeableNoFetch InsertQuery | |
Defined in Database.Relational.Type untypeNoFetch :: InsertQuery p -> String # | |
Show (InsertQuery p) | Show insert SQL string. |
Defined in Database.Relational.Type showsPrec :: Int -> InsertQuery p -> ShowS # show :: InsertQuery p -> String # showList :: [InsertQuery p] -> ShowS # |
Delete type with place-holder parameter p
.
class UntypeableNoFetch (s :: * -> *) where #
Untype interface for typed no-result type statments
with single type parameter which represents place-holder parameter p
.
untypeNoFetch :: s p -> String #
Instances
UntypeableNoFetch Update | |
Defined in Database.Relational.Type untypeNoFetch :: Update p -> String # | |
UntypeableNoFetch Insert | |
Defined in Database.Relational.Type untypeNoFetch :: Insert p -> String # | |
UntypeableNoFetch InsertQuery | |
Defined in Database.Relational.Type untypeNoFetch :: InsertQuery p -> String # | |
UntypeableNoFetch Delete | |
Defined in Database.Relational.Type untypeNoFetch :: Delete p -> String # |
sqlChunksFromRecordList :: LiteralSQL r' => Config -> Table r -> Pi r r' -> [r'] -> [StringSQL] #
Make StringSQL
strings of SQL INSERT strings from records list
sqlFromInsertTarget :: Config -> Table r -> InsertTarget p r -> StringSQL #
Make StringSQL
string of SQL INSERT statement from InsertTarget
sqlChunkFromInsertTarget :: Config -> Table r -> InsertTarget p r -> (StringSQL, Int) #
Make StringSQL
string of SQL INSERT record chunk statement from InsertTarget
piRegister :: PersistableWidth r => Pi r r' -> Register r (PlaceHolders r') #
insertTarget' :: Register r (PlaceHolders p) -> InsertTarget p r #
Finalize Target
monad and generate UpdateTarget
with place-holder parameter p
.
insertTarget :: Register r () -> InsertTarget () r #
Finalize Register
monad and generate InsertTarget
.
sqlFromUpdateTarget :: Config -> Table r -> UpdateTarget p r -> StringSQL #
SQL SET clause and WHERE clause StringSQL
string from UpdateTarget
updateTargetAllColumn' :: PersistableWidth r => RestrictedStatement r (PlaceHolders p) -> UpdateTarget (r, p) r #
Finalize Restrict
monad and generate UpdateTarget
. Update target columns are all. With placefolder type p
.
updateTargetAllColumn :: PersistableWidth r => RestrictedStatement r () -> UpdateTarget r r #
Finalize Restrict
monad and generate UpdateTarget
. Update target columns are all.
liftTargetAllColumn' :: PersistableWidth r => Restriction p r -> UpdateTarget (r, p) r #
Lift Restriction
to UpdateTarget
. Update target columns are all. With placefolder type p
.
liftTargetAllColumn :: PersistableWidth r => Restriction () r -> UpdateTarget r r #
Lift Restriction
to UpdateTarget
. Update target columns are all.
updateTarget' :: AssignStatement r (PlaceHolders p) -> UpdateTarget p r #
Finalize Target
monad and generate UpdateTarget
with place-holder parameter p
.
updateTarget :: AssignStatement r () -> UpdateTarget () r #
Finalize Target
monad and generate UpdateTarget
.
sqlWhereFromRestriction :: Config -> Table r -> Restriction p r -> StringSQL #
SQL WHERE clause StringSQL
string from Restriction
.
restriction' :: RestrictedStatement r (PlaceHolders p) -> Restriction p r #
Finalize Restrict
monad and generate Restriction
with place-holder parameter p
restriction :: RestrictedStatement r () -> Restriction () r #
Finalize Restrict
monad and generate Restriction
.
data Restriction p r #
Restriction type with place-holder parameter p
and projected record type r
.
Instances
TableDerivable r => Show (Restriction p r) | Show where clause. |
Defined in Database.Relational.Effect showsPrec :: Int -> Restriction p r -> ShowS # show :: Restriction p r -> String # showList :: [Restriction p r] -> ShowS # |
data UpdateTarget p r #
UpdateTarget type with place-holder parameter p
and projected record type r
.
Instances
TableDerivable r => Show (UpdateTarget p r) | |
Defined in Database.Relational.Effect showsPrec :: Int -> UpdateTarget p r -> ShowS # show :: UpdateTarget p r -> String # showList :: [UpdateTarget p r] -> ShowS # |
data InsertTarget p r #
InsertTarget type with place-holder parameter p
and projected record type r
.
intersectAll' :: Relation p a -> Relation q a -> Relation (p, q) a infixl 8 #
Intersection of two relations with place-holder parameters. Not distinct.
intersect' :: Relation p a -> Relation q a -> Relation (p, q) a infixl 8 #
Intersection of two relations with place-holder parameters.
exceptAll' :: Relation p a -> Relation q a -> Relation (p, q) a infixl 7 #
Subtraction of two relations with place-holder parameters. Not distinct.
except' :: Relation p a -> Relation q a -> Relation (p, q) a infixl 7 #
Subtraction of two relations with place-holder parameters.
unionAll' :: Relation p a -> Relation q a -> Relation (p, q) a infixl 7 #
Union of two relations with place-holder parameters. Not distinct.
union' :: Relation p a -> Relation q a -> Relation (p, q) a infixl 7 #
Union of two relations with place-holder parameters.
intersectAll :: Relation () a -> Relation () a -> Relation () a infixl 8 #
Intersection of two relations. Not distinct.
intersect :: Relation () a -> Relation () a -> Relation () a infixl 8 #
Intersection of two relations.
exceptAll :: Relation () a -> Relation () a -> Relation () a infixl 7 #
Subtraction of two relations. Not distinct.
unionAll :: Relation () a -> Relation () a -> Relation () a infixl 7 #
Union of two relations. Not distinct.
on' :: ([JoinRestriction a b] -> Relation pc (a, b)) -> [JoinRestriction a b] -> Relation pc (a, b) infixl 8 #
Apply restriction for direct join style.
:: Relation () a | Left query to join |
-> Relation () b | Right query to join |
-> [JoinRestriction (Maybe a) (Maybe b)] | Join restrictions |
-> Relation () (Maybe a, Maybe b) | Result joined relation |
Direct full outer join.
:: Relation () a | Left query to join |
-> Relation () b | Right query to join |
-> [JoinRestriction (Maybe a) b] | Join restrictions |
-> Relation () (Maybe a, b) | Result joined relation |
Direct right outer join.
:: Relation () a | Left query to join |
-> Relation () b | Right query to join |
-> [JoinRestriction a (Maybe b)] | Join restrictions |
-> Relation () (a, Maybe b) | Result joined relation |
Direct left outer join.
:: Relation () a | Left query to join |
-> Relation () b | Right query to join |
-> [JoinRestriction a b] | Join restrictions |
-> Relation () (a, b) | Result joined relation |
Direct inner join.
:: Relation pa a | Left query to join |
-> Relation pb b | Right query to join |
-> [JoinRestriction (Maybe a) (Maybe b)] | Join restrictions |
-> Relation (pa, pb) (Maybe a, Maybe b) | Result joined relation |
Direct full outer join with place-holder parameters.
:: Relation pa a | Left query to join |
-> Relation pb b | Right query to join |
-> [JoinRestriction (Maybe a) b] | Join restrictions |
-> Relation (pa, pb) (Maybe a, b) | Result joined relation |
Direct right outer join with place-holder parameters.
:: Relation pa a | Left query to join |
-> Relation pb b | Right query to join |
-> [JoinRestriction a (Maybe b)] | Join restrictions |
-> Relation (pa, pb) (a, Maybe b) | Result joined relation |
Direct left outer join with place-holder parameters.
:: Relation pa a | Left query to join |
-> Relation pb b | Right query to join |
-> [JoinRestriction a b] | Join restrictions |
-> Relation (pa, pb) (a, b) | Result joined relation |
Direct inner join with place-holder parameters.
queryScalar :: (MonadQualify ConfigureQuery m, ScalarDegree r) => UniqueRelation () c r -> m (Record c (Maybe r)) #
Scalar sub-query.
queryScalar' :: (MonadQualify ConfigureQuery m, ScalarDegree r) => UniqueRelation p c r -> m (PlaceHolders p, Record c (Maybe r)) #
Scalar sub-query with place-holder parameter p
.
aggregatedUnique :: Relation ph r -> Pi r a -> (Record Flat a -> Record Aggregated b) -> UniqueRelation ph Flat b #
Aggregated UniqueRelation
.
uniqueRelation' :: QueryUnique (PlaceHolders p, Record c r) -> UniqueRelation p c r #
Finalize QueryUnique
monad and generate UniqueRelation
.
uniqueQueryMaybe' :: UniqueRelation p c r -> QueryUnique (PlaceHolders p, Record c (Maybe r)) #
Join unique sub-query with place-holder parameter p
. Query result is Maybe
.
uniqueQuery' :: UniqueRelation p c r -> QueryUnique (PlaceHolders p, Record c r) #
Join unique sub-query with place-holder parameter p
.
unUnique :: UniqueRelation p c r -> Relation p r #
Discard unique attribute.
unsafeUnique :: Relation p r -> UniqueRelation p c r #
Unsafely specify unique relation.
aggregateRelation :: QueryAggregate (Record Aggregated r) -> Relation () r #
Finalize QueryAggregate
monad and geneate Relation
.
aggregateRelation' :: AggregatedQuery p r -> Relation p r #
Finalize QueryAggregate
monad and geneate Relation
with place-holder parameter p
.
relation :: QuerySimple (Record Flat r) -> Relation () r #
Finalize QuerySimple
monad and generate Relation
.
relation' :: SimpleQuery p r -> Relation p r #
Finalize QuerySimple
monad and generate Relation
with place-holder parameter p
.
queryList :: MonadQualify ConfigureQuery m => Relation () r -> m (RecordList (Record c) r) #
List sub-query, for IN and EXIST.
queryList' :: MonadQualify ConfigureQuery m => Relation p r -> m (PlaceHolders p, RecordList (Record c) r) #
List sub-query, for IN and EXIST with place-holder parameter p
.
queryMaybe :: (MonadQualify ConfigureQuery m, MonadQuery m) => Relation () r -> m (Record Flat (Maybe r)) #
Join sub-query. Query result is Maybe
.
The combinations of query
and queryMaybe
express
inner joins, left outer joins, right outer joins, and full outer joins.
Here is an example of a right outer join:
outerJoin = relation $ do e <- queryMaybe employee d <- query department on $ e ?! E.deptId' .=. just (d ! D.deptId') return $ (,) |$| e |*| d
query :: (MonadQualify ConfigureQuery m, MonadQuery m) => Relation () r -> m (Record Flat r) #
Join sub-query. Query result is not Maybe
.
derivedRelation :: TableDerivable r => Relation () r #
Inferred Relation
.
data UniqueRelation p c r #
Unique relation type to compose scalar queries.
over :: SqlContext c => Record OverWindow a -> Window c () -> Record c a infix 8 #
Operator to make record of window function result using built Window
monad.
type QueryAggregate = Orderings Aggregated (Restrictings Aggregated (AggregatingSetT QueryCore)) #
Aggregated query monad type.
type AggregatedQuery p r = OrderedQuery Aggregated (Restrictings Aggregated (AggregatingSetT QueryCore)) p r #
Aggregated query type. AggregatedQuery
p r == QueryAggregate
(PlaceHolders
p, Record
Aggregated
r).
type Window c = Orderings c (PartitioningSet c) #
Partition monad type for partition-by clause.
groupingSets :: AggregatingSetList a -> AggregateKey a #
Finalize grouping set list.
cube :: AggregatingPowerSet a -> AggregateKey a #
Finalize grouping power set as cube power set.
rollup :: AggregatingPowerSet a -> AggregateKey a #
Finalize grouping power set as rollup power set.
bkey :: Record Flat r -> AggregatingPowerSet (Record Aggregated (Maybe r)) #
Specify key of rollup and cube power set.
set :: AggregatingSet a -> AggregatingSetList a #
Finalize and specify single grouping set.
key' :: AggregateKey a -> AggregatingSet a #
Specify key of single grouping set.
key :: Record Flat r -> AggregatingSet (Record Aggregated (Maybe r)) #
Specify key of single grouping set from Record.
type Assign r = Assignings r Restrict #
Target update monad type used from update statement and merge statement.
type Register r = Assignings r ConfigureQuery #
Target register monad type used from insert statement.
(<-#) :: Monad m => AssignTarget r v -> Record Flat v -> Assignings r m () infix 4 #
Add and assginment.
assignTo :: Monad m => Record Flat v -> AssignTarget r v -> Assignings r m () #
Add an assignment.
type QuerySimple = Orderings Flat QueryCore #
Simple (not-aggregated) query monad type.
type SimpleQuery p r = OrderedQuery Flat QueryCore p r #
Simple (not-aggregated) query type. SimpleQuery'
p r == QuerySimple
(PlaceHolders
p, Record
r).
data QueryUnique a #
Unique query monad type.
Instances
extractCore :: QueryCore a -> ConfigureQuery (((a, [Predicate Flat]), JoinProduct), Duplication) #
Extract QueryCore
computation.
type QueryCore = Restrictings Flat (QueryJoin ConfigureQuery) #
Core query monad type used from flat(not-aggregated) query and aggregated query.
type OrderedQuery c (m :: * -> *) p r = Orderings c m (PlaceHolders p, Record c r) #
OrderedQuery monad type with placeholder type p
. Record must be the same as Orderings
context type parameter c
.
Add descendant ordering term.
Add ascendant ordering term.
:: Monad m | |
=> Record c t | Ordering terms to add |
-> Order | Order direction |
-> Orderings c m () | Result context with ordering |
Add ordering terms.
:: Monad m | |
=> Record c t | Ordering terms to add |
-> Order | Order direction |
-> Nulls | Order of null |
-> Orderings c m () | Result context with ordering |
Add ordering terms with null ordering.
type Restrict = Restrictings Flat ConfigureQuery #
Restrict only monad type used from update statement and delete statement.
having :: MonadRestrict Aggregated m => Predicate Aggregated -> m () #
Add restriction to this aggregated query. Aggregated Record type version.
wheres :: MonadRestrict Flat m => Predicate Flat -> m () #
Add restriction to this not aggregated query.
on :: MonadQuery m => Predicate Flat -> m () #
Add restriction to last join. Record type version.
distinct :: MonadQuery m => m () #
Specify DISTINCT attribute to query context.
all' :: MonadQuery m => m () #
Specify ALL attribute to query context.
class (Functor m, Monad m) => MonadRestrict c (m :: * -> *) where #
Restrict context interface
Add restriction to this context.
Instances
MonadRestrict c m => MonadRestrict c (AggregatingSetT m) | Aggregated |
Defined in Database.Relational.Monad.Trans.Aggregating restrict :: Predicate c -> AggregatingSetT m () # | |
MonadRestrict rc m => MonadRestrict rc (Orderings c m) |
|
Defined in Database.Relational.Monad.Trans.Ordering | |
MonadRestrict c m => MonadRestrict c (Assignings r m) |
|
Defined in Database.Relational.Monad.Trans.Assigning restrict :: Predicate c -> Assignings r m () # |
class (Functor m, Monad m, MonadQualify ConfigureQuery m) => MonadQuery (m :: * -> *) where #
Query building interface.
query' :: Relation p r -> m (PlaceHolders p, Record Flat r) #
Join sub-query with place-holder parameter p
. query result is not Maybe
.
queryMaybe' :: Relation p r -> m (PlaceHolders p, Record Flat (Maybe r)) #
Join sub-query with place-holder parameter p
. Query result is Maybe
.
Instances
class (Functor q, Monad q, Functor m, Monad m) => MonadQualify (q :: * -> *) (m :: * -> *) #
Lift interface from base qualify monad.
Instances
(Functor q, Monad q) => MonadQualify q q | |
Defined in Database.Relational.Monad.Class liftQualify :: q a -> q a # | |
MonadQualify ConfigureQuery QueryUnique | |
Defined in Database.Relational.Monad.Unique liftQualify :: ConfigureQuery a -> QueryUnique a # | |
MonadQualify q m => MonadQualify q (AggregatingSetT m) | Aggregated |
Defined in Database.Relational.Monad.Trans.Aggregating liftQualify :: q a -> AggregatingSetT m a # | |
MonadQualify q m => MonadQualify q (Orderings c m) |
|
Defined in Database.Relational.Monad.Trans.Ordering liftQualify :: q a -> Orderings c m a # | |
MonadQualify q m => MonadQualify q (Assignings r m) |
|
Defined in Database.Relational.Monad.Trans.Assigning liftQualify :: q a -> Assignings r m a # |
class MonadQuery m => MonadAggregate (m :: * -> *) where #
Aggregated query building interface extends MonadQuery
.
:: Record Flat r | Record to add into group by |
-> m (Record Aggregated r) | Result context and aggregated record | Add GROUP BY term into context and get aggregated record. Non-traditional group-by version. |
Add GROUP BY term into context and get aggregated record.
:: AggregateKey (Record Aggregated r) | Key to aggretate for non-traditional group-by interface |
-> m (Record Aggregated r) | Result context and aggregated record |
Instances
MonadQuery m => MonadAggregate (AggregatingSetT m) | Aggregated query instance. |
Defined in Database.Relational.Monad.Trans.Aggregating groupBy :: Record Flat r -> AggregatingSetT m (Record Aggregated r) # groupBy' :: AggregateKey (Record Aggregated r) -> AggregatingSetT m (Record Aggregated r) # | |
MonadAggregate m => MonadAggregate (Orderings c m) |
|
Defined in Database.Relational.Monad.Trans.Ordering groupBy :: Record Flat r -> Orderings c m (Record Aggregated r) # groupBy' :: AggregateKey (Record Aggregated r) -> Orderings c m (Record Aggregated r) # |
class Monad m => MonadPartition c (m :: * -> *) where #
Window specification building interface.
partitionBy :: Record c r -> m () #
Add PARTITION BY term into context.
Instances
MonadPartition c m => MonadPartition c (Orderings c m) |
|
Defined in Database.Relational.Monad.Trans.Ordering partitionBy :: Record c r -> Orderings c m () # | |
Monad m => MonadPartition c (PartitioningSetT c m) | Partition clause instance |
Defined in Database.Relational.Monad.Trans.Aggregating partitionBy :: Record c r -> PartitioningSetT c m () # |
:: PersistableWidth a | |
=> Record c (Maybe a) | |
-> Pi a (Maybe b) | Record path. |
-> Record c (Maybe b) | Narrower projected object. |
Same as '(?!?)'. Use this operator like '(?? #foo) mayX'.
:: PersistableWidth a | |
=> Record c (Maybe a) | |
-> Pi a b | Record path |
-> Record c (Maybe b) | Narrower projected object. |
Same as '(?!)'. Use this operator like '(? #foo) mayX'.
:: (PersistableWidth a, ProjectableFlattenMaybe (Maybe b) c) | |
=> Record cont (Maybe a) | |
-> Pi a b | Projection path |
-> Record cont c | Narrower flatten and projected object. |
Get narrower record with flatten leaf phantom Maybe types along with projection path.
:: (PersistableWidth a, ProjectableFlattenMaybe (Maybe b) c) | |
=> Record cont (Maybe a) | |
-> Pi a b | Projection path |
-> Record cont c |
Get narrower record with flatten leaf phantom Maybe types along with projection path.
:: PersistableWidth a | |
=> Record c a | Source |
-> Pi a b | Record path |
-> Record c b | Narrower projected object |
Get narrower record along with projection path.
some' :: (AggregatedContext ac, SqlContext ac) => Predicate Flat -> Record ac (Maybe Bool) #
Aggregation function SOME.
any' :: (AggregatedContext ac, SqlContext ac) => Predicate Flat -> Record ac (Maybe Bool) #
Aggregation function ANY.
every :: (AggregatedContext ac, SqlContext ac) => Predicate Flat -> Record ac (Maybe Bool) #
Aggregation function EVERY.
min' :: (Ord a, AggregatedContext ac, SqlContext ac) => Record Flat a -> Record ac (Maybe a) #
Aggregation function MIN.
minMaybe :: (Ord a, AggregatedContext ac, SqlContext ac) => Record Flat (Maybe a) -> Record ac (Maybe a) #
Aggregation function MIN.
max' :: (Ord a, AggregatedContext ac, SqlContext ac) => Record Flat a -> Record ac (Maybe a) #
Aggregation function MAX.
maxMaybe :: (Ord a, AggregatedContext ac, SqlContext ac) => Record Flat (Maybe a) -> Record ac (Maybe a) #
Aggregation function MAX.
avg :: (Num a, Fractional b, AggregatedContext ac, SqlContext ac) => Record Flat a -> Record ac (Maybe b) #
Aggregation function AVG.
avgMaybe :: (Num a, Fractional b, AggregatedContext ac, SqlContext ac) => Record Flat (Maybe a) -> Record ac (Maybe b) #
Aggregation function AVG.
sum' :: (Num a, AggregatedContext ac, SqlContext ac) => Record Flat a -> Record ac (Maybe a) #
Aggregation function SUM.
sumMaybe :: (Num a, AggregatedContext ac, SqlContext ac) => Record Flat (Maybe a) -> Record ac (Maybe a) #
Aggregation function SUM.
count :: (Integral b, AggregatedContext ac, SqlContext ac) => Record Flat a -> Record ac b #
Aggregation function COUNT.
unsafeAggregateOp :: (AggregatedContext ac, SqlContext ac) => Keyword -> Record Flat a -> Record ac b #
Unsafely make aggregation uni-operator from SQL keyword.
(><) :: ProductIsoApplicative p => p a -> p b -> p (a, b) infixl 1 #
Binary operator the same as projectZip
.
projectZip :: ProductIsoApplicative p => p a -> p b -> p (a, b) #
Zipping projections.
placeholder :: (PersistableWidth t, SqlContext c, Monad m) => (Record c t -> m a) -> m (PlaceHolders t, a) #
Provide scoped placeholder and return its parameter object. Monadic version.
placeholder' :: (PersistableWidth t, SqlContext c) => (Record c t -> a) -> (PlaceHolders t, a) #
Provide scoped placeholder and return its parameter object.
pwPlaceholder :: SqlContext c => PersistableRecordWidth a -> (Record c a -> b) -> (PlaceHolders a, b) #
Provide scoped placeholder from width and return its parameter object.
unitPH :: PlaceHolders () #
No placeholder semantics. Same as unitPlaceHolder
unitPlaceHolder :: PlaceHolders () #
No placeholder semantics
unsafePlaceHolders :: PlaceHolders p #
Unsafely get placeholder parameter
unsafeAddPlaceHolders :: Functor f => f a -> f (PlaceHolders p, a) #
Unsafely add placeholder parameter to queries.
cumeDist :: Record OverWindow Double #
CUME_DIST() term.
percentRank :: Record OverWindow Double #
PERCENT_RANK() term.
rowNumber :: Integral a => Record OverWindow a #
ROW_NUMBER() term.
denseRank :: Integral a => Record OverWindow a #
DENSE_RANK() term.
rank :: Integral a => Record OverWindow a #
RANK() term.
fromMaybe :: (OperatorContext c, HasColumnConstraint NotNull r) => Record c r -> Record c (Maybe r) -> Record c r #
Operator from maybe type using record extended isNull
.
isJust :: (OperatorContext c, HasColumnConstraint NotNull r) => Record c (Maybe r) -> Predicate c #
Operator corresponding SQL NOT (... IS NULL) , and extended against record type.
isNothing :: (OperatorContext c, HasColumnConstraint NotNull r) => Record c (Maybe r) -> Predicate c #
Operator corresponding SQL IS NULL , and extended against record types.
in' :: OperatorContext c => Record c t -> RecordList (Record c) t -> Record c (Maybe Bool) infix 4 #
Binary operator corresponding SQL IN .
:: (OperatorContext c, PersistableWidth b) | |
=> Record c a | Record value to match |
-> [(Record c a, Record c (Maybe b))] | Each when clauses |
-> Record c (Maybe b) | Result record |
Null default version of case'
.
:: OperatorContext c | |
=> (Record c a, [(Record c a, Record c b)]) | Record value to match and each when clauses list |
-> Record c b | Else result record |
-> Record c b | Result record |
Uncurry version of case'
, and you can write like ... casesOrElse'
clause.
:: OperatorContext c | |
=> Record c a | Record value to match |
-> [(Record c a, Record c b)] | Each when clauses |
-> Record c b | Else result record |
-> Record c b | Result record |
Simple case operator correnponding SQL simple CASE. Like, CASE x WHEN v THEN a WHEN w THEN b ... ELSE c END
:: (OperatorContext c, PersistableWidth a) | |
=> [(Predicate c, Record c (Maybe a))] | Each when clauses |
-> Record c (Maybe a) | Result record |
Null default version of caseSearch
.
:: OperatorContext c | |
=> [(Predicate c, Record c a)] | Each when clauses |
-> Record c a | Else result record |
-> Record c a | Result record |
Same as caseSearch
, but you can write like list casesOrElse
clause.
:: OperatorContext c | |
=> [(Predicate c, Record c a)] | Each when clauses |
-> Record c a | Else result record |
-> Record c a | Result record |
Search case operator correnponding SQL search CASE. Like, CASE WHEN p0 THEN a WHEN p1 THEN b ... ELSE c END
showNumMaybe :: (SqlContext c, Num a, IsString b) => Record c (Maybe a) -> Record c (Maybe b) #
Unsafely show number into string-like type in records.
fromIntegralMaybe :: (SqlContext c, Integral a, Num b) => Record c (Maybe a) -> Record c (Maybe b) #
Number fromIntegral uni-operator.
negateMaybe :: (OperatorContext c, Num a) => Record c (Maybe a) -> Record c (Maybe a) #
Number negate uni-operator corresponding SQL -.
(?*?) :: (OperatorContext c, Num a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe a) infixl 7 #
Number operator corresponding SQL * .
(?/?) :: (OperatorContext c, Num a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe a) infixl 7 #
Number operator corresponding SQL /// .
(?-?) :: (OperatorContext c, Num a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe a) infixl 6 #
Number operator corresponding SQL - .
(?+?) :: (OperatorContext c, Num a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe a) infixl 6 #
Number operator corresponding SQL + .
showNum :: (SqlContext c, Num a, IsString b) => Record c a -> Record c b #
Unsafely show number into string-like type in records.
fromIntegral' :: (SqlContext c, Integral a, Num b) => Record c a -> Record c b #
Number fromIntegral uni-operator.
negate' :: (OperatorContext c, Num a) => Record c a -> Record c a #
Number negate uni-operator corresponding SQL -.
(.*.) :: (OperatorContext c, Num a) => Record c a -> Record c a -> Record c a infixl 7 #
Number operator corresponding SQL * .
(./.) :: (OperatorContext c, Num a) => Record c a -> Record c a -> Record c a infixl 7 #
Number operator corresponding SQL /// .
(.-.) :: (OperatorContext c, Num a) => Record c a -> Record c a -> Record c a infixl 6 #
Number operator corresponding SQL - .
(.+.) :: (OperatorContext c, Num a) => Record c a -> Record c a -> Record c a infixl 6 #
Number operator corresponding SQL + .
likeMaybe :: (OperatorContext c, IsString a, LiteralSQL a) => Record c (Maybe a) -> a -> Record c (Maybe Bool) infix 4 #
String-compare operator corresponding SQL LIKE . Maybe type version.
like :: (OperatorContext c, IsString a, LiteralSQL a) => Record c a -> a -> Record c (Maybe Bool) infix 4 #
String-compare operator corresponding SQL LIKE .
likeMaybe' :: (OperatorContext c, IsString a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe Bool) infix 4 #
String-compare operator corresponding SQL LIKE .
like' :: (OperatorContext c, IsString a) => Record c a -> Record c a -> Record c (Maybe Bool) infix 4 #
String-compare operator corresponding SQL LIKE .
(?||?) :: (OperatorContext c, IsString a) => Record c (Maybe a) -> Record c (Maybe a) -> Record c (Maybe a) infixl 5 #
Concatinate operator corresponding SQL || . Maybe type version.
(.||.) :: OperatorContext c => Record c a -> Record c a -> Record c a infixl 5 #
Concatinate operator corresponding SQL || .
exists :: OperatorContext c => RecordList (Record Exists) r -> Record c (Maybe Bool) #
Logical operator corresponding SQL EXISTS .
not' :: OperatorContext c => Record c (Maybe Bool) -> Record c (Maybe Bool) #
Logical operator corresponding SQL NOT .
or' :: OperatorContext c => Record c (Maybe Bool) -> Record c (Maybe Bool) -> Record c (Maybe Bool) infixr 2 #
Logical operator corresponding SQL OR .
and' :: OperatorContext c => Record c (Maybe Bool) -> Record c (Maybe Bool) -> Record c (Maybe Bool) infixr 3 #
Logical operator corresponding SQL AND .
(.<>.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool) infix 4 #
Compare operator corresponding SQL <> .
(.>=.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool) infix 4 #
Compare operator corresponding SQL >= .
(.>.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool) infix 4 #
Compare operator corresponding SQL > .
(.<=.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool) infix 4 #
Compare operator corresponding SQL <= .
(.<.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool) infix 4 #
Compare operator corresponding SQL < .
(.=.) :: OperatorContext c => Record c ft -> Record c ft -> Record c (Maybe Bool) infix 4 #
Compare operator corresponding SQL = .
unsafeBinOp :: SqlContext k => SqlBinOp -> Record k a -> Record k b -> Record k c #
Unsafely make binary operator for records from string binary operator.
unsafeUniOp :: SqlContext c2 => (Keyword -> Keyword) -> Record c1 a -> Record c2 b #
Unsafely make unary operator for records from SQL keyword.
Unsafely generate SQL expression string from record object.
String interface of unsafeShowSql'
.
unsafeShowSql' :: Record c a -> StringSQL #
Unsafely generate SQL expression term from record object.
values :: (LiteralSQL t, OperatorContext c) => [t] -> RecordList (Record c) t #
RecordList with polymorphic type of SQL set value from Haskell list.
valueFalse :: OperatorContext c => Record c (Maybe Bool) #
Record with polymorphic type of SQL false value.
valueTrue :: OperatorContext c => Record c (Maybe Bool) #
Record with polymorphic type of SQL true value.
value :: (LiteralSQL t, OperatorContext c) => t -> Record c t #
Generate record with polymorphic type of SQL constant values from Haskell value.
nothing :: (OperatorContext c, SqlContext c, PersistableWidth a) => Record c (Maybe a) #
Record with polymorphic phantom type of SQL null value. Semantics of comparing is unsafe.
unsafeProjectSql :: SqlContext c => String -> Record c t #
Unsafely Project single SQL string. String interface of unsafeProjectSql''
.
unsafeProjectSql' :: SqlContext c => StringSQL -> Record c t #
Unsafely Project single SQL term.
class ProjectableMaybe (p :: * -> *) where #
Interface to control Maybe
of phantom type in records.
Cast record phantom type into Maybe
.
flattenMaybe :: p (Maybe (Maybe a)) -> p (Maybe a) #
Compose nested Maybe
phantom type on record.
Instances
ProjectableMaybe PlaceHolders | Control phantom |
Defined in Database.Relational.Projectable just :: PlaceHolders a -> PlaceHolders (Maybe a) # flattenMaybe :: PlaceHolders (Maybe (Maybe a)) -> PlaceHolders (Maybe a) # | |
ProjectableMaybe (Record c) | |
class ProjectableFlattenMaybe a b where #
Interface to compose phantom Maybe
nested type.
flatten :: ProjectableMaybe p => p a -> p b #
Instances
ProjectableFlattenMaybe (Maybe a) b => ProjectableFlattenMaybe (Maybe (Maybe a)) b | Compose |
Defined in Database.Relational.Projectable flatten :: ProjectableMaybe p => p (Maybe (Maybe a)) -> p b # | |
ProjectableFlattenMaybe (Maybe a) (Maybe a) | Not |
Defined in Database.Relational.Projectable flatten :: ProjectableMaybe p => p (Maybe a) -> p (Maybe a) # |
snd' :: (PersistableWidth a, PersistableWidth b) => Pi (a, b) b #
Projection path for snd of tuple.
fst' :: (PersistableWidth a, PersistableWidth b) => Pi (a, b) a #
Projection path for fst of tuple.
tuplePi7_6' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a7 #
tuplePi7_5' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a6 #
tuplePi7_4' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a5 #
tuplePi7_3' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a4 #
tuplePi7_2' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a3 #
tuplePi7_1' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a2 #
tuplePi7_0' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6, PersistableWidth a7) => Pi (a1, a2, a3, a4, a5, a6, a7) a1 #
tuplePi6_5' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a6 #
tuplePi6_4' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a5 #
tuplePi6_3' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a4 #
tuplePi6_2' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a3 #
tuplePi6_1' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a2 #
tuplePi6_0' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5, PersistableWidth a6) => Pi (a1, a2, a3, a4, a5, a6) a1 #
tuplePi5_4' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5) => Pi (a1, a2, a3, a4, a5) a5 #
tuplePi5_3' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5) => Pi (a1, a2, a3, a4, a5) a4 #
tuplePi5_2' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5) => Pi (a1, a2, a3, a4, a5) a3 #
tuplePi5_1' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5) => Pi (a1, a2, a3, a4, a5) a2 #
tuplePi5_0' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4, PersistableWidth a5) => Pi (a1, a2, a3, a4, a5) a1 #
tuplePi4_3' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4) => Pi (a1, a2, a3, a4) a4 #
tuplePi4_2' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4) => Pi (a1, a2, a3, a4) a3 #
tuplePi4_1' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4) => Pi (a1, a2, a3, a4) a2 #
tuplePi4_0' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3, PersistableWidth a4) => Pi (a1, a2, a3, a4) a1 #
tuplePi3_2' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3) => Pi (a1, a2, a3) a3 #
tuplePi3_1' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3) => Pi (a1, a2, a3) a2 #
tuplePi3_0' :: (PersistableWidth a1, PersistableWidth a2, PersistableWidth a3) => Pi (a1, a2, a3) a1 #
tuplePi2_1' :: (PersistableWidth a1, PersistableWidth a2) => Pi (a1, a2) a2 #
tuplePi2_0' :: (PersistableWidth a1, PersistableWidth a2) => Pi (a1, a2) a1 #
Generate update SQL specified by single key.
type QuerySuffix = [Keyword] #
Type for query suffix words
list :: [p t] -> RecordList p t #
Make projected record list from Record
list.
data RecordList (p :: * -> *) t #
Projected record list type for row list.
class PersistableWidth r => TableDerivable r where #
Inference rule of Table
existence.
derivedTable :: Table r #
Instances
TableDerivable TableInfo | |
TableDerivable IndexList | |
TableDerivable IndexInfo | |
TableDerivable Customer # | |
Defined in Customer | |
TableDerivable Business # | |
Defined in Business | |
TableDerivable Branch # | |
Defined in Branch derivedTable :: Table Branch # | |
TableDerivable Account # | |
Defined in Account | |
TableDerivable Department # | |
Defined in Department | |
TableDerivable Employee # | |
Defined in Employee | |
TableDerivable Individual # | |
Defined in Individual | |
TableDerivable Officer # | |
Defined in Officer | |
TableDerivable Product # | |
Defined in Product | |
TableDerivable ProductType # | |
Defined in ProductType | |
TableDerivable Transaction0 # | |
Defined in Transaction |
sqlFromRelation :: Relation p r -> StringSQL #
SQL string from Relation
.
sqlFromRelationWith :: Relation p r -> Config -> StringSQL #
Generate SQL string from Relation
with configuration.
leftPh :: Relation (p, ()) r -> Relation p r #
Simplify placeholder type applying right identity element.
rightPh :: Relation ((), p) r -> Relation p r #
Simplify placeholder type applying left identity element.
relationWidth :: Relation p r -> PersistableRecordWidth r #
PersistableRecordWidth
of Relation
type.
untypeRelation :: Relation p r -> ConfigureQuery SubQuery #
Sub-query Qualify monad from relation.
unsafeTypeRelation :: ConfigureQuery SubQuery -> Relation p r #
Unsafely type qualified subquery into record typed relation type.
askConfig :: ConfigureQuery Config #
Read configuration.
qualifyQuery :: a -> ConfigureQuery (Qualified a) #
Get qualifyed table form query.
configureQuery :: ConfigureQuery q -> Config -> q #
Run ConfigureQuery
monad with initial state to get only result.
type ConfigureQuery = Qualify (QueryConfig Identity) #
Thin monad type for untyped structure.
Relation type with place-holder parameter p
and query result type r
.
class SqlContext c where #
Interface to project SQL terms unsafely.
unsafeProjectSqlTerms :: [StringSQL] -> Record c t #
Unsafely project from SQL expression terms.
data PlaceHolders p #
Placeholder parameter type which has real parameter type arguemnt p
.
Instances
ProjectableMaybe PlaceHolders | Control phantom |
Defined in Database.Relational.Projectable just :: PlaceHolders a -> PlaceHolders (Maybe a) # flattenMaybe :: PlaceHolders (Maybe (Maybe a)) -> PlaceHolders (Maybe a) # |
Order direction. Ascendant or Descendant.
Order of null.
data AggregateKey a #
Typeful aggregate element.
Sub-query type
Phantom typed record. Projected into Haskell record type t
.
Instances
ProjectableMaybe (Record c) | |
Show (Record c t) | |
class PersistableWidth ct => ScalarDegree ct #
Constraint which represents scalar degree.
Instances
ScalarDegree ct => ScalarDegree (Maybe ct) | |
Defined in Database.Relational.Scalar |
showConstantTermsSQL :: ShowConstantTermsSQL a => a -> [StringSQL] #
Deprecated.
showConstantTermsSQL' :: ShowConstantTermsSQL a => a -> DList StringSQL #
showLiteral :: LiteralSQL a => a -> [StringSQL] #
Convert from haskell record to SQL literal row-value.
class LiteralSQL a where #
LiteralSQL
a
is implicit rule to derive function to convert
from haskell record type a
into SQL literal row-value.
Generic programming (https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html#generic-programming)
with default signature is available for LiteralSQL
class,
so you can make instance like below:
{-# LANGUAGE DeriveGeneric #-} import GHC.Generics (Generic) -- data Foo = Foo { ... } deriving Generic instance LiteralSQL Foo
showLiteral' :: a -> DList StringSQL #
Instances
LiteralSQL TableInfo | |
Defined in Database.Relational.Schema.SQLite3Syscat.TableInfo showLiteral' :: TableInfo -> DList StringSQL # | |
LiteralSQL IndexList | |
Defined in Database.Relational.Schema.SQLite3Syscat.IndexList showLiteral' :: IndexList -> DList StringSQL # | |
LiteralSQL IndexInfo | |
Defined in Database.Relational.Schema.SQLite3Syscat.IndexInfo showLiteral' :: IndexInfo -> DList StringSQL # | |
LiteralSQL Customer # | |
LiteralSQL Business # | |
LiteralSQL Branch # | |
LiteralSQL Account # | |
LiteralSQL Department # | |
Defined in Department showLiteral' :: Department -> DList StringSQL # | |
LiteralSQL Employee # | |
LiteralSQL Individual # | |
Defined in Individual showLiteral' :: Individual -> DList StringSQL # | |
LiteralSQL Officer # | |
LiteralSQL Product # | |
LiteralSQL ProductType # | |
Defined in ProductType showLiteral' :: ProductType -> DList StringSQL # | |
LiteralSQL Transaction0 # | |
Defined in Transaction showLiteral' :: Transaction0 -> DList StringSQL # |
type ShowConstantTermsSQL = LiteralSQL #
Deprecated.
derivedUniqueKey :: HasConstraintKey Primary r ct => Key Unique r ct #
projectionKey :: Key c r ct -> Pi r ct #
Get projection path proof object from constraint Key
.
tableConstraint :: Key c r ct -> KeyConstraint c r #
Get table constraint KeyConstraint
proof object from constraint Key
.
class PersistableWidth ct => HasConstraintKey c r ct where #
Constraint Key
inference interface.
constraintKey :: Key c r ct #
Infer constraint key.
Instances
(<?.?>) :: Pi a (Maybe b) -> Pi b (Maybe c) -> Pi a (Maybe c) infixl 8 #
Compose projection path. Maybe
phantom functors are join
-ed like >=>
.
Projection path from type r0
into type r1
.
This type also indicate key object which type is r1
for record type r0
.
Instances
ProductIsoFunctor (Pi a) | Map projection path |
Defined in Database.Relational.Pi.Unsafe (|$|) :: ProductConstructor (a0 -> b) => (a0 -> b) -> Pi a a0 -> Pi a b # | |
ProductIsoApplicative (Pi a) | Compose projection path |
Defined in Database.Relational.Pi.Unsafe | |
Category Pi | |
ProductIsoEmpty (Pi a) () | |
PersistableWidth r0 => Show (Pi r0 r1) | |
data Aggregated #
Type tag for aggregated query
data OverWindow #
Type tag for window function building
Type tag for normal aggregatings set
Instances
defaultConfig :: Config #
Default configuration of Config
.
To change some behaviour of relational-query,
use record update syntax:
defaultConfig { productUnitSupport =PUSupported
, chunksInsertSize = 256 , schemaNameMode =SchemaQualified
, normalizedTableName = True , verboseAsCompilerWarning = False , disableOverloadedProjection = False , disableSpecializedProjection = False , identifierQuotation =NoQuotation
, nameConfig = defaultNameConfig { recordConfig =defaultNameConfig
, relationVarName = \schema table ->varCamelcaseName
$ table ++ "_" ++ scheme -- ^ append the table name after the schema name. e.g. "schemaTable" } }
defaultNameConfig :: NameConfig #
Default implementation of NameConfig
type.
data NameConfig #
NameConfig
type to customize names of expanded templates.
Instances
Show NameConfig | |
Defined in Database.Relational.Internal.Config showsPrec :: Int -> NameConfig -> ShowS # show :: NameConfig -> String # showList :: [NameConfig] -> ShowS # |
data ProductUnitSupport #
Unit of product is supported or not.
Instances
Show ProductUnitSupport | |
Defined in Database.Relational.Internal.Config showsPrec :: Int -> ProductUnitSupport -> ShowS # show :: ProductUnitSupport -> String # showList :: [ProductUnitSupport] -> ShowS # |
data SchemaNameMode #
Schema name qualify mode in SQL string.
SchemaQualified | Schema qualified table name in SQL string |
SchemaNotQualified | Not qualified table name in SQL string |
Instances
Eq SchemaNameMode | |
Defined in Database.Relational.Internal.Config (==) :: SchemaNameMode -> SchemaNameMode -> Bool # (/=) :: SchemaNameMode -> SchemaNameMode -> Bool # | |
Show SchemaNameMode | |
Defined in Database.Relational.Internal.Config showsPrec :: Int -> SchemaNameMode -> ShowS # show :: SchemaNameMode -> String # showList :: [SchemaNameMode] -> ShowS # |
data IdentifierQuotation #
Configuration for quotation of identifiers of SQL.
Instances
Show IdentifierQuotation | |
Defined in Database.Relational.Internal.Config showsPrec :: Int -> IdentifierQuotation -> ShowS # show :: IdentifierQuotation -> String # showList :: [IdentifierQuotation] -> ShowS # |
Configuration type.
runRelation :: (ToSql SqlValue p, IConnection conn, FromSql SqlValue a) => conn -> Relation p a -> p -> IO [a] Source #