[jOOQ/jOOQ#982] Re-add the commercial SQLDataTypes to the OSS edition

We currently cannot have SQLDataType values that are commercial only in the Open Source Edition's integration tests. Recently added code generation integration tests have broken the OSS tests
This commit is contained in:
Lukas Eder 2022-01-05 09:49:36 +01:00
parent 618a15f235
commit fc169d33f6
8 changed files with 217 additions and 228 deletions

View File

@ -37,85 +37,82 @@
*/
package org.jooq;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* A wrapper type for spatial data obtained from the database.
* <p>
* The wrapper represents spatial {@link #data()} in serialised string form
* either as a well known text (WKT) or well known binary in hex format (WKB),
* depending on your dialect's default behaviour. A
* <code>CAST(NULL AS GEOGRAPHY)</code> value is represented by a
* <code>null</code> reference of type {@link Geography}, not as
* <code>data() == null</code>. This is consistent with jOOQ's general way of
* returning <code>NULL</code> from {@link Result} and {@link Record} methods.
* <p>
* This data type is supported only by the commercial editions of jOOQ.
*/
public final class Geography implements Spatial {
private final String data;
private Geography(String data) {
this.data = String.valueOf(data);
}
@Override
@NotNull
public final String data() {
return data;
}
/**
* Create a new {@link Geography} instance from string data input.
*/
@NotNull
public static final Geography valueOf(String data) {
return new Geography(data);
}
/**
* Create a new {@link Geography} instance from string data input.
* <p>
* This is the same as {@link #valueOf(String)}, but it can be static
* imported.
*/
@NotNull
public static final Geography geography(String data) {
return new Geography(data);
}
/**
* Create a new {@link Geography} instance from string data input, or
* <code>null</code> if the input is <code>null</code>.
*/
@Nullable
public static final Geography geographyOrNull(String data) {
return data == null ? null : geography(data);
}
@Override
public int hashCode() {
return data.hashCode();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj instanceof Geography)
return data.equals(((Geography) obj).data);
return false;
}
@Override
public String toString() {
return String.valueOf(data);
}
}

View File

@ -37,85 +37,82 @@
*/
package org.jooq;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* A wrapper type for spatial data obtained from the database.
* <p>
* The wrapper represents spatial {@link #data()} in serialised string form
* either as a well known text (WKT) or well known binary in hex format (WKB),
* depending on your dialect's default behaviour. A
* <code>CAST(NULL AS GEOMETRY)</code> value is represented by a
* <code>null</code> reference of type {@link Geometry}, not as
* <code>data() == null</code>. This is consistent with jOOQ's general way of
* returning <code>NULL</code> from {@link Result} and {@link Record} methods.
* <p>
* This data type is supported only by the commercial editions of jOOQ.
*/
public final class Geometry implements Spatial {
private final String data;
private Geometry(String data) {
this.data = String.valueOf(data);
}
@Override
@NotNull
public final String data() {
return data;
}
/**
* Create a new {@link Geometry} instance from string data input.
*/
@NotNull
public static final Geometry valueOf(String data) {
return new Geometry(data);
}
/**
* Create a new {@link Geometry} instance from string data input.
* <p>
* This is the same as {@link #valueOf(String)}, but it can be static
* imported.
*/
@NotNull
public static final Geometry geometry(String data) {
return new Geometry(data);
}
/**
* Create a new {@link Geometry} instance from string data input, or
* <code>null</code> if the input is <code>null</code>.
*/
@Nullable
public static final Geometry geometryOrNull(String data) {
return data == null ? null : geometry(data);
}
@Override
public int hashCode() {
return data.hashCode();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj instanceof Geometry)
return data.equals(((Geometry) obj).data);
return false;
}
@Override
public String toString() {
return String.valueOf(data);
}
}

View File

@ -37,29 +37,26 @@
*/
package org.jooq;
import java.io.Serializable;
import org.jetbrains.annotations.NotNull;
/**
* A wrapper type for spatial data obtained from the database.
* <p>
* The wrapper represents spatial {@link #data()} in serialised string form
* either as a well known text (WKT) or well known binary in hex format (WKB),
* depending on your dialect's default behaviour. A
* <code>CAST(NULL AS ...)</code> value is represented by a
* <code>null</code> reference of type {@link Spatial}, not as
* <code>data() == null</code>. This is consistent with jOOQ's general way of
* returning <code>NULL</code> from {@link Result} and {@link Record} methods.
* <p>
* This data type is supported only by the commercial editions of jOOQ.
*/
public interface Spatial extends Serializable {
@NotNull
String data();
}

View File

@ -83,8 +83,8 @@ import org.jooq.Domain;
import org.jooq.EmbeddableRecord;
import org.jooq.EnumType;
import org.jooq.Field;
// ...
// ...
import org.jooq.Geography;
import org.jooq.Geometry;
import org.jooq.JSON;
import org.jooq.JSONB;
import org.jooq.Name;

View File

@ -208,8 +208,8 @@ import org.jooq.False;
import org.jooq.Field;
import org.jooq.FieldOrRow;
// ...
// ...
// ...
import org.jooq.Geography;
import org.jooq.Geometry;
import org.jooq.GroupConcatOrderByStep;
import org.jooq.GroupConcatSeparatorStep;
import org.jooq.GroupField;
@ -363,7 +363,7 @@ import org.jooq.SelectForStep;
import org.jooq.SelectSelectStep;
import org.jooq.SelectWhereStep;
import org.jooq.Sequence;
// ...
import org.jooq.Spatial;
import org.jooq.Statement;
import org.jooq.Stringly;
import org.jooq.Support;

View File

@ -47,8 +47,8 @@ import static java.time.temporal.ChronoField.NANO_OF_SECOND;
import static java.time.temporal.ChronoField.SECOND_OF_MINUTE;
import static java.time.temporal.ChronoField.YEAR;
import static java.util.function.Function.identity;
// ...
// ...
import static org.jooq.Geography.geography;
import static org.jooq.Geometry.geometry;
// ...
// ...
// ...
@ -223,8 +223,8 @@ import org.jooq.DataType;
import org.jooq.EnumType;
import org.jooq.ExecuteScope;
import org.jooq.Field;
// ...
// ...
import org.jooq.Geography;
import org.jooq.Geometry;
import org.jooq.JSON;
import org.jooq.JSONB;
import org.jooq.Package;
@ -239,7 +239,7 @@ import org.jooq.RowId;
import org.jooq.SQLDialect;
import org.jooq.Schema;
import org.jooq.Scope;
// ...
import org.jooq.Spatial;
import org.jooq.TableRecord;
import org.jooq.UDT;
import org.jooq.UDTField;

View File

@ -86,7 +86,7 @@ import org.jooq.Function6;
import org.jooq.Function7;
import org.jooq.Function8;
import org.jooq.Function9;
// ...
import org.jooq.Geometry;
import org.jooq.GroupField;
import org.jooq.Index;
import org.jooq.Internal;
@ -114,7 +114,7 @@ import org.jooq.SQLDialect;
import org.jooq.Schema;
import org.jooq.Select;
import org.jooq.Sequence;
// ...
import org.jooq.Spatial;
import org.jooq.Statement;
import org.jooq.Table;
// ...

View File

@ -87,8 +87,8 @@ import java.util.UUID;
import org.jooq.Configuration;
import org.jooq.DataType;
// ...
// ...
import org.jooq.Geography;
import org.jooq.Geometry;
import org.jooq.JSON;
import org.jooq.JSONB;
// ...
@ -672,8 +672,8 @@ public final class SQLDataType {
/**
* The {@link ResultSet} type.
* <p>
* This is not a SQL or JDBC standard. This type emulates REF CURSOR types
* and similar constructs
* This is not a JDBC standard. This type emulates REF CURSOR types and
* similar constructs
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public static final DataType<Result<Record>> RESULT = new DefaultDataType<>(null, (Class) Result.class, "result");
@ -681,56 +681,54 @@ public final class SQLDataType {
/**
* The {@link UUID} type.
* <p>
* This is not a SQL or JDBC standard. This type handles UUID types where
* they are supported
* This is not a JDBC standard. This type handles UUID types where they are
* supported
*/
public static final DataType<UUID> UUID = new DefaultDataType<>(null, UUID.class, "uuid");
/**
* The {@link JSON} type.
* <p>
* This is not a SQL or JDBC standard. This type handles JSON types where
* they are supported.
* This is not a JDBC standard. This type handles JSON types where they are
* supported.
*/
public static final DataType<JSON> JSON = new DefaultDataType<>(null, JSON.class, "json");
/**
* The {@link JSONB} type.
* <p>
* This is not a SQL or JDBC standard. This type handles JSONB types where
* they are supported
* This is not a JDBC standard. This type handles JSONB types where they are
* supported
*/
public static final DataType<JSONB> JSONB = new DefaultDataType<>(null, JSONB.class, "jsonb");
/**
* The {@link XML} type.
* <p>
* This is not a SQL or JDBC standard. This type handles XML types where
* they are supported
* This is not a JDBC standard. This type handles XML types where they are
* supported
*/
public static final DataType<XML> XML = new DefaultDataType<>(null, XML.class, "xml");
/**
* The {@link Geography} type.
* <p>
* This is not a JDBC standard. This type handles spatial types where they
* are supported.
* <p>
* This data type is supported only by the commercial editions of jOOQ.
*/
public static final DataType<Geography> GEOGRAPHY = new DefaultDataType<>(null, Geography.class, "geography");
/**
* The {@link Geometry} type.
* <p>
* This is not a JDBC standard. This type handles spatial types where they
* are supported.
* <p>
* This data type is supported only by the commercial editions of jOOQ.
*/
public static final DataType<Geometry> GEOMETRY = new DefaultDataType<>(null, Geometry.class, "geometry");
// -------------------------------------------------------------------------
// Static initialisation of dialect-specific data types