xaRecoverGet method
Extract the XID at index from the cache populated by the most
recent xaRecoverCount call. Returns null when the index is
out of range or the FFI fails.
Implementation
({int formatId, Uint8List gtrid, Uint8List bqual})? xaRecoverGet(int index) {
// 64-byte buffers cover the X/Open maximum for both gtrid and bqual.
final gtridBuf = calloc<ffi.Uint8>(64);
final bqualBuf = calloc<ffi.Uint8>(64);
final outFormatId = calloc<ffi.Int32>();
final outGtridLen = calloc<ffi.Uint32>();
final outBqualLen = calloc<ffi.Uint32>();
try {
final rc = _bindings.odbc_xa_recover_get(
index,
outFormatId,
gtridBuf,
64,
outGtridLen,
bqualBuf,
64,
outBqualLen,
);
if (rc != 0) return null;
final formatId = outFormatId.value;
final gtridLen = outGtridLen.value;
final bqualLen = outBqualLen.value;
final gtrid = Uint8List.fromList(
gtridBuf.asTypedList(gtridLen),
);
final bqual = Uint8List.fromList(
bqualBuf.asTypedList(bqualLen),
);
return (formatId: formatId, gtrid: gtrid, bqual: bqual);
} finally {
calloc
..free(gtridBuf)
..free(bqualBuf)
..free(outFormatId)
..free(outGtridLen)
..free(outBqualLen);
}
}