Safe Haskell | None |
---|---|
Language | Haskell2010 |
Set of definitions exposed to the end user.
Synopsis
- data Connection
- data ConnectionStats = ConnectionStats {
- statsQueries :: !Int
- statsRows :: !Int
- statsValues :: !Int
- statsParams :: !Int
- data ConnectionSettings = ConnectionSettings {
- csConnInfo :: !Text
- csClientEncoding :: !(Maybe Text)
- csComposites :: ![Text]
- data ConnectionSourceM m
- newtype ConnectionSource (cs :: [(* -> *) -> Constraint]) = ConnectionSource {
- unConnectionSource :: forall m. MkConstraint m cs => ConnectionSourceM m
- simpleSource :: ConnectionSettings -> ConnectionSource [MonadBase IO, MonadMask]
- poolSource :: ConnectionSettings -> Int -> NominalDiffTime -> Int -> IO (ConnectionSource [MonadBase IO, MonadMask])
- data ErrorCode
- = SuccessfulCompletion
- | Warning
- | DynamicResultSetsReturned
- | ImplicitZeroBitPadding
- | NullValueEliminatedInSetFunction
- | PrivilegeNotGranted
- | PrivilegeNotRevoked
- | StringDataRightTruncation_01
- | DeprecatedFeature
- | NoData
- | NoAdditionalDynamicResultSetsReturned
- | SqlStatementNotYetComplete
- | ConnectionException
- | ConnectionDoesNotExist
- | ConnectionFailure
- | SqlclientUnableToEstablishSqlconnection
- | SqlserverRejectedEstablishmentOfSqlconnection
- | TransactionResolutionUnknown
- | ProtocolViolation
- | TriggeredActionException
- | FeatureNotSupported
- | InvalidTransactionInitiation
- | LocatorException
- | InvalidLocatorSpecification
- | InvalidGrantor
- | InvalidGrantOperation
- | InvalidRoleSpecification
- | DiagnosticsException
- | StackedDiagnosticsAccessedWithoutActiveHandler
- | CaseNotFound
- | CardinalityViolation
- | DataException
- | ArraySubscriptError
- | CharacterNotInRepertoire
- | DatetimeFieldOverflow
- | DivisionByZero
- | ErrorInAssignment
- | EscapeCharacterConflict
- | IndicatorOverflow
- | IntervalFieldOverflow
- | InvalidArgumentForLogarithm
- | InvalidArgumentForNtileFunction
- | InvalidArgumentForNthValueFunction
- | InvalidArgumentForPowerFunction
- | InvalidArgumentForWidthBucketFunction
- | InvalidCharacterValueForCast
- | InvalidDatetimeFormat
- | InvalidEscapeCharacter
- | InvalidEscapeOctet
- | InvalidEscapeSequence
- | NonstandardUseOfEscapeCharacter
- | InvalidIndicatorParameterValue
- | InvalidParameterValue
- | InvalidRegularExpression
- | InvalidRowCountInLimitClause
- | InvalidRowCountInResultOffsetClause
- | InvalidTimeZoneDisplacementValue
- | InvalidUseOfEscapeCharacter
- | MostSpecificTypeMismatch
- | NullValueNotAllowed_22
- | NullValueNoIndicatorParameter
- | NumericValueOutOfRange
- | StringDataLengthMismatch
- | StringDataRightTruncation_22
- | SubstringError
- | TrimError
- | UnterminatedCString
- | ZeroLengthCharacterString
- | FloatingPointException
- | InvalidTextRepresentation
- | InvalidBinaryRepresentation
- | BadCopyFileFormat
- | UntranslatableCharacter
- | NotAnXmlDocument
- | InvalidXmlDocument
- | InvalidXmlContent
- | InvalidXmlComment
- | InvalidXmlProcessingInstruction
- | IntegrityConstraintViolation
- | RestrictViolation
- | NotNullViolation
- | ForeignKeyViolation
- | UniqueViolation
- | CheckViolation
- | ExclusionViolation
- | InvalidCursorState
- | InvalidTransactionState
- | ActiveSqlTransaction
- | BranchTransactionAlreadyActive
- | HeldCursorRequiresSameIsolationLevel
- | InappropriateAccessModeForBranchTransaction
- | InappropriateIsolationLevelForBranchTransaction
- | NoActiveSqlTransactionForBranchTransaction
- | ReadOnlySqlTransaction
- | SchemaAndDataStatementMixingNotSupported
- | NoActiveSqlTransaction
- | InFailedSqlTransaction
- | InvalidSqlStatementName
- | TriggeredDataChangeViolation
- | InvalidAuthorizationSpecification
- | InvalidPassword
- | DependentPrivilegeDescriptorsStillExist
- | DependentObjectsStillExist
- | InvalidTransactionTermination
- | SqlRoutineException
- | FunctionExecutedNoReturnStatement
- | ModifyingSqlDataNotPermitted_2F
- | ProhibitedSqlStatementAttempted_2F
- | ReadingSqlDataNotPermitted_2F
- | InvalidCursorName
- | ExternalRoutineException
- | ContainingSqlNotPermitted
- | ModifyingSqlDataNotPermitted_38
- | ProhibitedSqlStatementAttempted_38
- | ReadingSqlDataNotPermitted_38
- | ExternalRoutineInvocationException
- | InvalidSqlstateReturned
- | NullValueNotAllowed_39
- | TriggerProtocolViolated
- | SrfProtocolViolated
- | SavepointException
- | InvalidSavepointSpecification
- | InvalidCatalogName
- | InvalidSchemaName
- | TransactionRollback
- | TransactionIntegrityConstraintViolation
- | SerializationFailure
- | StatementCompletionUnknown
- | DeadlockDetected
- | SyntaxErrorOrAccessRuleViolation
- | SyntaxError
- | InsufficientPrivilege
- | CannotCoerce
- | GroupingError
- | WindowingError
- | InvalidRecursion
- | InvalidForeignKey
- | InvalidName
- | NameTooLong
- | ReservedName
- | DatatypeMismatch
- | IndeterminateDatatype
- | CollationMismatch
- | IndeterminateCollation
- | WrongObjectType
- | UndefinedColumn
- | UndefinedFunction
- | UndefinedTable
- | UndefinedParameter
- | UndefinedObject
- | DuplicateColumn
- | DuplicateCursor
- | DuplicateDatabase
- | DuplicateFunction
- | DuplicatePreparedStatement
- | DuplicateSchema
- | DuplicateTable
- | DuplicateAlias
- | DuplicateObject
- | AmbiguousColumn
- | AmbiguousFunction
- | AmbiguousParameter
- | AmbiguousAlias
- | InvalidColumnReference
- | InvalidColumnDefinition
- | InvalidCursorDefinition
- | InvalidDatabaseDefinition
- | InvalidFunctionDefinition
- | InvalidPreparedStatementDefinition
- | InvalidSchemaDefinition
- | InvalidTableDefinition
- | InvalidObjectDefinition
- | WithCheckOptionViolation
- | InsufficientResources
- | DiskFull
- | OutOfMemory
- | TooManyConnections
- | ConfigurationLimitExceeded
- | ProgramLimitExceeded
- | StatementTooComplex
- | TooManyColumns
- | TooManyArguments
- | ObjectNotInPrerequisiteState
- | ObjectInUse
- | CantChangeRuntimeParam
- | LockNotAvailable
- | OperatorIntervention
- | QueryCanceled
- | AdminShutdown
- | CrashShutdown
- | CannotConnectNow
- | DatabaseDropped
- | SystemError
- | IoError
- | UndefinedFile
- | DuplicateFile
- | ConfigFileError
- | LockFileExists
- | FdwError
- | FdwColumnNameNotFound
- | FdwDynamicParameterValueNeeded
- | FdwFunctionSequenceError
- | FdwInconsistentDescriptorInformation
- | FdwInvalidAttributeValue
- | FdwInvalidColumnName
- | FdwInvalidColumnNumber
- | FdwInvalidDataType
- | FdwInvalidDataTypeDescriptors
- | FdwInvalidDescriptorFieldIdentifier
- | FdwInvalidHandle
- | FdwInvalidOptionIndex
- | FdwInvalidOptionName
- | FdwInvalidStringLengthOrBufferLength
- | FdwInvalidStringFormat
- | FdwInvalidUseOfNullPointer
- | FdwTooManyHandles
- | FdwOutOfMemory
- | FdwNoSchemas
- | FdwOptionNameNotFound
- | FdwReplyHandle
- | FdwSchemaNotFound
- | FdwTableNotFound
- | FdwUnableToCreateExecution
- | FdwUnableToCreateReply
- | FdwUnableToEstablishConnection
- | PlpgsqlError
- | RaiseException
- | NoDataFound
- | TooManyRows
- | InternalError
- | DataCorrupted
- | IndexCorrupted
- | UnknownErrorCode String
- data DetailedQueryError = DetailedQueryError {
- qeSeverity :: !String
- qeErrorCode :: !ErrorCode
- qeMessagePrimary :: !String
- qeMessageDetail :: !(Maybe String)
- qeMessageHint :: !(Maybe String)
- qeStatementPosition :: !(Maybe Int)
- qeInternalPosition :: !(Maybe Int)
- qeInternalQuery :: !(Maybe String)
- qeContext :: !(Maybe String)
- qeSourceFile :: !(Maybe String)
- qeSourceLine :: !(Maybe Int)
- qeSourceFunction :: !(Maybe String)
- newtype QueryError = QueryError String
- newtype HPQTypesError = HPQTypesError String
- newtype LibPQError = LibPQError String
- data ConversionError = Exception e => ConversionError {
- convColumn :: !Int
- convColumnName :: !String
- convRow :: !Int
- convError :: !e
- data ArrayItemError = Exception e => ArrayItemError {
- arrItemIndex :: !Int
- arrItemError :: !e
- data InvalidValue t = InvalidValue {
- ivValue :: t
- ivValidValues :: Maybe [t]
- data RangeError t = RangeError {}
- data ArrayDimensionMismatch = ArrayDimensionMismatch {
- arrDimExpected :: !Int
- arrDimDelivered :: !Int
- data RowLengthMismatch = RowLengthMismatch {
- lengthExpected :: !Int
- lengthDelivered :: !Int
- data AffectedRowsMismatch = AffectedRowsMismatch {
- rowsExpected :: ![(Int, Int)]
- rowsDelivered :: !Int
- data DBException = (Exception e, Show sql) => DBException {
- dbeQueryContext :: !sql
- dbeError :: !e
- type DBT m = DBT_ m m
- runDBT :: (MonadBase IO m, MonadMask m) => ConnectionSourceM m -> TransactionSettings -> DBT m a -> m a
- mapDBT :: (DBState n -> DBState m) -> (m (a, DBState m) -> n (b, DBState n)) -> DBT m a -> DBT n b
- data QueryResult t
- ntuples :: QueryResult t -> Int
- nfields :: QueryResult t -> Int
- module Data.Functor.Identity
- module Database.PostgreSQL.PQTypes.Array
- module Database.PostgreSQL.PQTypes.Class
- module Database.PostgreSQL.PQTypes.Composite
- module Database.PostgreSQL.PQTypes.Fold
- module Database.PostgreSQL.PQTypes.Format
- module Database.PostgreSQL.PQTypes.FromRow
- module Database.PostgreSQL.PQTypes.FromSQL
- module Database.PostgreSQL.PQTypes.Interval
- module Database.PostgreSQL.PQTypes.JSON
- module Database.PostgreSQL.PQTypes.Notification
- module Database.PostgreSQL.PQTypes.SQL
- module Database.PostgreSQL.PQTypes.SQL.Class
- module Database.PostgreSQL.PQTypes.SQL.Raw
- module Database.PostgreSQL.PQTypes.ToRow
- module Database.PostgreSQL.PQTypes.ToSQL
- module Database.PostgreSQL.PQTypes.Transaction
- module Database.PostgreSQL.PQTypes.Transaction.Settings
- module Database.PostgreSQL.PQTypes.Utils
- module Database.PostgreSQL.PQTypes.XML
Connection
data Connection Source #
Wrapper for hiding representation of a connection object.
data ConnectionStats Source #
Simple connection statistics.
ConnectionStats | |
|
Instances
Eq ConnectionStats Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Connection (==) :: ConnectionStats -> ConnectionStats -> Bool # (/=) :: ConnectionStats -> ConnectionStats -> Bool # | |
Ord ConnectionStats Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Connection compare :: ConnectionStats -> ConnectionStats -> Ordering # (<) :: ConnectionStats -> ConnectionStats -> Bool # (<=) :: ConnectionStats -> ConnectionStats -> Bool # (>) :: ConnectionStats -> ConnectionStats -> Bool # (>=) :: ConnectionStats -> ConnectionStats -> Bool # max :: ConnectionStats -> ConnectionStats -> ConnectionStats # min :: ConnectionStats -> ConnectionStats -> ConnectionStats # | |
Show ConnectionStats Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Connection showsPrec :: Int -> ConnectionStats -> ShowS # show :: ConnectionStats -> String # showList :: [ConnectionStats] -> ShowS # |
data ConnectionSettings Source #
ConnectionSettings | |
|
Instances
data ConnectionSourceM m Source #
Database connection supplier.
newtype ConnectionSource (cs :: [(* -> *) -> Constraint]) Source #
Wrapper for a polymorphic connection source.
ConnectionSource | |
|
simpleSource :: ConnectionSettings -> ConnectionSource [MonadBase IO, MonadMask] Source #
Default connection supplier. It establishes new
database connection each time withConnection
is called.
:: ConnectionSettings | |
-> Int | Stripe count. The number of distinct sub-pools to maintain. The smallest acceptable value is 1. |
-> NominalDiffTime | Amount of time for which an unused database connection is kept open. The smallest acceptable value is 0.5 seconds. The elapsed time before closing database connection may be a little longer than requested, as the reaper thread wakes at 1-second intervals. |
-> Int | Maximum number of database connections to keep open per stripe. The smallest acceptable value is 1. Requests for database connections will block if this limit is reached on a single stripe, even if other stripes have idle connections available. |
-> IO (ConnectionSource [MonadBase IO, MonadMask]) |
Pooled source. It uses striped pool from resource-pool package to cache established connections and reuse them.
Exceptions
SQL error code. Reference: http://www.postgresql.org/docs/devel/static/errcodes-appendix.html.
data DetailedQueryError Source #
SQL query error. Reference: description of PQresultErrorField at http://www.postgresql.org/docs/devel/static/libpq-exec.html.
DetailedQueryError | |
|
Instances
Eq DetailedQueryError Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Error (==) :: DetailedQueryError -> DetailedQueryError -> Bool # (/=) :: DetailedQueryError -> DetailedQueryError -> Bool # | |
Ord DetailedQueryError Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Error compare :: DetailedQueryError -> DetailedQueryError -> Ordering # (<) :: DetailedQueryError -> DetailedQueryError -> Bool # (<=) :: DetailedQueryError -> DetailedQueryError -> Bool # (>) :: DetailedQueryError -> DetailedQueryError -> Bool # (>=) :: DetailedQueryError -> DetailedQueryError -> Bool # max :: DetailedQueryError -> DetailedQueryError -> DetailedQueryError # min :: DetailedQueryError -> DetailedQueryError -> DetailedQueryError # | |
Show DetailedQueryError Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Error showsPrec :: Int -> DetailedQueryError -> ShowS # show :: DetailedQueryError -> String # showList :: [DetailedQueryError] -> ShowS # | |
Exception DetailedQueryError Source # | |
newtype QueryError Source #
Simple SQL query error. Thrown when there is no PGresult object corresponding to query execution.
Instances
Eq QueryError Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Error (==) :: QueryError -> QueryError -> Bool # (/=) :: QueryError -> QueryError -> Bool # | |
Ord QueryError Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Error compare :: QueryError -> QueryError -> Ordering # (<) :: QueryError -> QueryError -> Bool # (<=) :: QueryError -> QueryError -> Bool # (>) :: QueryError -> QueryError -> Bool # (>=) :: QueryError -> QueryError -> Bool # max :: QueryError -> QueryError -> QueryError # min :: QueryError -> QueryError -> QueryError # | |
Show QueryError Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Error showsPrec :: Int -> QueryError -> ShowS # show :: QueryError -> String # showList :: [QueryError] -> ShowS # | |
Exception QueryError Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Error toException :: QueryError -> SomeException # fromException :: SomeException -> Maybe QueryError # displayException :: QueryError -> String # |
newtype HPQTypesError Source #
Internal error in this library.
Instances
Eq HPQTypesError Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Error (==) :: HPQTypesError -> HPQTypesError -> Bool # (/=) :: HPQTypesError -> HPQTypesError -> Bool # | |
Ord HPQTypesError Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Error compare :: HPQTypesError -> HPQTypesError -> Ordering # (<) :: HPQTypesError -> HPQTypesError -> Bool # (<=) :: HPQTypesError -> HPQTypesError -> Bool # (>) :: HPQTypesError -> HPQTypesError -> Bool # (>=) :: HPQTypesError -> HPQTypesError -> Bool # max :: HPQTypesError -> HPQTypesError -> HPQTypesError # min :: HPQTypesError -> HPQTypesError -> HPQTypesError # | |
Show HPQTypesError Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Error showsPrec :: Int -> HPQTypesError -> ShowS # show :: HPQTypesError -> String # showList :: [HPQTypesError] -> ShowS # | |
Exception HPQTypesError Source # | |
newtype LibPQError Source #
Internal error in libpq/libpqtypes library.
Instances
Eq LibPQError Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Error (==) :: LibPQError -> LibPQError -> Bool # (/=) :: LibPQError -> LibPQError -> Bool # | |
Ord LibPQError Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Error compare :: LibPQError -> LibPQError -> Ordering # (<) :: LibPQError -> LibPQError -> Bool # (<=) :: LibPQError -> LibPQError -> Bool # (>) :: LibPQError -> LibPQError -> Bool # (>=) :: LibPQError -> LibPQError -> Bool # max :: LibPQError -> LibPQError -> LibPQError # min :: LibPQError -> LibPQError -> LibPQError # | |
Show LibPQError Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Error showsPrec :: Int -> LibPQError -> ShowS # show :: LibPQError -> String # showList :: [LibPQError] -> ShowS # | |
Exception LibPQError Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Error toException :: LibPQError -> SomeException # fromException :: SomeException -> Maybe LibPQError # displayException :: LibPQError -> String # |
data ConversionError Source #
Data conversion error. Since it's polymorphic in error type, it nicely reports arbitrarily nested conversion errors.
Exception e => ConversionError | |
|
Instances
Show ConversionError Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Error showsPrec :: Int -> ConversionError -> ShowS # show :: ConversionError -> String # showList :: [ConversionError] -> ShowS # | |
Exception ConversionError Source # | |
data ArrayItemError Source #
Array item error. Polymorphic in error type
for the same reason as ConversionError
.
Exception e => ArrayItemError | |
|
Instances
Show ArrayItemError Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Error showsPrec :: Int -> ArrayItemError -> ShowS # show :: ArrayItemError -> String # showList :: [ArrayItemError] -> ShowS # | |
Exception ArrayItemError Source # | |
data InvalidValue t Source #
"Invalid value" error for various data types.
InvalidValue | |
|
Instances
data RangeError t Source #
Range error for various data types.
Instances
data ArrayDimensionMismatch Source #
Array dimenstion mismatch error.
ArrayDimensionMismatch | |
|
Instances
data RowLengthMismatch Source #
Row length mismatch error.
RowLengthMismatch | |
|
Instances
Eq RowLengthMismatch Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Error (==) :: RowLengthMismatch -> RowLengthMismatch -> Bool # (/=) :: RowLengthMismatch -> RowLengthMismatch -> Bool # | |
Ord RowLengthMismatch Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Error compare :: RowLengthMismatch -> RowLengthMismatch -> Ordering # (<) :: RowLengthMismatch -> RowLengthMismatch -> Bool # (<=) :: RowLengthMismatch -> RowLengthMismatch -> Bool # (>) :: RowLengthMismatch -> RowLengthMismatch -> Bool # (>=) :: RowLengthMismatch -> RowLengthMismatch -> Bool # max :: RowLengthMismatch -> RowLengthMismatch -> RowLengthMismatch # min :: RowLengthMismatch -> RowLengthMismatch -> RowLengthMismatch # | |
Show RowLengthMismatch Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Error showsPrec :: Int -> RowLengthMismatch -> ShowS # show :: RowLengthMismatch -> String # showList :: [RowLengthMismatch] -> ShowS # | |
Exception RowLengthMismatch Source # | |
data AffectedRowsMismatch Source #
Affected/returned rows mismatch error.
AffectedRowsMismatch | |
|
Instances
data DBException Source #
Main exception type. All exceptions thrown by the library are additionally wrapped in this type.
(Exception e, Show sql) => DBException | |
|
Instances
Show DBException Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Exception showsPrec :: Int -> DBException -> ShowS # show :: DBException -> String # showList :: [DBException] -> ShowS # | |
Exception DBException Source # | |
Monad transformer
runDBT :: (MonadBase IO m, MonadMask m) => ConnectionSourceM m -> TransactionSettings -> DBT m a -> m a Source #
Evaluate monadic action with supplied connection source and transaction settings.
mapDBT :: (DBState n -> DBState m) -> (m (a, DBState m) -> n (b, DBState n)) -> DBT m a -> DBT n b Source #
Transform the underlying monad.
Query result
data QueryResult t Source #
Representation of a query result. Provides Functor
and Foldable
instances for data transformation and
extraction appropriately.
Instances
Functor QueryResult Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.QueryResult fmap :: (a -> b) -> QueryResult a -> QueryResult b # (<$) :: a -> QueryResult b -> QueryResult a # | |
Foldable QueryResult Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.QueryResult fold :: Monoid m => QueryResult m -> m # foldMap :: Monoid m => (a -> m) -> QueryResult a -> m # foldr :: (a -> b -> b) -> b -> QueryResult a -> b # foldr' :: (a -> b -> b) -> b -> QueryResult a -> b # foldl :: (b -> a -> b) -> b -> QueryResult a -> b # foldl' :: (b -> a -> b) -> b -> QueryResult a -> b # foldr1 :: (a -> a -> a) -> QueryResult a -> a # foldl1 :: (a -> a -> a) -> QueryResult a -> a # toList :: QueryResult a -> [a] # null :: QueryResult a -> Bool # length :: QueryResult a -> Int # elem :: Eq a => a -> QueryResult a -> Bool # maximum :: Ord a => QueryResult a -> a # minimum :: Ord a => QueryResult a -> a # sum :: Num a => QueryResult a -> a # product :: Num a => QueryResult a -> a # |
ntuples :: QueryResult t -> Int Source #
Extract number of returned tuples (rows) from query result.
nfields :: QueryResult t -> Int Source #
Extract number of returned fields (columns) from query result.
Other modules
module Data.Functor.Identity