[jOOQ/jOOQ#16754] Fix JSON_GET_ELEMENT and JSON_GET_ATTRIBUTE impl

JSON_EXTRACT is deprecated according to the docs!
This commit is contained in:
Lukas Eder 2024-06-05 16:37:20 +02:00
parent a2185bf76c
commit 3b7fbb8340
9 changed files with 43 additions and 7 deletions

View File

@ -114,6 +114,8 @@ implements
case MARIADB:
case MYSQL:
case TRINO:
@ -164,6 +166,9 @@ implements

View File

@ -110,13 +110,15 @@ implements
case MYSQL:
return false;
case MARIADB:
return false;
case SQLITE:
return false;
@ -157,6 +159,10 @@ implements
@ -170,7 +176,6 @@ implements
ctx.visit(function(N_JSON_UNQUOTE, JSONB, DSL.nullif(function(N_JSON_EXTRACT, JSONB, field, inline("$.").concat(attribute)).cast(VARCHAR), inline("null"))));
break;
case SQLITE:
ctx.visit(function(N_JSON_EXTRACT, JSONB, field, inline("$.").concat(attribute)));
break;

View File

@ -114,6 +114,8 @@ implements
case MARIADB:
case MYSQL:
case TRINO:
@ -159,6 +161,9 @@ implements

View File

@ -122,6 +122,10 @@ implements
@ -135,7 +139,6 @@ implements
ctx.visit(function(N_JSON_UNQUOTE, JSONB, DSL.nullif(function(N_JSON_EXTRACT, JSONB, field, inline("$[").concat(index).concat(inline("]"))).cast(VARCHAR), inline("null"))));
break;
case SQLITE:
ctx.visit(function(N_JSON_EXTRACT, JSONB, field, inline("$[").concat(index).concat(inline("]"))));
break;

View File

@ -114,6 +114,8 @@ implements
case MARIADB:
case MYSQL:
case TRINO:
@ -164,6 +166,9 @@ implements

View File

@ -110,13 +110,15 @@ implements
case MYSQL:
return false;
case MARIADB:
return false;
case SQLITE:
return false;
@ -158,6 +160,10 @@ implements
@ -171,7 +177,6 @@ implements
ctx.visit(function(N_JSON_UNQUOTE, JSON, DSL.nullif(function(N_JSON_EXTRACT, JSON, field, inline("$.").concat(attribute)).cast(VARCHAR), inline("null"))));
break;
case SQLITE:
ctx.visit(function(N_JSON_EXTRACT, JSON, field, inline("$.").concat(attribute)));
break;

View File

@ -114,6 +114,8 @@ implements
case MARIADB:
case MYSQL:
case TRINO:
@ -159,6 +161,9 @@ implements

View File

@ -122,6 +122,10 @@ implements
@ -135,7 +139,6 @@ implements
ctx.visit(function(N_JSON_UNQUOTE, JSON, DSL.nullif(function(N_JSON_EXTRACT, JSON, field, inline("$[").concat(index).concat(inline("]"))).cast(VARCHAR), inline("null"))));
break;
case SQLITE:
ctx.visit(function(N_JSON_EXTRACT, JSON, field, inline("$[").concat(index).concat(inline("]"))));
break;

View File

@ -497,7 +497,6 @@ final class Names {
static final Name N_JSON_ARRAY = systemName("json_array");
static final Name N_JSON_ARRAY_LENGTH = systemName("json_array_length");
static final Name N_JSON_EXTRACT = systemName("json_extract");
static final Name N_JSON_EXTRACT_ARRAY = systemName("json_extract_array");
static final Name N_JSON_GET_ATTRIBUTE = systemName("json_get_attribute");
static final Name N_JSON_GET_ATTRIBUTE_AS_TEXT = systemName("json_get_attribute_as_text");
static final Name N_JSON_GET_ELEMENT = systemName("json_get_element");
@ -508,6 +507,7 @@ final class Names {
static final Name N_JSON_LENGTH = systemName("json_length");
static final Name N_JSON_MODIFY = systemName("json_modify");
static final Name N_JSON_OBJECT = systemName("json_object");
static final Name N_JSON_QUERY_ARRAY = systemName("json_query_array");
static final Name N_JSON_REMOVE = systemName("json_remove");
static final Name N_JSON_REPLACE = systemName("json_replace");
static final Name N_JSON_SET = systemName("json_set");