-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Safer placeholders #73
base: master
Are you sure you want to change the base?
Conversation
Improvements from khibino#70 - Wrap everything created from a `Record` with `WithPlaceholderOffsets`. - Which can be easily concatenated by `Applicative` combinators such as `<*>`. - Better solution than khibino#70 (comment) and khibino#70 (comment) - (BREAKING CHANGE) Pass placeholders Record directly to `query'` etc. - Delete old (and unavailable anymore) placholders-related APIs: `placeholder` and `relation'` etc. Left Tasks ==== - Some tests doesn't pass. Fix them. - Avoid to use `toFlat` and `toAggregated` as much as possible: `ResultContext` should be adapted. - Add tests for placeholders. - You may want to refactor the design.
5955279
to
3c7b578
Compare
2850800
to
848fcdc
Compare
No reason to hide just a type synonym of `DList Int`
848fcdc
to
1e2a7a9
Compare
show = showStringSQL . detachPlaceholderOffsets . (`sqlFromRelation` defaultPlaceholders) | ||
|
||
defaultPlaceholders :: PersistableWidth t => Record PureOperand t | ||
defaultPlaceholders = pwPlaceholders persistableWidth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found this API should be "unsafe".
Because this enables us to refer placeholder Record
s even when building a Relation () a
, which doesn't actually receive any placeholder parameters.
updateContext = QueryJoin . modify | ||
updateContext :: Monad m => PlaceholderOffsets -> (JoinContext -> JoinContext) -> QueryJoin m () | ||
updateContext phs f = | ||
QueryJoin $ modify (mapWithPlaceholderOffsets (f *** (phs <>))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a bug related to this file: there are cases where the predicate of ON
clause are not printed though its attached PlaceholderOffsets
is appended.
How can I fix?
Tests added: igrep#1 |
Improvements from #70
Record
withWithPlaceholderOffsets
.Applicative
combinators such as<*>
.query'
etc.placeholder
andrelation'
etc.Left Tasks
Some tests doesn't pass. Fix them.toFlat
andtoAggregated
as much as possible:ResultContext
should be adapted.