getError method
Gets the last error message from the native engine.
Returns an empty string if no error occurred.
Implementation
String getError() {
final buf = malloc<ffi.Int8>(_errorBufferSize);
try {
final n = _bindings.odbc_get_error(buf, _errorBufferSize);
if (n < 0) {
return 'Unknown error';
}
if (n == 0) {
return '';
}
// Cast to Uint8 view — no allocation, no sign-conversion loop.
return utf8.decode(
buf.cast<ffi.Uint8>().asTypedList(n),
allowMalformed: true,
);
} finally {
malloc.free(buf);
}
}