Closed igrep closed 5 years ago
Current implementation can't properly handle the cases that the order of the placeholders referred in the monad stack differs from the order of the placeholders referred in the composed SQL.
Decided by oral discussion with @khibino:
Record
s (e.g. Restrictings
) with ReferredPlaceholders
:
newtype Restrictings c m a =
Restrictings (ReferredPlaceholders (WriterT (DList (Predicate c)) m a))
...
newtype Assignings r m a =
Assignings (ReferredPlaceholders (WriterT (Table r -> DList Assignment) m a))
SubQuery
containing Column
(e.g. Tuple
, JoinProduct
, [Predicate Flat]
etc.) with WithPlaceholderOffsets
StringSQL
from SubQuery
I'm not sure how to handle the cases that the parameter types are composed by using the placeholder function several times.
Decided by oral discussion with @khibino:
placeholder
only once:
relationWithPlaceholder = relation' . placeholder
placeholder
.query'
and queryList'
receive a value representing placeholder offsets with its type.
Record
?New task:
Record
monadic to record PlaceholderOffsets
so that Record
doesn't have PlaceholderOffsets
by itself.I'm going to rewrite this patch to send a separate pull request again! 😰
Better solution for https://github.com/khibino/haskell-relational-record/pull/67.
Problem
Users must refer placeholders by exactly same order as the record fields are defined, and must refer every field exactly once. Otherwise, the parameter values are bind at unintentional placeholders when executing the SQL.
Solution
Relation
andRecord
, add fields for lists containing indices of every record field.placeholderOffsets
inRecord
.Pi
object generated bymakeRelationalRecord
.placeholderOffsets
ofRecord
s by any operators forRecord
s.placeholderOffsets
ofRecord
s by the new monad transformer:ReferredPlaceholders
.placeholderOffsets
before binding to the placeholders of the SQL.Left problems
ReferredPlaceholders
monad transformer.placeholderOffsets
to anyColumn
s used in theSubQuery
type in some way.placeholder
function several times.igrep TODO
sign.