pg: Rework txn implementation + statement config API

I liked the Perl implementation of transactions, but managing state
between Perl and C is a bit cumbersome, so I've moved the whole thing
into C.

Also added a few statement configuration methods that currently don't do
anything yet.
This commit is contained in:
Yorhel 2025-02-07 18:30:33 +01:00
parent 8f94dd0921
commit 166744dd51
7 changed files with 335 additions and 186 deletions

View file

@ -1,11 +1,11 @@
/* Because I don't know how to use sv_setref_pv() correctly. */
static SV *fupg_selfobj_(pTHX_ SV **self, void *obj, const char *klass) {
static SV *fu_selfobj_(pTHX_ SV **self, void *obj, const char *klass) {
*self = newSViv(PTR2IV(obj));
return sv_bless(sv_2mortal(newRV_noinc(*self)), gv_stashpv(klass, GV_ADD));
}
/* Write a blessed SV to obj->self and returns a mortal ref to it */
#define fupg_selfobj(obj, klass) fupg_selfobj_(aTHX_ &((obj)->self), obj, klass)
#define fu_selfobj(obj, klass) fu_selfobj_(aTHX_ &((obj)->self), obj, klass)