mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-12-14 22:32:07 +03:00
Moved definition.
This commit is contained in:
parent
5ee6c9ce7b
commit
031027f1a2
@ -12,9 +12,11 @@
|
||||
module Database.Relational.Query.Internal.String (
|
||||
showUnwordsSQL, showWordSQL, showUnwords,
|
||||
|
||||
paren
|
||||
paren, sqlRowString
|
||||
) where
|
||||
|
||||
import Data.List (intercalate)
|
||||
|
||||
import Language.SQL.Keyword (unwordsSQL)
|
||||
import qualified Language.SQL.Keyword as SQL
|
||||
|
||||
@ -36,3 +38,10 @@ showUnwords = rec where
|
||||
-- | Parened String.
|
||||
paren :: String -> String
|
||||
paren = ('(' :) . (++[')'])
|
||||
|
||||
-- | Row String of SQL values.
|
||||
sqlRowString :: [String] -> String
|
||||
sqlRowString = d where
|
||||
d ([]) = error $ "Projection: no columns."
|
||||
d ([c]) = c
|
||||
d (cs) = paren $ intercalate ", " cs
|
||||
|
@ -52,7 +52,6 @@ module Database.Relational.Query.Projectable (
|
||||
|
||||
import Prelude hiding (and, or, not, pi)
|
||||
|
||||
import Data.List (intercalate)
|
||||
import Data.String (IsString)
|
||||
import Control.Applicative ((<$>))
|
||||
|
||||
@ -61,7 +60,7 @@ import qualified Language.SQL.Keyword.ConcatString as SQLs
|
||||
|
||||
import Database.Record (PersistableWidth, PersistableRecordWidth, derivedWidth)
|
||||
|
||||
import Database.Relational.Query.Internal.String (paren)
|
||||
import Database.Relational.Query.Internal.String (paren, sqlRowString)
|
||||
import Database.Relational.Query.Table (columnSQL, stringFromColumnSQL)
|
||||
import Database.Relational.Query.Expr (Expr, ShowConstantSQL (showConstantSQL))
|
||||
import qualified Database.Relational.Query.Expr as Expr
|
||||
@ -73,13 +72,6 @@ import Database.Relational.Query.Projection (Projection, columns, unsafeFromColu
|
||||
import qualified Database.Relational.Query.Projection as Projection
|
||||
|
||||
|
||||
-- | Row String of SQL values.
|
||||
sqlRowString :: [String] -> String
|
||||
sqlRowString = d where
|
||||
d ([]) = error $ "Projection: no columns."
|
||||
d ([c]) = c
|
||||
d (cs) = paren $ intercalate ", " cs
|
||||
|
||||
-- | Unsafely get SQL term from 'Proejction'.
|
||||
unsafeShowSqlProjection :: Projection c r -> String
|
||||
unsafeShowSqlProjection = sqlRowString . map stringFromColumnSQL . columns
|
||||
|
Loading…
Reference in New Issue
Block a user