openCursor method

IResultSet openCursor(
  1. IStatus status,
  2. ITransaction transaction,
  3. String sqlStmt, [
  4. int dialect = FbConsts.sqlDialectCurrent,
  5. IMessageMetadata? inMetadata,
  6. Pointer<Uint8>? inBuffer,
  7. IMessageMetadata? outMetadata,
  8. String? cursorName,
  9. int cursorFlags = 0,
])

Implementation

IResultSet openCursor(
    IStatus status, ITransaction transaction, String sqlStmt,
    [int dialect = FbConsts.sqlDialectCurrent,
    IMessageMetadata? inMetadata,
    Pointer<Uint8>? inBuffer,
    IMessageMetadata? outMetadata,
    String? cursorName,
    int cursorFlags = 0]) {
  final sqlUtf = sqlStmt.toNativeUtf8(allocator: mem);
  try {
    final nameUtf = cursorName?.toNativeUtf8(allocator: mem) ?? nullptr;
    try {
      final res = _openCursor(
          self,
          status.self,
          transaction.self,
          0,
          sqlUtf,
          dialect,
          inMetadata?.self ?? nullptr,
          inBuffer ?? nullptr,
          outMetadata?.self ?? nullptr,
          nameUtf,
          cursorFlags);
      status.checkStatus();
      return IResultSet(res);
    } finally {
      if (nameUtf != nullptr) {
        mem.free(nameUtf);
      }
    }
  } finally {
    mem.free(sqlUtf);
  }
}