【问题标题】:How to get results of select query in postgresql r2dbc?如何在 postgresql r2dbc 中获取选择查询的结果?
【发布时间】:2021-06-03 07:17:15
【问题描述】:

我可以很好地执行这个查询,但是我不知道如何提取select语句返回的信息。

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();

【问题讨论】:

标签: postgresql r2dbc r2dbc-postgresql


【解决方案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();

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-07-12
    • 1970-01-01
    • 1970-01-01
    • 2017-02-04
    • 2020-02-04
    • 2019-05-10
    • 1970-01-01
    • 2018-07-16
    相关资源
    最近更新 更多