mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2025-01-07 13:46:41 +03:00
relational-query: apply renaming from ShowConstantTermsSQL to LiteralSQL.
This commit is contained in:
parent
9ce8d25c39
commit
a9cfafef12
@ -46,7 +46,7 @@ import qualified Database.Relational.Pi.Unsafe as Pi
|
||||
import Database.Relational.Table (Table, TableDerivable, derivedTable)
|
||||
import qualified Database.Relational.Table as Table
|
||||
import qualified Database.Relational.Record as Record
|
||||
import Database.Relational.ProjectableClass (ShowConstantTermsSQL)
|
||||
import Database.Relational.ProjectableClass (LiteralSQL)
|
||||
import Database.Relational.Projectable
|
||||
(PlaceHolders, unitPH, pwPlaceholder, placeholder, (><), value, )
|
||||
import Database.Relational.Monad.Trans.Assigning (assignings, (<-#))
|
||||
@ -194,7 +194,7 @@ sqlFromInsertTarget :: Config -> Table r -> InsertTarget p r -> StringSQL
|
||||
sqlFromInsertTarget config = sqlChunkFromInsertTarget' config 1
|
||||
|
||||
-- | Make 'StringSQL' strings of SQL INSERT strings from records list
|
||||
sqlChunksFromRecordList :: ShowConstantTermsSQL r'
|
||||
sqlChunksFromRecordList :: LiteralSQL r'
|
||||
=> Config
|
||||
-> Table r
|
||||
-> Pi r r'
|
||||
|
@ -99,7 +99,7 @@ import Database.Relational.Pure ()
|
||||
import Database.Relational.TupleInstances ()
|
||||
import Database.Relational.Pi (Pi)
|
||||
import Database.Relational.ProjectableClass
|
||||
(ShowConstantTermsSQL, showConstantTermsSQL, )
|
||||
(LiteralSQL, showLiteral, )
|
||||
import Database.Relational.Record (RecordList)
|
||||
import qualified Database.Relational.Record as Record
|
||||
import Database.Relational.Projectable.Unsafe
|
||||
@ -124,8 +124,8 @@ nothing = proxyWidth persistableWidth
|
||||
proxyWidth w = unsafeProjectSqlTerms $ replicate (runPersistableRecordWidth w) SQL.NULL
|
||||
|
||||
-- | Generate record with polymorphic type of SQL constant values from Haskell value.
|
||||
value :: (ShowConstantTermsSQL t, OperatorContext c) => t -> Record c t
|
||||
value = unsafeProjectSqlTerms . showConstantTermsSQL
|
||||
value :: (LiteralSQL t, OperatorContext c) => t -> Record c t
|
||||
value = unsafeProjectSqlTerms . showLiteral
|
||||
|
||||
-- | Record with polymorphic type of SQL true value.
|
||||
valueTrue :: OperatorContext c => Record c (Maybe Bool)
|
||||
@ -136,7 +136,7 @@ valueFalse :: OperatorContext c => Record c (Maybe Bool)
|
||||
valueFalse = just $ value False
|
||||
|
||||
-- | RecordList with polymorphic type of SQL set value from Haskell list.
|
||||
values :: (ShowConstantTermsSQL t, OperatorContext c) => [t] -> RecordList (Record c) t
|
||||
values :: (LiteralSQL t, OperatorContext c) => [t] -> RecordList (Record c) t
|
||||
values = Record.list . map value
|
||||
|
||||
|
||||
@ -259,12 +259,12 @@ likeMaybe' :: (OperatorContext c, IsString a)
|
||||
x `likeMaybe'` y = x `unsafeLike` y
|
||||
|
||||
-- | String-compare operator corresponding SQL /LIKE/ .
|
||||
like :: (OperatorContext c, IsString a, ShowConstantTermsSQL a)
|
||||
like :: (OperatorContext c, IsString a, LiteralSQL a)
|
||||
=> Record c a -> a -> Record c (Maybe Bool)
|
||||
x `like` a = x `like'` value a
|
||||
|
||||
-- | String-compare operator corresponding SQL /LIKE/ . Maybe type version.
|
||||
likeMaybe :: (OperatorContext c, IsString a, ShowConstantTermsSQL a)
|
||||
likeMaybe :: (OperatorContext c, IsString a, LiteralSQL a)
|
||||
=> Record c (Maybe a) -> a -> Record c (Maybe Bool)
|
||||
x `likeMaybe` a = x `unsafeLike` value a
|
||||
|
||||
|
@ -42,7 +42,7 @@ import Database.Relational.Pi (Pi)
|
||||
import Database.Relational.Constraint
|
||||
(HasConstraintKey (..), Key, Primary, projectionKey)
|
||||
import Database.Relational.Projectable ((.<=.), value, unitPH, (!))
|
||||
import Database.Relational.ProjectableClass (ShowConstantTermsSQL)
|
||||
import Database.Relational.ProjectableClass (LiteralSQL)
|
||||
import Database.Relational.Relation (tableOf)
|
||||
import qualified Database.Relational.Relation as Relation
|
||||
import Database.Relational.Effect (updateTarget')
|
||||
@ -135,7 +135,7 @@ extractNumber (Number i) = i
|
||||
($$) = ($$!)
|
||||
|
||||
-- | Update statement for sequence table
|
||||
updateNumber' :: (PersistableWidth s, Integral i, ShowConstantTermsSQL i)
|
||||
updateNumber' :: (PersistableWidth s, Integral i, LiteralSQL i)
|
||||
=> Config
|
||||
-> i -- ^ sequence number to set. expect not SQL injectable.
|
||||
-> Sequence s i -- ^ sequence table
|
||||
@ -147,7 +147,7 @@ updateNumber' config i seqt = typedUpdate' config (seqTable seqt) . updateTarget
|
||||
return unitPH
|
||||
|
||||
-- | Update statement for sequence table
|
||||
updateNumber :: (PersistableWidth s, Integral i, ShowConstantTermsSQL i)
|
||||
updateNumber :: (PersistableWidth s, Integral i, LiteralSQL i)
|
||||
=> i -- ^ sequence number to set. expect not SQL injectable.
|
||||
-> Sequence s i -- ^ sequence table
|
||||
-> Update ()
|
||||
|
@ -77,7 +77,7 @@ import Database.Relational.Effect
|
||||
sqlChunkFromInsertTarget, sqlFromInsertTarget, sqlChunksFromRecordList)
|
||||
import Database.Relational.Pi (Pi)
|
||||
import Database.Relational.Table (Table, TableDerivable, derivedTable)
|
||||
import Database.Relational.ProjectableClass (ShowConstantTermsSQL)
|
||||
import Database.Relational.ProjectableClass (LiteralSQL)
|
||||
import Database.Relational.Projectable (PlaceHolders, unitPH)
|
||||
import Database.Relational.SimpleSql
|
||||
(QuerySuffix, showsQuerySuffix, insertPrefixSQL,
|
||||
@ -337,7 +337,7 @@ derivedInsertValue :: TableDerivable r => Register r (PlaceHolders p) -> Insert
|
||||
derivedInsertValue = insertValue
|
||||
|
||||
-- | Make typed 'Insert' list from 'Config' and records list.
|
||||
insertValueList' :: (TableDerivable r, ShowConstantTermsSQL r')
|
||||
insertValueList' :: (TableDerivable r, LiteralSQL r')
|
||||
=> Config
|
||||
-> Pi r r'
|
||||
-> [r']
|
||||
@ -347,7 +347,7 @@ insertValueList' config pi' =
|
||||
. sqlChunksFromRecordList config derivedTable pi'
|
||||
|
||||
-- | Make typed 'Insert' list from records list.
|
||||
insertValueList :: (TableDerivable r, ShowConstantTermsSQL r')
|
||||
insertValueList :: (TableDerivable r, LiteralSQL r')
|
||||
=> Pi r r'
|
||||
-> [r']
|
||||
-> [Insert ()]
|
||||
|
Loading…
Reference in New Issue
Block a user