public static int mdb_dbi_open(IntPtr txn, string name, DatabaseOpenFlags flags, out uint db) { var statusCode = LmdbMethods.mdb_dbi_open(txn, name, flags, out db); if (statusCode == MDB_NOTFOUND) { throw new LightningException($"Error opening database {name}: {mdb_strerror(statusCode)}", statusCode); } return(check(statusCode)); }