mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2025-01-04 02:32:54 +03:00
relational-schemas: rename modules of IBMDB2.
This commit is contained in:
parent
663c59c620
commit
54984f3741
@ -33,6 +33,7 @@ extra-source-files: ChangeLog.md
|
||||
library
|
||||
exposed-modules:
|
||||
Database.Relational.Schema.DB2Syscat.Columns
|
||||
Database.Relational.Schema.IBMDB2.Columns
|
||||
Database.Relational.Schema.IBMDB2
|
||||
|
||||
Database.Relational.Schema.PgCatalog.PgAttribute
|
||||
@ -62,8 +63,9 @@ library
|
||||
Database.Relational.Schema.MySQLInfo.Config
|
||||
|
||||
other-modules:
|
||||
Database.Relational.Schema.DB2Syscat.Tabconst
|
||||
Database.Relational.Schema.DB2Syscat.Keycoluse
|
||||
Database.Relational.Schema.IBMDB2.Config
|
||||
Database.Relational.Schema.IBMDB2.Tabconst
|
||||
Database.Relational.Schema.IBMDB2.Keycoluse
|
||||
|
||||
Database.Relational.Schema.PgCatalog.PgConstraint
|
||||
Database.Relational.Schema.PgCatalog.PgNamespace
|
||||
|
@ -1,105 +1,6 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
module Database.Relational.Schema.DB2Syscat.Columns
|
||||
{-# DEPRECATED "import Database.Relational.Schema.IBMDB2.Columns instead of this module." #-} (
|
||||
module Database.Relational.Schema.IBMDB2.Columns,
|
||||
) where
|
||||
|
||||
-- |
|
||||
-- Module : Database.Relational.Schema.DB2Syscat.Columns
|
||||
-- Copyright : 2013-2017 Kei Hibino
|
||||
-- License : BSD3
|
||||
--
|
||||
-- Maintainer : ex8k.hibino@gmail.com
|
||||
-- Stability : experimental
|
||||
-- Portability : unknown
|
||||
--
|
||||
-- Generate template of SYSCAT.columns system catalog table.
|
||||
module Database.Relational.Schema.DB2Syscat.Columns where
|
||||
|
||||
import GHC.Generics (Generic)
|
||||
import Data.Int (Int16, Int32, Int64)
|
||||
import Database.Relational.TH (defineTableTypesAndRecord)
|
||||
|
||||
import Database.Relational.Schema.DB2Syscat.Config (config)
|
||||
|
||||
|
||||
$(defineTableTypesAndRecord config
|
||||
"SYSCAT" "columns"
|
||||
[
|
||||
-- column schema type length NULL
|
||||
-- ------------------------------ --------- ------------------ -------- ----- ------
|
||||
-- TABSCHEMA SYSIBM VARCHAR 128 0 No
|
||||
("tabschema", [t|String|]),
|
||||
-- TABNAME SYSIBM VARCHAR 128 0 No
|
||||
("tabname", [t|String|]),
|
||||
-- COLNAME SYSIBM VARCHAR 128 0 No
|
||||
("colname", [t|String|]),
|
||||
-- COLNO SYSIBM SMALLINT 2 0 No
|
||||
("colno", [t|Int16|]),
|
||||
-- TYPESCHEMA SYSIBM VARCHAR 128 0 No
|
||||
("typeschema", [t|String|]),
|
||||
-- TYPENAME SYSIBM VARCHAR 18 0 No
|
||||
("typename", [t|String|]),
|
||||
-- LENGTH SYSIBM INTEGER 4 0 No
|
||||
("length", [t|Int32|]),
|
||||
-- SCALE SYSIBM SMALLINT 2 0 No
|
||||
("scale", [t|Int16|]),
|
||||
-- DEFAULT SYSIBM VARCHAR 254 0 Yes
|
||||
("default", [t|Maybe String|]),
|
||||
-- NULLS SYSIBM CHARACTER 1 0 No
|
||||
("nulls", [t|String|]),
|
||||
-- CODEPAGE SYSIBM SMALLINT 2 0 No
|
||||
("codepage", [t|Int16|]),
|
||||
-- LOGGED SYSIBM CHARACTER 1 0 No
|
||||
("logged", [t|String|]),
|
||||
-- COMPACT SYSIBM CHARACTER 1 0 No
|
||||
("compact", [t|String|]),
|
||||
-- COLCARD SYSIBM BIGINT 8 0 No
|
||||
("colcard", [t|Int64|]),
|
||||
-- HIGH2KEY SYSIBM VARCHAR 254 0 Yes
|
||||
("high2key", [t|Maybe String|]),
|
||||
-- LOW2KEY SYSIBM VARCHAR 254 0 Yes
|
||||
("low2key", [t|Maybe String|]),
|
||||
-- AVGCOLLEN SYSIBM INTEGER 4 0 No
|
||||
("avgcollen", [t|Int32|]),
|
||||
-- KEYSEQ SYSIBM SMALLINT 2 0 Yes
|
||||
("keyseq", [t|Maybe Int16|]),
|
||||
-- PARTKEYSEQ SYSIBM SMALLINT 2 0 Yes
|
||||
("partkeyseq", [t|Maybe Int16|]),
|
||||
-- NQUANTILES SYSIBM SMALLINT 2 0 No
|
||||
("nquantiles", [t|Int16|]),
|
||||
-- NMOSTFREQ SYSIBM SMALLINT 2 0 No
|
||||
("nmostfreq", [t|Int16|]),
|
||||
-- NUMNULLS SYSIBM BIGINT 8 0 No
|
||||
("numnulls", [t|Int64|]),
|
||||
-- TARGET_TYPESCHEMA SYSIBM VARCHAR 128 0 Yes
|
||||
("target_typeschema", [t|Maybe String|]),
|
||||
-- TARGET_TYPENAME SYSIBM VARCHAR 18 0 Yes
|
||||
("target_typename", [t|Maybe String|]),
|
||||
-- SCOPE_TABSCHEMA SYSIBM VARCHAR 128 0 Yes
|
||||
("scope_tabschema", [t|Maybe String|]),
|
||||
-- SCOPE_TABNAME SYSIBM VARCHAR 128 0 Yes
|
||||
("scope_tabname", [t|Maybe String|]),
|
||||
-- SOURCE_TABSCHEMA SYSIBM VARCHAR 128 0 Yes
|
||||
("source_tabschema", [t|Maybe String|]),
|
||||
-- SOURCE_TABNAME SYSIBM VARCHAR 128 0 Yes
|
||||
("source_tabname", [t|Maybe String|]),
|
||||
-- DL_FEATURES SYSIBM CHARACTER 10 0 Yes
|
||||
("dl_features", [t|Maybe String|]),
|
||||
-- SPECIAL_PROPS SYSIBM CHARACTER 8 0 Yes
|
||||
("special_props", [t|Maybe String|]),
|
||||
-- HIDDEN SYSIBM CHARACTER 1 0 No
|
||||
("hidden", [t|String|]),
|
||||
-- INLINE_LENGTH SYSIBM INTEGER 4 0 No
|
||||
("inline_length", [t|Int32|]),
|
||||
-- IDENTITY SYSIBM CHARACTER 1 0 No
|
||||
("identity", [t|String|]),
|
||||
-- GENERATED SYSIBM CHARACTER 1 0 No
|
||||
("generated", [t|String|]),
|
||||
-- TEXT SYSIBM CLOB 65538 0 Yes
|
||||
("text", [t|Maybe String|]),
|
||||
-- REMARKS SYSIBM VARCHAR 254 0 Yes
|
||||
("remarks", [t|Maybe String|])
|
||||
|
||||
]
|
||||
[''Show, ''Generic])
|
||||
import Database.Relational.Schema.IBMDB2.Columns
|
||||
|
@ -1,16 +1,6 @@
|
||||
-- |
|
||||
-- Module : Database.Relational.Schema.DB2Syscat.Config
|
||||
-- Copyright : 2014 Kei Hibino
|
||||
-- License : BSD3
|
||||
--
|
||||
-- Maintainer : ex8k.hibino@gmail.com
|
||||
-- Stability : experimental
|
||||
-- Portability : unknown
|
||||
module Database.Relational.Schema.DB2Syscat.Config (config) where
|
||||
module Database.Relational.Schema.DB2Syscat.Config
|
||||
{-# DEPRECATED "import config from Database.Relational.Schema.IBMDB2 instead of this module." #-} (
|
||||
config,
|
||||
) where
|
||||
|
||||
import Database.Relational (Config (..), ProductUnitSupport (..), defaultConfig)
|
||||
|
||||
|
||||
-- | Configuration parameter against IBM DB2.
|
||||
config :: Config
|
||||
config = defaultConfig { productUnitSupport = PUNotSupported }
|
||||
import Database.Relational.Schema.IBMDB2.Config (config)
|
||||
|
@ -13,6 +13,8 @@
|
||||
-- table schema and table constraint informations
|
||||
-- from system catalog of IBM DB2.
|
||||
module Database.Relational.Schema.IBMDB2 (
|
||||
module Database.Relational.Schema.IBMDB2.Config,
|
||||
|
||||
normalizeColumn, notNull, getType,
|
||||
|
||||
columnsQuerySQL, primaryKeyQuerySQL
|
||||
@ -32,12 +34,13 @@ import Database.Relational
|
||||
|
||||
import Control.Applicative ((<|>))
|
||||
|
||||
import Database.Relational.Schema.DB2Syscat.Columns (Columns, columns)
|
||||
import qualified Database.Relational.Schema.DB2Syscat.Columns as Columns
|
||||
import Database.Relational.Schema.DB2Syscat.Tabconst (tabconst)
|
||||
import qualified Database.Relational.Schema.DB2Syscat.Tabconst as Tabconst
|
||||
import Database.Relational.Schema.DB2Syscat.Keycoluse (keycoluse)
|
||||
import qualified Database.Relational.Schema.DB2Syscat.Keycoluse as Keycoluse
|
||||
import Database.Relational.Schema.IBMDB2.Config
|
||||
import Database.Relational.Schema.IBMDB2.Columns (Columns, columns)
|
||||
import qualified Database.Relational.Schema.IBMDB2.Columns as Columns
|
||||
import Database.Relational.Schema.IBMDB2.Tabconst (tabconst)
|
||||
import qualified Database.Relational.Schema.IBMDB2.Tabconst as Tabconst
|
||||
import Database.Relational.Schema.IBMDB2.Keycoluse (keycoluse)
|
||||
import qualified Database.Relational.Schema.IBMDB2.Keycoluse as Keycoluse
|
||||
|
||||
|
||||
-- | Mapping between type in DB2 and Haskell type.
|
||||
|
@ -0,0 +1,105 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE FlexibleInstances #-}
|
||||
{-# LANGUAGE MultiParamTypeClasses #-}
|
||||
{-# LANGUAGE DataKinds #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
|
||||
-- |
|
||||
-- Module : Database.Relational.Schema.IBMDB2.Columns
|
||||
-- Copyright : 2013-2017 Kei Hibino
|
||||
-- License : BSD3
|
||||
--
|
||||
-- Maintainer : ex8k.hibino@gmail.com
|
||||
-- Stability : experimental
|
||||
-- Portability : unknown
|
||||
--
|
||||
-- Generate template of SYSCAT.columns system catalog table.
|
||||
module Database.Relational.Schema.IBMDB2.Columns where
|
||||
|
||||
import GHC.Generics (Generic)
|
||||
import Data.Int (Int16, Int32, Int64)
|
||||
import Database.Relational.TH (defineTableTypesAndRecord)
|
||||
|
||||
import Database.Relational.Schema.IBMDB2.Config (config)
|
||||
|
||||
|
||||
$(defineTableTypesAndRecord config
|
||||
"SYSCAT" "columns"
|
||||
[
|
||||
-- column schema type length NULL
|
||||
-- ------------------------------ --------- ------------------ -------- ----- ------
|
||||
-- TABSCHEMA SYSIBM VARCHAR 128 0 No
|
||||
("tabschema", [t|String|]),
|
||||
-- TABNAME SYSIBM VARCHAR 128 0 No
|
||||
("tabname", [t|String|]),
|
||||
-- COLNAME SYSIBM VARCHAR 128 0 No
|
||||
("colname", [t|String|]),
|
||||
-- COLNO SYSIBM SMALLINT 2 0 No
|
||||
("colno", [t|Int16|]),
|
||||
-- TYPESCHEMA SYSIBM VARCHAR 128 0 No
|
||||
("typeschema", [t|String|]),
|
||||
-- TYPENAME SYSIBM VARCHAR 18 0 No
|
||||
("typename", [t|String|]),
|
||||
-- LENGTH SYSIBM INTEGER 4 0 No
|
||||
("length", [t|Int32|]),
|
||||
-- SCALE SYSIBM SMALLINT 2 0 No
|
||||
("scale", [t|Int16|]),
|
||||
-- DEFAULT SYSIBM VARCHAR 254 0 Yes
|
||||
("default", [t|Maybe String|]),
|
||||
-- NULLS SYSIBM CHARACTER 1 0 No
|
||||
("nulls", [t|String|]),
|
||||
-- CODEPAGE SYSIBM SMALLINT 2 0 No
|
||||
("codepage", [t|Int16|]),
|
||||
-- LOGGED SYSIBM CHARACTER 1 0 No
|
||||
("logged", [t|String|]),
|
||||
-- COMPACT SYSIBM CHARACTER 1 0 No
|
||||
("compact", [t|String|]),
|
||||
-- COLCARD SYSIBM BIGINT 8 0 No
|
||||
("colcard", [t|Int64|]),
|
||||
-- HIGH2KEY SYSIBM VARCHAR 254 0 Yes
|
||||
("high2key", [t|Maybe String|]),
|
||||
-- LOW2KEY SYSIBM VARCHAR 254 0 Yes
|
||||
("low2key", [t|Maybe String|]),
|
||||
-- AVGCOLLEN SYSIBM INTEGER 4 0 No
|
||||
("avgcollen", [t|Int32|]),
|
||||
-- KEYSEQ SYSIBM SMALLINT 2 0 Yes
|
||||
("keyseq", [t|Maybe Int16|]),
|
||||
-- PARTKEYSEQ SYSIBM SMALLINT 2 0 Yes
|
||||
("partkeyseq", [t|Maybe Int16|]),
|
||||
-- NQUANTILES SYSIBM SMALLINT 2 0 No
|
||||
("nquantiles", [t|Int16|]),
|
||||
-- NMOSTFREQ SYSIBM SMALLINT 2 0 No
|
||||
("nmostfreq", [t|Int16|]),
|
||||
-- NUMNULLS SYSIBM BIGINT 8 0 No
|
||||
("numnulls", [t|Int64|]),
|
||||
-- TARGET_TYPESCHEMA SYSIBM VARCHAR 128 0 Yes
|
||||
("target_typeschema", [t|Maybe String|]),
|
||||
-- TARGET_TYPENAME SYSIBM VARCHAR 18 0 Yes
|
||||
("target_typename", [t|Maybe String|]),
|
||||
-- SCOPE_TABSCHEMA SYSIBM VARCHAR 128 0 Yes
|
||||
("scope_tabschema", [t|Maybe String|]),
|
||||
-- SCOPE_TABNAME SYSIBM VARCHAR 128 0 Yes
|
||||
("scope_tabname", [t|Maybe String|]),
|
||||
-- SOURCE_TABSCHEMA SYSIBM VARCHAR 128 0 Yes
|
||||
("source_tabschema", [t|Maybe String|]),
|
||||
-- SOURCE_TABNAME SYSIBM VARCHAR 128 0 Yes
|
||||
("source_tabname", [t|Maybe String|]),
|
||||
-- DL_FEATURES SYSIBM CHARACTER 10 0 Yes
|
||||
("dl_features", [t|Maybe String|]),
|
||||
-- SPECIAL_PROPS SYSIBM CHARACTER 8 0 Yes
|
||||
("special_props", [t|Maybe String|]),
|
||||
-- HIDDEN SYSIBM CHARACTER 1 0 No
|
||||
("hidden", [t|String|]),
|
||||
-- INLINE_LENGTH SYSIBM INTEGER 4 0 No
|
||||
("inline_length", [t|Int32|]),
|
||||
-- IDENTITY SYSIBM CHARACTER 1 0 No
|
||||
("identity", [t|String|]),
|
||||
-- GENERATED SYSIBM CHARACTER 1 0 No
|
||||
("generated", [t|String|]),
|
||||
-- TEXT SYSIBM CLOB 65538 0 Yes
|
||||
("text", [t|Maybe String|]),
|
||||
-- REMARKS SYSIBM VARCHAR 254 0 Yes
|
||||
("remarks", [t|Maybe String|])
|
||||
|
||||
]
|
||||
[''Show, ''Generic])
|
@ -0,0 +1,16 @@
|
||||
-- |
|
||||
-- Module : Database.Relational.Schema.IBMDB2.Config
|
||||
-- Copyright : 2014 Kei Hibino
|
||||
-- License : BSD3
|
||||
--
|
||||
-- Maintainer : ex8k.hibino@gmail.com
|
||||
-- Stability : experimental
|
||||
-- Portability : unknown
|
||||
module Database.Relational.Schema.IBMDB2.Config (config) where
|
||||
|
||||
import Database.Relational (Config (..), ProductUnitSupport (..), defaultConfig)
|
||||
|
||||
|
||||
-- | Configuration parameter against IBM DB2.
|
||||
config :: Config
|
||||
config = defaultConfig { productUnitSupport = PUNotSupported }
|
@ -16,13 +16,13 @@
|
||||
-- Generate template of SYSCAT.keycoluse system catalog table.
|
||||
-- Not all columns are mapped to Haskell record.
|
||||
-- Minimum implementation required to generate table constraints.
|
||||
module Database.Relational.Schema.DB2Syscat.Keycoluse where
|
||||
module Database.Relational.Schema.IBMDB2.Keycoluse where
|
||||
|
||||
import GHC.Generics (Generic)
|
||||
import Data.Int (Int16)
|
||||
import Database.Relational.TH (defineTableTypesAndRecord)
|
||||
|
||||
import Database.Relational.Schema.DB2Syscat.Config (config)
|
||||
import Database.Relational.Schema.IBMDB2.Config (config)
|
||||
|
||||
|
||||
-- Not all column is mapped. Minimum implementation.
|
@ -16,12 +16,12 @@
|
||||
-- Generate template of SYSCAT.tabconst system catalog table.
|
||||
-- Not all columns are mapped to Haskell record.
|
||||
-- Minimum implementation required to generate table constraints.
|
||||
module Database.Relational.Schema.DB2Syscat.Tabconst where
|
||||
module Database.Relational.Schema.IBMDB2.Tabconst where
|
||||
|
||||
import GHC.Generics (Generic)
|
||||
import Database.Relational.TH (defineTableTypesAndRecord)
|
||||
|
||||
import Database.Relational.Schema.DB2Syscat.Config (config)
|
||||
import Database.Relational.Schema.IBMDB2.Config (config)
|
||||
|
||||
|
||||
-- Not all column is mapped. Minimum implementation.
|
Loading…
Reference in New Issue
Block a user