arcapos / luapgsql

Lua binding for PostgreSQL
108 stars 24 forks source link

Expose res_clear as method #42

Closed daurnimator closed 3 years ago

daurnimator commented 7 years ago

To allow explicit collection, please expose res_clear (currently a __gc metamethod) as res:clear()

mbalmer commented 7 years ago

Am 12.09.2016 um 03:18 schrieb daurnimator notifications@github.com:

To allow explicit collection, please expose res_clear (currently a __gc metamethod) as res:clear()

Easy enough to add, but why do you want that? What is the reason? The automatic gc worksed fine for me, even with very large results.

(not objecting, jusr asking)

daurnimator commented 7 years ago

I was converting some C code (that used libpq) to lua. It would be nice for debuggability if I can make the calls into libpq deterministic.

mbalmer commented 3 years ago

I will soon add methamethods to make result sets -able. Think that is the proper way.

daurnimator commented 3 years ago

This issue was about exposing the method as more than a metamethod, so that I could call it e.g. in a test exactly when I wanted. Rather than waiting for the GC; or with lua 5.4's new close: ending the current scope.

Please consider reopening/accepting?

mbalmer commented 3 years ago

If you can make use of this feature, then I can add it, it does not harm.

So yes, I will add it.

Am 06.12.2020 um 10:41 schrieb daurnimator notifications@github.com:

This issue was about exposing the method as more than a metamethod, so that I could call it e.g. in a test exactly when I wanted. Rather than waiting for the GC; or with lua 5.4's new close: ending the current scope.

Please consider reopening/accepting?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/arcapos/luapgsql/issues/42#issuecomment-739478700, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADIAHZ7H4XKTZTAXY5Q7O3STNGVVANCNFSM4CPIUM7A.