Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Contains the SQL data types, type errors, and a few supporting functions.
Synopsis
- data Type
- = ScalarType Text
- | DomainType Text
- | EnumType Text
- | UnknownType
- | ArrayType Type
- | NamedCompositeType Text
- | CompositeType [(Text, TypeExtra)]
- | TrefType [((Text, Text), TypeExtra)]
- | AnonymousCompositeType [Type]
- | Pseudo PseudoType
- data TypeExtra = TypeExtra {
- teType :: Type
- tePrecision :: Maybe Int
- teScale :: Maybe Int
- teNullable :: Bool
- data PseudoType
- data TypeError
- = NoMatchingOperator Text [Type]
- | AmbiguousOperator Text [Type]
- | TypelessEmptyArray
- | IncompatibleTypeSet [Type]
- | IncompatibleTypes Type Type
- | WrongNumberOfColumns
- | WrongTypes Type [Type]
- | IncompatibleUnionTypes Type Type
- | TypeAlreadyExists Type
- | SchemaAlreadyExists Text
- | BadCatalogUpdate Text
- | UnrecognisedRelation (Text, Text)
- | DomainDefNotFound Type
- | TypeNotKnown Type
- | UnknownTypeName Text
- | UnrecognisedIdentifier Text
- | UnrecognisedCorrelationName Text
- | SchemadColumnName Text
- | DbSchemadColumnName Text
- | BadStarExpand
- | InternalError String
- | AmbiguousIdentifier Text
- | OdbcFuncBadContent
- | DuplicateColumnName Text
- | TooManyColumnsInInsert
SQL types
Standard types of things. This covers all the usual postgres types plus some extra ones added for use by the hssqlppp typechecker
ScalarType Text | basic type of a scalar value. These are either built in types in postgres, or implemented in C or similar |
DomainType Text | a domain type is used for a constraint on a table column which would used on multiple columns on a table or in multiple tables, using a domain type is a way of just writing the constraint once |
EnumType Text | enum type, not really supported in hssqlppp yet |
UnknownType | String literals in postgres have an unknown type. The effective type is determined using what seems to amount to some simple ad hoc rules based on the context of the string literal. Hssqlppp also treats ? placeholders and nulls the same way, so they have UnknownType, not sure how closely this matches postgres |
ArrayType Type | postgres automatically creates an array type for every scalar type (plus some other types?) If there is no array type for a type in the catalog, then you can't work with arrays of that type |
NamedCompositeType Text | refer to composite type in catalog by name. not sure if this needs to exist along with CompositeType |
CompositeType [(Text, TypeExtra)] | refer to composite type by structure |
TrefType [((Text, Text), TypeExtra)] | CompositeTypeExtra [(Text,TypeExtra)] | hack to support the environment for a tref |
AnonymousCompositeType [Type] | the fields are anonymous as well as the type itself |
Pseudo PseudoType | The pseudo type is used for types which only appear as argument or return types in function definitions and/or are used only in plpgsql and not regular sql. hssqlppp also follows this usage for the types used in hssqlppp which don't have an exact counterpart in postgres |
Instances
Eq Type Source # | |
Data Type Source # | |
Defined in Database.HsSqlPpp.Internals.TypesInternal gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Type -> c Type # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Type # dataTypeOf :: Type -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Type) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Type) # gmapT :: (forall b. Data b => b -> b) -> Type -> Type # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r # gmapQ :: (forall d. Data d => d -> u) -> Type -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> Type -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> Type -> m Type # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Type -> m Type # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Type -> m Type # | |
Ord Type Source # | |
Show Type Source # | |
Quick fix to add precision and nullable information to the annotation types. This approach should be revisited, maybe this information should be in the Type type?
Instances
Eq TypeExtra Source # | |
Data TypeExtra Source # | |
Defined in Database.HsSqlPpp.Internals.TypesInternal gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TypeExtra -> c TypeExtra # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TypeExtra # toConstr :: TypeExtra -> Constr # dataTypeOf :: TypeExtra -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TypeExtra) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeExtra) # gmapT :: (forall b. Data b => b -> b) -> TypeExtra -> TypeExtra # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TypeExtra -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TypeExtra -> r # gmapQ :: (forall d. Data d => d -> u) -> TypeExtra -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TypeExtra -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TypeExtra -> m TypeExtra # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TypeExtra -> m TypeExtra # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TypeExtra -> m TypeExtra # | |
Ord TypeExtra Source # | |
Defined in Database.HsSqlPpp.Internals.TypesInternal | |
Show TypeExtra Source # | |
data PseudoType Source #
Pseudo types: mainly used for the argument and return types of functions. The weird undocumented types are just used to represent functions with those types which are in the postgres default catalog
SetOfType Type | setof is used for set returning functions |
AnyElement | used to represent polymorphic functions, all the AnyElement parameters and the return type if AnyElement must be the same type for a given function call invocation. |
AnyArray | like AnyElement, but the type must be an array type |
AnyEnum | like AnyElement, but the type must be an enum type |
AnyNonArray | like AnyElement, but the type must be a non array type |
AnyRange | |
Any | Any drops the restriction that all the Any types must be the same type |
Record (Maybe Type) | record types are used in plpgsql for a sort of dynamic typing or rough polymorphism substitute. They can refer to values of named composite type, composite type or anonymous composite type, not sure if non composite types as well. |
Void | presumably used for the types of OLD and NEW in a trigger function. Hssqlppp will probably use the Record type above for these. | TriggerRecord | Trigger | cstring - a C string | Cstring | represents the return type of a function which doesn't return anything. Not sure if it is used anywhere else |
Instances
Type errors
Instances
Eq TypeError Source # | |
Data TypeError Source # | |
Defined in Database.HsSqlPpp.Internals.TypesInternal gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> TypeError -> c TypeError # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c TypeError # toConstr :: TypeError -> Constr # dataTypeOf :: TypeError -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c TypeError) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c TypeError) # gmapT :: (forall b. Data b => b -> b) -> TypeError -> TypeError # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> TypeError -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> TypeError -> r # gmapQ :: (forall d. Data d => d -> u) -> TypeError -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> TypeError -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> TypeError -> m TypeError # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> TypeError -> m TypeError # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> TypeError -> m TypeError # | |
Ord TypeError Source # | |
Defined in Database.HsSqlPpp.Internals.TypesInternal | |
Show TypeError Source # | |