Pg: Support dynamic-oid types + vndbtag/vndbid

This commit is contained in:
Yorhel 2025-03-09 10:23:48 +01:00
parent 70c5199df4
commit dc752e2a23
3 changed files with 124 additions and 6 deletions

View file

@ -471,6 +471,7 @@ static void fupg_refresh_types(pTHX_ fupg_conn *c) {
snprintf(t->name.n, sizeof(t->name.n), "%s", PQgetvalue(r, i, 1));
char typ = *PQgetvalue(r, i, 2);
t->elemoid = fu_frombeU(32, PQgetvalue(r, i, 3));
const fupg_type *builtin;
if (t->elemoid) {
if (typ == 'd') { /* domain */
@ -487,13 +488,14 @@ static void fupg_refresh_types(pTHX_ fupg_conn *c) {
/* enum, can use text send/recv */
t->send = fupg_send_text;
t->recv = fupg_recv_text;
} else if ((builtin = fupg_builtin_byoid(t->oid))) {
t->send = builtin->send;
t->recv = builtin->recv;
} else if ((builtin = fupg_dynoid_byname(t->name.n))) {
t->send = builtin->send;
t->recv = builtin->recv;
} else {
/* TODO: (multi)ranges, by-name lookup for dynamic-oid types */
const fupg_type *builtin = fupg_builtin_byoid(t->oid);
if (builtin) {
t->send = builtin->send;
t->recv = builtin->recv;
}
/* TODO: (multi)ranges */
}
}
PQclear(r);