Moved definition.

This commit is contained in:
Kei Hibino 2013-08-30 01:00:11 +09:00
parent 5ee6c9ce7b
commit 031027f1a2
2 changed files with 11 additions and 10 deletions

View File

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

View File

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