-
Notifications
You must be signed in to change notification settings - Fork 43
Add support for prepared statements #369
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
Conversation
b35c498 to
da75d2b
Compare
TeofilC
left a comment
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 had a quick glance through
| format. For large amounts of data this can be significantly more efficient | ||
| than embedding the values directly in the statement with 'Rel8.lit'. | ||
| -} | ||
| prepared :: forall a b i o. |
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.
This seeems more like parameterized - there's nothing that requires the statement-function you pass in to be calling a prepared statement, right?
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'm confused about what you mean by "calling a prepared statement". The True here makes the statement preparable.
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.
Okay, I am probably confused!
6ef778d to
fba8172
Compare
|
Is this ready to be merged @shane-circuithub ? |
This requires the introduction of a new `Encoder` type with three members: `binary`, which is the Hasql binary encoder, `text` which encodes a type in PostgreSQL's text format (needed for nested arrays) and `quote`, which does the thing that the function we previously called `encode` does (i.e., `a -> Opaleye.PrimExpr`). This will break any downstream code that uses a completely custom `DBType` implementation, but anything that uses `ReadShow`, `Enum`, `Composite`, `JSONBEncoded` or `parseTypeInformation` will continue working as before (which should cover all common cases). I dropped support for `network-ip` instead of trying to figure out how to write binary and text encoders for it. We still support `iproute`.
fba8172 to
4a8fff6
Compare
This requires the introduction of a new
Encodertype with three members:binary, which is the Hasql binary encoder,textwhich encodes a type in PostgreSQL's text format (needed for nested arrays) andquote, which does the thing that the function we previously calledencodedoes (i.e.,a -> Opaleye.PrimExpr).This will break any downstream code that uses a completely custom
DBTypeimplementation, but anything that usesReadShow,Enum,Composite,JSONBEncodedorparseTypeInformationwill continue working as before (which should cover all common cases).I dropped support for
network-ipinstead of trying to figure out how to write binary and text encoders for it. We still supportiproute.