Permalink
Browse files

Allow StatementGenerator to be configured/replaced by EntityDataStore

  • Loading branch information...
npurushe committed Aug 6, 2018
1 parent 5a44ad0 commit 5f5d7236430e47aea5036f1595940f404c2557aa
@@ -1,5 +1,5 @@
/*
* Copyright 2017 requery.io
* Copyright 2018 requery.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,6 +43,7 @@
import io.requery.query.Update;
import io.requery.query.element.QueryElement;
import io.requery.query.function.Count;
import io.requery.sql.gen.Generator;
import io.requery.sql.gen.StatementGenerator;
import io.requery.sql.platform.PlatformDelegate;
import io.requery.util.ClassMap;
@@ -99,7 +100,7 @@
private PreparedStatementCache statementCache;
private QueryBuilder.Options queryOptions;
private Platform platform;
private StatementGenerator statementGenerator;
private Generator<QueryElement<?>> statementGenerator;
private boolean metadataChecked;
private boolean supportsBatchUpdates;
@@ -600,7 +601,7 @@ protected void checkClosed() {
return context;
}
private class DataContext implements EntityContext<T>, ConnectionProvider {
protected class DataContext implements EntityContext<T>, ConnectionProvider {
@Override
public <E> EntityProxy<E> proxyOf(E entity, boolean forUpdate) {
@@ -719,7 +720,7 @@ public Platform getPlatform() {
}
@Override
public StatementGenerator getStatementGenerator() {
public Generator<QueryElement<?>> getStatementGenerator() {
if (statementGenerator == null) {
statementGenerator = new StatementGenerator(getPlatform());
}
@@ -1,5 +1,5 @@
/*
* Copyright 2016 requery.io
* Copyright 2018 requery.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,8 @@
import io.requery.TransactionIsolation;
import io.requery.TransactionListener;
import io.requery.meta.EntityModel;
import io.requery.sql.gen.StatementGenerator;
import io.requery.query.element.QueryElement;
import io.requery.sql.gen.Generator;
import io.requery.util.function.Supplier;
import java.util.Set;
@@ -36,7 +37,7 @@
Platform getPlatform();
StatementGenerator getStatementGenerator();
Generator<QueryElement<?>> getStatementGenerator();
boolean supportsBatchUpdates();
@@ -1,5 +1,5 @@
/*
* Copyright 2017 requery.io
* Copyright 2018 requery.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -59,7 +59,7 @@
private final Aliases inheritedAliases;
private final boolean parameterize;
private final BoundParameters parameters;
private final StatementGenerator statementGenerator;
private final Generator<QueryElement<?>> statementGenerator;
private final QueryBuilder qb;
private Aliases aliases;
private boolean autoAlias;
@@ -1,5 +1,5 @@
/*
* Copyright 2017 requery.io
* Copyright 2018 requery.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,7 +46,7 @@
private Generator<SetOperationElement> setOperation;
public StatementGenerator(Platform platform) {
// TODO eventually all parts will be overridable
// TODO eventually all parts will be overridable by the platform
select = new SelectGenerator();
insert = platform.insertGenerator();
update = platform.updateGenerator();

0 comments on commit 5f5d723

Please sign in to comment.