pg: Statement execution + better error reporting

This commit is contained in:
Yorhel 2025-02-06 09:05:05 +01:00
parent 922f19e39b
commit 711300b227
6 changed files with 124 additions and 26 deletions

View file

@ -9,6 +9,35 @@ static SV *fupg_selfobj_(pTHX_ SV **self, void *obj, const char *klass) {
/* Return an SV to use for croak_sv() with a HV object.
* Adds a "full_message" field including stack trace. */
__attribute__((format (printf, 3, 4)))
static SV *fu_croak_hv(HV *hv, const char *klass, const char *message, ...) {
va_list args;
SV *sv;
dTHX;
dSP;
va_start(args, message);
sv = vnewSVpvf(message, &args);
va_end(args);
ENTER;
SAVETMPS;
PUSHMARK(SP);
XPUSHs(sv_2mortal(sv));
PUTBACK;
call_pv("Carp::longmess", G_SCALAR);
hv_stores(hv, "full_message", SvREFCNT_inc(POPs));
FREETMPS;
LEAVE;
return sv_bless(sv_2mortal(newRV_noinc((SV *)hv)), gv_stashpv(klass, GV_ADD));
}
/* Custom string builder, should be slightly faster than using Sv* macros directly. */
typedef struct {