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 '';
}
final bytes = buf.asTypedList(n).map((e) => e.toUnsigned(8)).toList();
return utf8.decode(bytes);
} finally {
malloc.free(buf);
}
}