| 406 | } |
| 407 | |
| 408 | private final void acceptStandard(Context<?> ctx) { |
| 409 | JSONNull jsonNull; |
| 410 | JSONReturning jsonReturning; |
| 411 | |
| 412 | // Workaround for https://github.com/h2database/h2database/issues/2496 |
| 413 | if (entries.isEmpty() && ctx.family() == H2) |
| 414 | jsonNull = new JSONNull(JSONOnNull.NULL_ON_NULL); |
| 415 | |
| 416 | // Some dialects support the JSONNull clause only for non-empty JSON_OBJECT |
| 417 | // E.g. https://trino.io/docs/current/functions/json.html#json-object |
| 418 | else if (entries.isEmpty() && JSONNull.NO_SUPPORT_NULL_ON_EMPTY.contains(ctx.dialect())) |
| 419 | jsonNull = new JSONNull(null); |
| 420 | else |
| 421 | jsonNull = new JSONNull(onNull); |
| 422 | |
| 423 | |
| 424 | |
| 425 | |
| 426 | |
| 427 | |
| 428 | |
| 429 | jsonReturning = new JSONReturning(returning); |
| 430 | |
| 431 | ctx.visit(N_JSON_OBJECT).sql('(').visit(QueryPartListView.wrap(QueryPartCollectionView.wrap(entries), jsonNull, jsonReturning).separator("")).sql(')'); |
| 432 | } |
| 433 | |
| 434 | |
| 435 | |