| 346 | } |
| 347 | |
| 348 | private final void acceptStandard(Context<?> ctx, QueryPartCollectionView<Field<?>> mapped) { |
| 349 | JSONNull jsonNull; |
| 350 | JSONReturning jsonReturning; |
| 351 | |
| 352 | // Workaround for https://github.com/h2database/h2database/issues/2496 |
| 353 | if (fields.isEmpty() && ctx.family() == H2) |
| 354 | jsonNull = new JSONNull(JSONOnNull.NULL_ON_NULL); |
| 355 | else if (fields.isEmpty() && JSONNull.NO_SUPPORT_NULL_ON_EMPTY.contains(ctx.dialect())) |
| 356 | jsonNull = new JSONNull(null); |
| 357 | else |
| 358 | jsonNull = new JSONNull(onNull); |
| 359 | |
| 360 | |
| 361 | |
| 362 | |
| 363 | |
| 364 | |
| 365 | |
| 366 | jsonReturning = new JSONReturning(returning); |
| 367 | |
| 368 | Field<T> jsonArray = CustomField.of(N_JSON_ARRAY, getDataType(), c -> |
| 369 | c.visit(N_JSON_ARRAY).sql('(').visit(QueryPartListView.wrap(mapped, jsonNull, jsonReturning).separator("")).sql(')') |
| 370 | ); |
| 371 | |
| 372 | switch (ctx.family()) { |
| 373 | |
| 374 | |
| 375 | |
| 376 | |
| 377 | |
| 378 | |
| 379 | |
| 380 | |
| 381 | |
| 382 | |
| 383 | |
| 384 | default: |
| 385 | ctx.visit(jsonArray); |
| 386 | break; |
| 387 | } |
| 388 | } |
| 389 | |
| 390 | |
| 391 | |