mruby-pg icon indicating copy to clipboard operation
mruby-pg copied to clipboard

How one close a connection?

Open everton opened this issue 6 years ago • 1 comments

Maybe this can be something very simple I'm missing here, but how exactly one is supposed to close a connection?

I was not able to find something like conn.close

Looking into the code, I found pgconn_free inside C code, which calls PQfinish, but how exactly do I call this?

(conn.free didn't work for me...)

everton avatar Dec 10 '19 03:12 everton

Learning more about mruby I found that this struct of the data type uses the function pointed into it (which in this case is the pgconn_free) when the object is being garbage collected.

Is there any reason to not expose these behaviors as a method? Can I pull request a new version and exposing the pgconn_free as a method PG::Connection#close ?

everton avatar Dec 10 '19 14:12 everton