Skip to content

Commit

Permalink
Remove ThreadLocal layer for static alias singletons, re #12
Browse files Browse the repository at this point in the history
  • Loading branch information
safris committed Aug 31, 2021
1 parent 06e5a81 commit 65c8199
Show file tree
Hide file tree
Showing 28 changed files with 733 additions and 1,154 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public void testWhereEntity(@Schema(classicmodels.class) final Transaction trans
public void testWhereColumn(@Schema(classicmodels.class) final Transaction transaction) throws IOException, SQLException {
final classicmodels.Purchase p = new classicmodels.Purchase();
final classicmodels.Customer c1 = new classicmodels.Customer();
final classicmodels.Customer c2 = classicmodels.Customer();
final classicmodels.Customer c2 = new classicmodels.Customer();
final data.CHAR cn = new data.CHAR();
try (final RowIterator<? extends data.Entity<?>> rows =
SELECT(p, c2.companyName.AS(cn)).
Expand Down Expand Up @@ -128,7 +128,7 @@ public void testJoin(@Schema(classicmodels.class) final Transaction transaction)
final classicmodels.Customer c = new classicmodels.Customer();

final data.BIGINT pd = new data.BIGINT();
final data.SMALLINT pn = data.SMALLINT();
final data.SMALLINT pn = new data.SMALLINT();
try (final RowIterator<? extends data.Entity<?>> rows =
SELECT(c, pd).
FROM(c).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ public void testInsertSelectIntoTable(@Schema(types.class) final Transaction tra
@Ignore("Not sure if this is supported by MERGE")
public void testInsertSelectIntoColumns(@Schema(types.class) final Transaction transaction) throws IOException, SQLException {
final types.Backup b = types.Backup();
final types.Type t1 = types.Type(1);
final types.Type t2 = types.Type(2);
final types.Type t3 = types.Type(3);
final types.Type t1 = new types.Type();
final types.Type t2 = new types.Type();
final types.Type t3 = new types.Type();

DELETE(b)
.execute(transaction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ public void testInsertSelectIntoTable(@Schema(types.class) final Transaction tra
@Ignore("Not sure if this is supported by MERGE")
public void testInsertSelectIntoColumns(@Schema(types.class) final Transaction transaction) throws IOException, SQLException {
final types.Backup b = types.Backup();
final types.Type t1 = types.Type(1);
final types.Type t2 = types.Type(2);
final types.Type t3 = types.Type(3);
final types.Type t1 = new types.Type();
final types.Type t2 = new types.Type();
final types.Type t3 = new types.Type();

DELETE(b)
.execute(transaction);
Expand Down
6 changes: 3 additions & 3 deletions jaxdb-maven-plugin/src/test/java/org/jaxdb/InsertTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ public void testInsertSelectIntoTable(@Schema(types.class) final Transaction tra
@Test
public void testInsertSelectIntoColumns(@Schema(types.class) final Transaction transaction) throws IOException, SQLException {
final types.Backup b = types.Backup();
final types.Type t1 = types.Type(1);
final types.Type t2 = types.Type(2);
final types.Type t3 = types.Type(3);
final types.Type t1 = new types.Type();
final types.Type t2 = new types.Type();
final types.Type t3 = new types.Type();

DELETE(b)
.execute(transaction);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static class RegressionTest extends NumericFunctionStaticTest {

private static Select.untyped.SELECT<data.Entity<?>> selectVicinity(final double latitude, final double longitude, final double distance, final int limit) {
final classicmodels.Customer c = classicmodels.Customer();
final data.DOUBLE d = data.DOUBLE();
final data.DOUBLE d = new data.DOUBLE();

return SELECT(c, MUL(3959 * 2, ATAN2(
SQRT(ADD(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import org.libj.util.ArrayUtil;

public class VendorSchemaRunner extends VendorRunner {
@Target({ElementType.PARAMETER})
@Target(ElementType.PARAMETER)
@Retention(RetentionPolicy.RUNTIME)
public @interface Schema {
Class<? extends org.jaxdb.jsql.Schema> value();
Expand Down
2 changes: 2 additions & 0 deletions jsql/src/main/java/org/jaxdb/jsql/As.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ final class As<V> extends data.Entity<V> {
private final boolean explicit;

As(final Keyword<? extends data.Entity<?>> parent, final data.Entity<?> variable, final boolean explicit) {
super(false);
this.parent = parent;
this.variable = variable;
this.explicit = explicit;
}

As(final Evaluable parent, final data.Entity<?> variable) {
super(false);
this.parent = parent;
this.variable = variable;
this.explicit = true;
Expand Down
2 changes: 1 addition & 1 deletion jsql/src/main/java/org/jaxdb/jsql/Batch.java
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private static int aggregate(final int[] counts, final int[] allCounts, final St
return hasInfo ? total : Statement.SUCCESS_NO_INFO;
}

@SuppressWarnings({"null"})
@SuppressWarnings("null")
private int execute(final Transaction transaction, final String dataSourceId) throws IOException, SQLException {
if (statements == null)
return 0;
Expand Down
56 changes: 28 additions & 28 deletions jsql/src/main/java/org/jaxdb/jsql/BetweenPredicates.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,31 +54,31 @@ final static class NumericBetweenPredicate extends BetweenPredicate {
}

NumericBetweenPredicate(final type.Numeric<?> column, final Number a, final type.Numeric<?> b, final boolean positive) {
this(column, data.Column.wrap(a), b, positive);
this(column, data.wrap(a), b, positive);
}

NumericBetweenPredicate(final type.Numeric<?> column, final type.Numeric<?> a, final Number b, final boolean positive) {
this(column, a, data.Column.wrap(b), positive);
this(column, a, data.wrap(b), positive);
}

NumericBetweenPredicate(final type.Numeric<?> column, final Number a, final Number b, final boolean positive) {
this(column, data.Column.wrap(a), data.Column.wrap(b), positive);
this(column, data.wrap(a), data.wrap(b), positive);
}

NumericBetweenPredicate(final Number value, final type.Numeric<?> a, final type.Numeric<?> b, final boolean positive) {
this(data.Column.wrap(value), a, b, positive);
this(data.wrap(value), a, b, positive);
}

NumericBetweenPredicate(final Number value, final Number a, final type.Numeric<?> b, final boolean positive) {
this(data.Column.wrap(value), data.Column.wrap(a), b, positive);
this(data.wrap(value), data.wrap(a), b, positive);
}

NumericBetweenPredicate(final Number value, final type.Numeric<?> a, final Number b, final boolean positive) {
this(data.Column.wrap(value), a, data.Column.wrap(b), positive);
this(data.wrap(value), a, data.wrap(b), positive);
}

NumericBetweenPredicate(final Number value, final Number a, final Number b, final boolean positive) {
this(data.Column.wrap(value), data.Column.wrap(a), data.Column.wrap(b), positive);
this(data.wrap(value), data.wrap(a), data.wrap(b), positive);
}

@Override
Expand Down Expand Up @@ -114,31 +114,31 @@ final static class TemporalBetweenPredicate extends BetweenPredicate {
}

TemporalBetweenPredicate(final type.Temporal<?> column, final java.time.temporal.Temporal a, final type.Temporal<?> b, final boolean positive) {
this(column, (type.Temporal<?>)data.Column.wrap(a), b, positive);
this(column, (type.Temporal<?>)data.wrap(a), b, positive);
}

TemporalBetweenPredicate(final type.Temporal<?> column, final type.Temporal<?> a, final java.time.temporal.Temporal b, final boolean positive) {
this(column, a, (type.Temporal<?>)data.Column.wrap(b), positive);
this(column, a, (type.Temporal<?>)data.wrap(b), positive);
}

TemporalBetweenPredicate(final type.Temporal<?> column, final java.time.temporal.Temporal a, final java.time.temporal.Temporal b, final boolean positive) {
this(column, (type.Temporal<?>)data.Column.wrap(a), (type.Temporal<?>)data.Column.wrap(b), positive);
this(column, (type.Temporal<?>)data.wrap(a), (type.Temporal<?>)data.wrap(b), positive);
}

TemporalBetweenPredicate(final java.time.temporal.Temporal value, final type.Temporal<?> a, final type.Temporal<?> b, final boolean positive) {
this((type.Temporal<?>)data.Column.wrap(value), a, b, positive);
this((type.Temporal<?>)data.wrap(value), a, b, positive);
}

TemporalBetweenPredicate(final java.time.temporal.Temporal value, final java.time.temporal.Temporal a, final type.Temporal<?> b, final boolean positive) {
this((type.Temporal<?>)data.Column.wrap(value), (type.Temporal<?>)data.Column.wrap(a), b, positive);
this((type.Temporal<?>)data.wrap(value), (type.Temporal<?>)data.wrap(a), b, positive);
}

TemporalBetweenPredicate(final java.time.temporal.Temporal value, final type.Temporal<?> a, final java.time.temporal.Temporal b, final boolean positive) {
this((type.Temporal<?>)data.Column.wrap(value), a, (type.Temporal<?>)data.Column.wrap(b), positive);
this((type.Temporal<?>)data.wrap(value), a, (type.Temporal<?>)data.wrap(b), positive);
}

TemporalBetweenPredicate(final java.time.temporal.Temporal value, final java.time.temporal.Temporal a, final java.time.temporal.Temporal b, final boolean positive) {
this((type.Temporal<?>)data.Column.wrap(value), (type.Temporal<?>)data.Column.wrap(a), (type.Temporal<?>)data.Column.wrap(b), positive);
this((type.Temporal<?>)data.wrap(value), (type.Temporal<?>)data.wrap(a), (type.Temporal<?>)data.wrap(b), positive);
}

@Override
Expand Down Expand Up @@ -174,31 +174,31 @@ final static class TimeBetweenPredicate extends BetweenPredicate {
}

TimeBetweenPredicate(final type.TIME column, final LocalTime a, final type.TIME b, final boolean positive) {
this(column, data.Column.wrap(a), b, positive);
this(column, data.wrap(a), b, positive);
}

TimeBetweenPredicate(final type.TIME column, final type.TIME a, final LocalTime b, final boolean positive) {
this(column, a, data.Column.wrap(b), positive);
this(column, a, data.wrap(b), positive);
}

TimeBetweenPredicate(final type.TIME column, final LocalTime a, final LocalTime b, final boolean positive) {
this(column, data.Column.wrap(a), data.Column.wrap(b), positive);
this(column, data.wrap(a), data.wrap(b), positive);
}

TimeBetweenPredicate(final LocalTime value, final type.TIME a, final type.TIME b, final boolean positive) {
this(data.Column.wrap(value), a, b, positive);
this(data.wrap(value), a, b, positive);
}

TimeBetweenPredicate(final LocalTime value, final LocalTime a, final type.TIME b, final boolean positive) {
this(data.Column.wrap(value), data.Column.wrap(a), b, positive);
this(data.wrap(value), data.wrap(a), b, positive);
}

TimeBetweenPredicate(final LocalTime value, final type.TIME a, final LocalTime b, final boolean positive) {
this(data.Column.wrap(value), a, data.Column.wrap(b), positive);
this(data.wrap(value), a, data.wrap(b), positive);
}

TimeBetweenPredicate(final LocalTime value, final LocalTime a, final LocalTime b, final boolean positive) {
this(data.Column.wrap(value), data.Column.wrap(a), data.Column.wrap(b), positive);
this(data.wrap(value), data.wrap(a), data.wrap(b), positive);
}

@Override
Expand Down Expand Up @@ -234,31 +234,31 @@ final static class TextualBetweenPredicate extends BetweenPredicate {
}

TextualBetweenPredicate(final type.Textual<?> column, final CharSequence a, final type.Textual<?> b, final boolean positive) {
this(column, (type.Textual<?>)data.Column.wrap(a), b, positive);
this(column, (type.Textual<?>)data.wrap(a), b, positive);
}

TextualBetweenPredicate(final type.Textual<?> column, final type.Textual<?> a, final CharSequence b, final boolean positive) {
this(column, a, (type.Textual<?>)data.Column.wrap(b), positive);
this(column, a, (type.Textual<?>)data.wrap(b), positive);
}

TextualBetweenPredicate(final type.Textual<?> column, final CharSequence a, final CharSequence b, final boolean positive) {
this(column, (type.Textual<?>)data.Column.wrap(a), (type.Textual<?>)data.Column.wrap(b), positive);
this(column, (type.Textual<?>)data.wrap(a), (type.Textual<?>)data.wrap(b), positive);
}

TextualBetweenPredicate(final CharSequence value, final type.Textual<?> a, final type.Textual<?> b, final boolean positive) {
this((type.Textual<?>)data.Column.wrap(value), a, b, positive);
this((type.Textual<?>)data.wrap(value), a, b, positive);
}

TextualBetweenPredicate(final CharSequence value, final CharSequence a, final type.Textual<?> b, final boolean positive) {
this((type.Textual<?>)data.Column.wrap(value), (type.Textual<?>)data.Column.wrap(a), b, positive);
this((type.Textual<?>)data.wrap(value), (type.Textual<?>)data.wrap(a), b, positive);
}

TextualBetweenPredicate(final CharSequence value, final type.Textual<?> a, final CharSequence b, final boolean positive) {
this((type.Textual<?>)data.Column.wrap(value), a, (type.Textual<?>)data.Column.wrap(b), positive);
this((type.Textual<?>)data.wrap(value), a, (type.Textual<?>)data.wrap(b), positive);
}

TextualBetweenPredicate(final CharSequence value, final CharSequence a, final CharSequence b, final boolean positive) {
this((type.Textual<?>)data.Column.wrap(value), (type.Textual<?>)data.Column.wrap(a), (type.Textual<?>)data.Column.wrap(b), positive);
this((type.Textual<?>)data.wrap(value), (type.Textual<?>)data.wrap(a), (type.Textual<?>)data.wrap(b), positive);
}

@Override
Expand Down
Loading

0 comments on commit 65c8199

Please sign in to comment.