hpqtypes-1.5.3.0: Haskell bindings to libpqtypes

Safe HaskellNone
LanguageHaskell2010

Database.PostgreSQL.PQTypes

Contents

Description

Set of definitions exposed to the end user.

Synopsis

Connection

data Connection Source #

Wrapper for hiding representation of a connection object.

data ConnectionStats Source #

Simple connection statistics.

Constructors

ConnectionStats 

Fields

data ConnectionSettings Source #

Constructors

ConnectionSettings 

Fields

data ConnectionSourceM m Source #

Database connection supplier.

newtype ConnectionSource (cs :: [(* -> *) -> Constraint]) Source #

Wrapper for a polymorphic connection source.

Constructors

ConnectionSource 

Fields

simpleSource :: ConnectionSettings -> ConnectionSource [MonadBase IO, MonadMask] Source #

Default connection supplier. It establishes new database connection each time withConnection is called.

poolSource Source #

Arguments

:: 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

data ErrorCode Source #

Constructors

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 Source #

SQL query error. Reference: description of PQresultErrorField at http://www.postgresql.org/docs/devel/static/libpq-exec.html.

data ConversionError Source #

Data conversion error. Since it's polymorphic in error type, it nicely reports arbitrarily nested conversion errors.

Constructors

Exception e => ConversionError 

Fields

data ArrayItemError Source #

Array item error. Polymorphic in error type for the same reason as ConversionError.

Constructors

Exception e => ArrayItemError 

Fields

data RangeError t Source #

Range error for various data types.

Constructors

RangeError 

Fields

  • reRange :: [(t, t)]

    Allowed range (sum of acceptable ranges).

  • reValue :: t

    Provided value which is not in above range.

data DBException Source #

Main exception type. All exceptions thrown by the library are additionally wrapped in this type.

Constructors

(Exception e, Show sql) => DBException 

Fields

Monad transformer

type DBT m = DBT_ m m Source #

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 # 

Methods

fmap :: (a -> b) -> QueryResult a -> QueryResult b #

(<$) :: a -> QueryResult b -> QueryResult a #

Foldable QueryResult Source # 

Methods

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