getVersion method
Returns engine version (api + abi) for client compatibility checks.
Example: {"api": "0.1.0", "abi": "1.0.0"}.
Returns null on failure.
Implementation
Map<String, String>? getVersion() {
const bufSize = 128;
final buf = malloc<ffi.Uint8>(bufSize);
final outWritten = malloc<ffi.Uint32>();
try {
final code = _bindings.odbc_get_version(buf, bufSize, outWritten);
if (code != 0) return null;
final n = outWritten.value;
if (n == 0) return null;
final json = utf8.decode(buf.asTypedList(n));
final decoded = jsonDecode(json) as Map<String, dynamic>;
return {
'api': decoded['api'] as String? ?? '',
'abi': decoded['abi'] as String? ?? '',
};
} on Object catch (_) {
return null;
} finally {
malloc
..free(buf)
..free(outWritten);
}
}