0

I can execute this query just fine but I don't know how to extract the information returned by the select statement.

Flux<PostgresqlResult> checkTableQuery = connectionMono.flatMapMany(connection -> connection
    .createStatement("select exists(\n" +
                " select table_name from information_schema.tables\n" +
                " where table_name='sequence1'\n" +
                ");")
        .execute());
checkTableQuery.subscribe();
Alex
  • 706
  • 7
  • 16
Adarsh
  • 11
  • 2
  • use subscribe() to subscribe to the suscription, check [Flux Subscriber java doc](https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Flux.html#subscribe-reactor.core.CoreSubscriber-) – Hantsy Jun 04 '21 at 06:26

1 Answers1

1
Flux<PostgresqlResult> checkTableQuery = connectionMono.flatMapMany(connection -> connection
.createStatement("select exists(\n" +
            " select table_name from information_schema.tables\n" +
            " where table_name='sequence1'\n" +
            ");")
    .execute())
.flatmap(result -> result.map(
  (row,rowMetadata) -> row.get("exists",Boolean.class)));

checkTableQuery.subscribe();
Nima Ajdari
  • 2,754
  • 2
  • 14
  • 18
Adarsh
  • 11
  • 2