Safe Haskell | None |
---|---|
Language | Haskell98 |
Set of definitions exposed to the end user.
- data Connection
- data ConnectionStats = ConnectionStats {
- statsQueries :: !Int
- statsRows :: !Int
- statsValues :: !Int
- statsParams :: !Int
- data ConnectionSettings = ConnectionSettings {
- csConnInfo :: !ByteString
- csClientEncoding :: !(Maybe ByteString)
- csComposites :: ![ByteString]
- data ConnectionSource
- simpleSource :: ConnectionSettings -> ConnectionSource
- poolSource :: ConnectionSettings -> Int -> NominalDiffTime -> Int -> IO ConnectionSource
- 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 = forall e . Exception e => ConversionError {
- convColumn :: !Int
- convColumnName :: !String
- convRow :: !Int
- convError :: !e
- data ArrayItemError = forall e . 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 = forall e sql . (Exception e, Show sql) => DBException {
- dbeQueryContext :: !sql
- dbeError :: !e
- data DBT m a
- runDBT :: (MonadBase IO m, MonadMask m) => ConnectionSource -> TransactionSettings -> DBT m a -> m a
- mapDBT :: (m (a, DBState) -> n (b, DBState)) -> 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.Binary
- 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 | |
|
data ConnectionSettings Source
ConnectionSettings | |
|
Eq ConnectionSettings | |
Ord ConnectionSettings | |
Show ConnectionSettings | |
Default ConnectionSettings | Default connection settings. |
data ConnectionSource Source
Database connection supplier.
simpleSource :: ConnectionSettings -> ConnectionSource Source
Default connection supplier. It estabilishes 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 |
Pooled source. It uses striped pool from resource-pool package to cache estabilished 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 | |
|
newtype QueryError Source
Simple SQL query error. Thrown when there is no PGresult object corresponding to query execution.
newtype HPQTypesError Source
Internal error in this library.
newtype LibPQError Source
Internal error in libpq/libpqtypes library.
data ConversionError Source
Data conversion error. Since it's polymorphic in error type, it nicely reports arbitrarily nested conversion errors.
forall e . Exception e => ConversionError | |
|
data ArrayItemError Source
Array item error. Polymorphic in error type
for the same reason as ConversionError
.
forall e . Exception e => ArrayItemError | |
|
data InvalidValue t Source
"Invalid value" error for various data types.
InvalidValue | |
|
Eq t => Eq (InvalidValue t) | |
Ord t => Ord (InvalidValue t) | |
Show t => Show (InvalidValue t) | |
(Show t, Typeable * t) => Exception (InvalidValue t) | |
Typeable (* -> *) InvalidValue |
data RangeError t Source
Range error for various data types.
Eq t => Eq (RangeError t) | |
Ord t => Ord (RangeError t) | |
Show t => Show (RangeError t) | |
(Show t, Typeable * t) => Exception (RangeError t) | |
Typeable (* -> *) RangeError |
data ArrayDimensionMismatch Source
Array dimenstion mismatch error.
ArrayDimensionMismatch | |
|
data RowLengthMismatch Source
Row length mismatch error.
RowLengthMismatch | |
|
data AffectedRowsMismatch Source
Affected/returned rows mismatch error.
AffectedRowsMismatch | |
|
data DBException Source
Main exception type. All exceptions thrown by the library are additionally wrapped in this type.
forall e sql . (Exception e, Show sql) => DBException | |
|
Monad transformer
Monad transformer for adding database interaction capabilities to the underlying monad.
MonadTrans DBT | |
MonadTransControl DBT | |
MonadBase b m => MonadBase b (DBT m) | |
MonadBaseControl b m => MonadBaseControl b (DBT m) | |
MonadError e m => MonadError e (DBT m) | |
MonadReader r m => MonadReader r (DBT m) | |
MonadState s m => MonadState s (DBT m) | |
MonadWriter w m => MonadWriter w (DBT m) | |
(Functor m, MonadPlus m) => Alternative (DBT m) | |
Monad m => Monad (DBT m) | |
Functor m => Functor (DBT m) | |
MonadPlus m => MonadPlus (DBT m) | |
(Monad m, Functor m) => Applicative (DBT m) | |
MonadThrow m => MonadThrow (DBT m) | |
MonadCatch m => MonadCatch (DBT m) | |
MonadMask m => MonadMask (DBT m) | |
MonadIO m => MonadIO (DBT m) | |
(MonadBase IO m, MonadMask m) => MonadDB (DBT m) | |
type StT DBT a | |
type StM (DBT m) a = ComposeSt DBT m a |
runDBT :: (MonadBase IO m, MonadMask m) => ConnectionSource -> TransactionSettings -> DBT m a -> m a Source
Evaluate monadic action with supplied connection source and transaction settings.
mapDBT :: (m (a, DBState) -> n (b, DBState)) -> DBT m a -> DBT n b Source
Transform the underlying monad.
Query result
data QueryResult t Source
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