Skip to content

Add connectdbParams and other connection key-value functions #67

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bens
Copy link

@bens bens commented Oct 3, 2024

Added a Storable instance for an equivalent to PQconninfoOption and bindings for the functions that use the struct:

  • PQconnectdbParams
  • PQconndefaults
  • PQconninfo
  • PQconninfoParse
  • PQconninfoFree

Also added some wrappers which do a minimum of conversion to ByteStrings and make sure memory isn't leaked.

@bens bens force-pushed the master branch 4 times, most recently from 0e610de to a35c60e Compare October 3, 2024 01:25
Added a `Storable` instance for an equivalent to `PQconninfoOption` and bindings
for the functions that use the struct:

  - PQconnectdbParams
  - PQconndefaults
  - PQconninfo
  - PQconninfoParse
  - PQconninfoFree

Also added some wrappers which do a minimum of conversion to `ByteString`s and
make sure memory isn't leaked.
conninfoParse :: B.ByteString -- ^ Connection String
-> IO [ConninfoOption]
conninfoParse connStr =
mask_ $ flip runContT pure $ do
Copy link
Collaborator

@phadej phadej Jul 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why mask_. That looks suspicious. But it seems existing stuff is using mask as well, but only when creating something in C-land and wrapping it ForeignPtr. i.e. to avoid memory leaks.

I think here bracket is sufficient. No need to explicitly mask.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants