mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-13 21:01:01 +08:00
Merge pull request #2263 from querydsl/improvement/sql-backwards-compat
Improve backwards compatibility
This commit is contained in:
commit
ad14e400ac
8
pom.xml
8
pom.xml
@ -287,6 +287,14 @@
|
||||
<exclude>com/querydsl/core/types/dsl/PathBuilderValidator</exclude>
|
||||
<exclude>com/querydsl/sql/Union</exclude>
|
||||
<exclude>com/querydsl/sql/SQLListenerContextImpl</exclude>
|
||||
<exclude>com/querydsl/sql/dml/SQLDeleteClause</exclude>
|
||||
<exclude>com/querydsl/sql/dml/SQLInsertClause</exclude>
|
||||
<exclude>com/querydsl/sql/dml/SQLUpdateClause</exclude>
|
||||
<exclude>com/querydsl/sql/mssql/SQLServerQuery</exclude>
|
||||
<exclude>com/querydsl/sql/mysql/MySQLQuery</exclude>
|
||||
<exclude>com/querydsl/sql/oracle/OracleQuery</exclude>
|
||||
<exclude>com/querydsl/sql/postgresql/PostgreSQLQuery</exclude>
|
||||
<exclude>com/querydsl/sql/teradata/TeradataQuery</exclude>
|
||||
</excludes>
|
||||
<compatibilityType>BACKWARD_COMPATIBLE_USER</compatibilityType>
|
||||
<dumpDetails>true</dumpDetails>
|
||||
|
||||
@ -26,6 +26,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
|
||||
import com.querydsl.core.*;
|
||||
import com.querydsl.core.QueryFlag.Position;
|
||||
import com.querydsl.core.dml.DeleteClause;
|
||||
@ -44,7 +45,7 @@ import com.querydsl.sql.SQLSerializer;
|
||||
* @param <C> The type extending this class.
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractSQLDeleteClause<C extends AbstractSQLClause<C> & DeleteClause<C>> extends AbstractSQLClause<C> implements DeleteClause<C> {
|
||||
public abstract class AbstractSQLDeleteClause<C extends AbstractSQLDeleteClause<C>> extends AbstractSQLClause<C> implements DeleteClause<C> {
|
||||
|
||||
protected static final Logger logger = LoggerFactory.getLogger(AbstractSQLDeleteClause.class);
|
||||
|
||||
@ -83,6 +84,7 @@ public abstract class AbstractSQLDeleteClause<C extends AbstractSQLClause<C> & D
|
||||
* @param flag query flag
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(SQLDeleteClause.class)
|
||||
public C addFlag(Position position, String flag) {
|
||||
metadata.addFlag(new QueryFlag(position, flag));
|
||||
return (C) this;
|
||||
@ -95,6 +97,7 @@ public abstract class AbstractSQLDeleteClause<C extends AbstractSQLClause<C> & D
|
||||
* @param flag query flag
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(SQLDeleteClause.class)
|
||||
public C addFlag(Position position, Expression<?> flag) {
|
||||
metadata.addFlag(new QueryFlag(position, flag));
|
||||
return (C) this;
|
||||
@ -105,6 +108,7 @@ public abstract class AbstractSQLDeleteClause<C extends AbstractSQLClause<C> & D
|
||||
*
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(SQLDeleteClause.class)
|
||||
public C addBatch() {
|
||||
batches.add(metadata);
|
||||
metadata = new DefaultQueryMetadata();
|
||||
@ -246,12 +250,14 @@ public abstract class AbstractSQLDeleteClause<C extends AbstractSQLClause<C> & D
|
||||
}
|
||||
}
|
||||
|
||||
@WithBridgeMethods(SQLDeleteClause.class)
|
||||
public C where(Predicate p) {
|
||||
metadata.addWhere(p);
|
||||
return (C) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@WithBridgeMethods(SQLDeleteClause.class)
|
||||
public C where(Predicate... o) {
|
||||
for (Predicate p : o) {
|
||||
metadata.addWhere(p);
|
||||
@ -259,6 +265,7 @@ public abstract class AbstractSQLDeleteClause<C extends AbstractSQLClause<C> & D
|
||||
return (C) this;
|
||||
}
|
||||
|
||||
@WithBridgeMethods(SQLDeleteClause.class)
|
||||
public C limit(@Nonnegative long limit) {
|
||||
metadata.setModifiers(QueryModifiers.limit(limit));
|
||||
return (C) this;
|
||||
|
||||
@ -24,6 +24,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
|
||||
import com.querydsl.core.DefaultQueryMetadata;
|
||||
import com.querydsl.core.JoinType;
|
||||
import com.querydsl.core.QueryFlag;
|
||||
@ -42,7 +43,7 @@ import com.querydsl.sql.types.Null;
|
||||
* @param <C> The type extending this class.
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractSQLInsertClause<C extends AbstractSQLClause<C> & InsertClause<C>> extends AbstractSQLClause<C> implements InsertClause<C> {
|
||||
public abstract class AbstractSQLInsertClause<C extends AbstractSQLInsertClause<C>> extends AbstractSQLClause<C> implements InsertClause<C> {
|
||||
|
||||
protected static final Logger logger = LoggerFactory.getLogger(AbstractSQLInsertClause.class);
|
||||
|
||||
@ -97,6 +98,7 @@ public abstract class AbstractSQLInsertClause<C extends AbstractSQLClause<C> & I
|
||||
* @param flag query flag
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(SQLInsertClause.class)
|
||||
public C addFlag(Position position, String flag) {
|
||||
metadata.addFlag(new QueryFlag(position, flag));
|
||||
return (C) this;
|
||||
@ -109,6 +111,7 @@ public abstract class AbstractSQLInsertClause<C extends AbstractSQLClause<C> & I
|
||||
* @param flag query flag
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(SQLInsertClause.class)
|
||||
public C addFlag(Position position, Expression<?> flag) {
|
||||
metadata.addFlag(new QueryFlag(position, flag));
|
||||
return (C) this;
|
||||
@ -119,6 +122,7 @@ public abstract class AbstractSQLInsertClause<C extends AbstractSQLClause<C> & I
|
||||
*
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(SQLInsertClause.class)
|
||||
public C addBatch() {
|
||||
if (subQueryBuilder != null) {
|
||||
subQuery = subQueryBuilder.select(values.toArray(new Expression[values.size()])).clone();
|
||||
@ -148,6 +152,7 @@ public abstract class AbstractSQLInsertClause<C extends AbstractSQLClause<C> & I
|
||||
}
|
||||
|
||||
@Override
|
||||
@WithBridgeMethods(SQLInsertClause.class)
|
||||
public C columns(Path<?>... columns) {
|
||||
this.columns.addAll(Arrays.asList(columns));
|
||||
return (C) this;
|
||||
@ -463,6 +468,7 @@ public abstract class AbstractSQLInsertClause<C extends AbstractSQLClause<C> & I
|
||||
}
|
||||
|
||||
@Override
|
||||
@WithBridgeMethods(SQLInsertClause.class)
|
||||
public C select(SubQueryExpression<?> sq) {
|
||||
subQuery = sq;
|
||||
for (Map.Entry<ParamExpression<?>, Object> entry : sq.getMetadata().getParams().entrySet()) {
|
||||
@ -472,6 +478,7 @@ public abstract class AbstractSQLInsertClause<C extends AbstractSQLClause<C> & I
|
||||
}
|
||||
|
||||
@Override
|
||||
@WithBridgeMethods(SQLInsertClause.class)
|
||||
public <T> C set(Path<T> path, T value) {
|
||||
columns.add(path);
|
||||
if (value instanceof Expression<?>) {
|
||||
@ -485,6 +492,7 @@ public abstract class AbstractSQLInsertClause<C extends AbstractSQLClause<C> & I
|
||||
}
|
||||
|
||||
@Override
|
||||
@WithBridgeMethods(SQLInsertClause.class)
|
||||
public <T> C set(Path<T> path, Expression<? extends T> expression) {
|
||||
columns.add(path);
|
||||
values.add(expression);
|
||||
@ -492,6 +500,7 @@ public abstract class AbstractSQLInsertClause<C extends AbstractSQLClause<C> & I
|
||||
}
|
||||
|
||||
@Override
|
||||
@WithBridgeMethods(SQLInsertClause.class)
|
||||
public <T> C setNull(Path<T> path) {
|
||||
columns.add(path);
|
||||
values.add(Null.CONSTANT);
|
||||
@ -499,6 +508,7 @@ public abstract class AbstractSQLInsertClause<C extends AbstractSQLClause<C> & I
|
||||
}
|
||||
|
||||
@Override
|
||||
@WithBridgeMethods(SQLInsertClause.class)
|
||||
public C values(Object... v) {
|
||||
for (Object value : v) {
|
||||
if (value instanceof Expression<?>) {
|
||||
@ -530,6 +540,7 @@ public abstract class AbstractSQLInsertClause<C extends AbstractSQLClause<C> & I
|
||||
* @param bean bean to use for population
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(SQLInsertClause.class)
|
||||
public C populate(Object bean) {
|
||||
return populate(bean, DefaultMapper.DEFAULT);
|
||||
}
|
||||
@ -543,6 +554,7 @@ public abstract class AbstractSQLInsertClause<C extends AbstractSQLClause<C> & I
|
||||
* @return the current object
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
@WithBridgeMethods(SQLInsertClause.class)
|
||||
public <T> C populate(T obj, Mapper<T> mapper) {
|
||||
Map<Path<?>, Object> values = mapper.createMap(entity, obj);
|
||||
for (Map.Entry<Path<?>, Object> entry : values.entrySet()) {
|
||||
|
||||
@ -26,6 +26,7 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
|
||||
import com.querydsl.core.*;
|
||||
import com.querydsl.core.QueryFlag.Position;
|
||||
import com.querydsl.core.dml.UpdateClause;
|
||||
@ -46,7 +47,7 @@ import com.querydsl.sql.types.Null;
|
||||
* @param <C> The type extending this class.
|
||||
*
|
||||
*/
|
||||
public abstract class AbstractSQLUpdateClause<C extends AbstractSQLClause<C> & UpdateClause<C>> extends AbstractSQLClause<C> implements UpdateClause<C> {
|
||||
public abstract class AbstractSQLUpdateClause<C extends AbstractSQLUpdateClause<C>> extends AbstractSQLClause<C> implements UpdateClause<C> {
|
||||
|
||||
protected static final Logger logger = LoggerFactory.getLogger(AbstractSQLUpdateClause.class);
|
||||
|
||||
@ -81,6 +82,7 @@ public abstract class AbstractSQLUpdateClause<C extends AbstractSQLClause<C> & U
|
||||
* @param flag query flag
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(SQLUpdateClause.class)
|
||||
public C addFlag(Position position, String flag) {
|
||||
metadata.addFlag(new QueryFlag(position, flag));
|
||||
return (C) this;
|
||||
@ -93,6 +95,7 @@ public abstract class AbstractSQLUpdateClause<C extends AbstractSQLClause<C> & U
|
||||
* @param flag query flag
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(SQLUpdateClause.class)
|
||||
public C addFlag(Position position, Expression<?> flag) {
|
||||
metadata.addFlag(new QueryFlag(position, flag));
|
||||
return (C) this;
|
||||
@ -103,6 +106,7 @@ public abstract class AbstractSQLUpdateClause<C extends AbstractSQLClause<C> & U
|
||||
*
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(SQLUpdateClause.class)
|
||||
public C addBatch() {
|
||||
batches.add(new SQLUpdateBatch(metadata, updates));
|
||||
updates = Maps.newLinkedHashMap();
|
||||
@ -245,6 +249,7 @@ public abstract class AbstractSQLUpdateClause<C extends AbstractSQLClause<C> & U
|
||||
}
|
||||
|
||||
@Override
|
||||
@WithBridgeMethods(SQLUpdateClause.class)
|
||||
public <T> C set(Path<T> path, T value) {
|
||||
if (value instanceof Expression<?>) {
|
||||
updates.put(path, (Expression<?>) value);
|
||||
@ -257,6 +262,7 @@ public abstract class AbstractSQLUpdateClause<C extends AbstractSQLClause<C> & U
|
||||
}
|
||||
|
||||
@Override
|
||||
@WithBridgeMethods(SQLUpdateClause.class)
|
||||
public <T> C set(Path<T> path, Expression<? extends T> expression) {
|
||||
if (expression != null) {
|
||||
updates.put(path, expression);
|
||||
@ -267,12 +273,14 @@ public abstract class AbstractSQLUpdateClause<C extends AbstractSQLClause<C> & U
|
||||
}
|
||||
|
||||
@Override
|
||||
@WithBridgeMethods(SQLUpdateClause.class)
|
||||
public <T> C setNull(Path<T> path) {
|
||||
updates.put(path, Null.CONSTANT);
|
||||
return (C) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@WithBridgeMethods(SQLUpdateClause.class)
|
||||
public C set(List<? extends Path<?>> paths, List<?> values) {
|
||||
for (int i = 0; i < paths.size(); i++) {
|
||||
if (values.get(i) instanceof Expression) {
|
||||
@ -286,12 +294,14 @@ public abstract class AbstractSQLUpdateClause<C extends AbstractSQLClause<C> & U
|
||||
return (C) this;
|
||||
}
|
||||
|
||||
@WithBridgeMethods(SQLUpdateClause.class)
|
||||
public C where(Predicate p) {
|
||||
metadata.addWhere(p);
|
||||
return (C) this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@WithBridgeMethods(SQLUpdateClause.class)
|
||||
public C where(Predicate... o) {
|
||||
for (Predicate p : o) {
|
||||
metadata.addWhere(p);
|
||||
@ -299,6 +309,7 @@ public abstract class AbstractSQLUpdateClause<C extends AbstractSQLClause<C> & U
|
||||
return (C) this;
|
||||
}
|
||||
|
||||
@WithBridgeMethods(SQLUpdateClause.class)
|
||||
public C limit(@Nonnegative long limit) {
|
||||
metadata.setModifiers(QueryModifiers.limit(limit));
|
||||
return (C) this;
|
||||
@ -320,6 +331,7 @@ public abstract class AbstractSQLUpdateClause<C extends AbstractSQLClause<C> & U
|
||||
* @return the current object
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@WithBridgeMethods(SQLUpdateClause.class)
|
||||
public C populate(Object bean) {
|
||||
return populate(bean, DefaultMapper.DEFAULT);
|
||||
}
|
||||
@ -332,6 +344,7 @@ public abstract class AbstractSQLUpdateClause<C extends AbstractSQLClause<C> & U
|
||||
* @return the current object
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@WithBridgeMethods(SQLUpdateClause.class)
|
||||
public <T> C populate(T obj, Mapper<T> mapper) {
|
||||
Collection<? extends Path<?>> primaryKeyColumns = entity.getPrimaryKey() != null
|
||||
? entity.getPrimaryKey().getLocalColumns()
|
||||
|
||||
@ -17,6 +17,7 @@ import java.sql.Connection;
|
||||
|
||||
import javax.inject.Provider;
|
||||
|
||||
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
|
||||
import com.querydsl.core.JoinFlag;
|
||||
import com.querydsl.core.QueryMetadata;
|
||||
import com.querydsl.sql.AbstractSQLQuery;
|
||||
@ -30,7 +31,7 @@ import com.querydsl.sql.Configuration;
|
||||
*
|
||||
* @author tiwe
|
||||
*/
|
||||
public abstract class AbstractSQLServerQuery<T, C extends AbstractSQLQuery<T,C>> extends AbstractSQLQuery<T, C> {
|
||||
public abstract class AbstractSQLServerQuery<T, C extends AbstractSQLServerQuery<T,C>> extends AbstractSQLQuery<T, C> {
|
||||
public AbstractSQLServerQuery(Connection conn, Configuration configuration, QueryMetadata metadata) {
|
||||
super(conn, configuration, metadata);
|
||||
}
|
||||
@ -45,6 +46,7 @@ public abstract class AbstractSQLServerQuery<T, C extends AbstractSQLQuery<T,C>>
|
||||
* @param tableHints table hints
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(SQLServerQuery.class)
|
||||
public C tableHints(SQLServerTableHints... tableHints) {
|
||||
if (tableHints.length > 0) {
|
||||
String hints = SQLServerGrammar.tableHints(tableHints);
|
||||
|
||||
@ -19,6 +19,7 @@ import java.sql.Connection;
|
||||
import javax.inject.Provider;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
|
||||
import com.querydsl.core.JoinFlag;
|
||||
import com.querydsl.core.QueryFlag.Position;
|
||||
import com.querydsl.core.QueryMetadata;
|
||||
@ -34,7 +35,7 @@ import com.querydsl.sql.SQLQuery;
|
||||
* @param <T> result type
|
||||
* @param <C> the concrete subtype
|
||||
*/
|
||||
public abstract class AbstractMySQLQuery<T, C extends AbstractSQLQuery<T, C>> extends AbstractSQLQuery<T, C> {
|
||||
public abstract class AbstractMySQLQuery<T, C extends AbstractMySQLQuery<T, C>> extends AbstractSQLQuery<T, C> {
|
||||
|
||||
protected static final String WITH_ROLLUP = "\nwith rollup ";
|
||||
|
||||
@ -72,6 +73,7 @@ public abstract class AbstractMySQLQuery<T, C extends AbstractSQLQuery<T, C>> ex
|
||||
*
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(MySQLQuery.class)
|
||||
public C bigResult() {
|
||||
return addFlag(Position.AFTER_SELECT, SQL_BIG_RESULT);
|
||||
}
|
||||
@ -84,6 +86,7 @@ public abstract class AbstractMySQLQuery<T, C extends AbstractSQLQuery<T, C>> ex
|
||||
*
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(MySQLQuery.class)
|
||||
public C bufferResult() {
|
||||
return addFlag(Position.AFTER_SELECT, SQL_BUFFER_RESULT);
|
||||
}
|
||||
@ -94,6 +97,7 @@ public abstract class AbstractMySQLQuery<T, C extends AbstractSQLQuery<T, C>> ex
|
||||
*
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(MySQLQuery.class)
|
||||
public C cache() {
|
||||
return addFlag(Position.AFTER_SELECT, SQL_CACHE);
|
||||
}
|
||||
@ -104,6 +108,7 @@ public abstract class AbstractMySQLQuery<T, C extends AbstractSQLQuery<T, C>> ex
|
||||
*
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(MySQLQuery.class)
|
||||
public C calcFoundRows() {
|
||||
return addFlag(Position.AFTER_SELECT, SQL_CALC_FOUND_ROWS);
|
||||
}
|
||||
@ -114,6 +119,7 @@ public abstract class AbstractMySQLQuery<T, C extends AbstractSQLQuery<T, C>> ex
|
||||
*
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(MySQLQuery.class)
|
||||
public C highPriority() {
|
||||
return addFlag(Position.AFTER_SELECT, HIGH_PRIORITY);
|
||||
}
|
||||
@ -124,6 +130,7 @@ public abstract class AbstractMySQLQuery<T, C extends AbstractSQLQuery<T, C>> ex
|
||||
* @param var variable name
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(MySQLQuery.class)
|
||||
public C into(String var) {
|
||||
return addFlag(Position.END, "\ninto " + var);
|
||||
}
|
||||
@ -134,6 +141,7 @@ public abstract class AbstractMySQLQuery<T, C extends AbstractSQLQuery<T, C>> ex
|
||||
* @param file file to write to
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(MySQLQuery.class)
|
||||
public C intoDumpfile(File file) {
|
||||
return addFlag(Position.END, "\ninto dumpfile '" + file.getPath() + "'");
|
||||
}
|
||||
@ -145,6 +153,7 @@ public abstract class AbstractMySQLQuery<T, C extends AbstractSQLQuery<T, C>> ex
|
||||
* @param file file to write to
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(MySQLQuery.class)
|
||||
public C intoOutfile(File file) {
|
||||
return addFlag(Position.END, "\ninto outfile '" + file.getPath() + "'");
|
||||
}
|
||||
@ -155,6 +164,7 @@ public abstract class AbstractMySQLQuery<T, C extends AbstractSQLQuery<T, C>> ex
|
||||
*
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(MySQLQuery.class)
|
||||
public C lockInShareMode() {
|
||||
return addFlag(Position.END, LOCK_IN_SHARE_MODE);
|
||||
}
|
||||
@ -165,6 +175,7 @@ public abstract class AbstractMySQLQuery<T, C extends AbstractSQLQuery<T, C>> ex
|
||||
*
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(MySQLQuery.class)
|
||||
public C noCache() {
|
||||
return addFlag(Position.AFTER_SELECT, SQL_NO_CACHE);
|
||||
}
|
||||
@ -175,6 +186,7 @@ public abstract class AbstractMySQLQuery<T, C extends AbstractSQLQuery<T, C>> ex
|
||||
*
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(MySQLQuery.class)
|
||||
public C smallResult() {
|
||||
return addFlag(Position.AFTER_SELECT, SQL_SMALL_RESULT);
|
||||
}
|
||||
@ -186,6 +198,7 @@ public abstract class AbstractMySQLQuery<T, C extends AbstractSQLQuery<T, C>> ex
|
||||
*
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(MySQLQuery.class)
|
||||
public C straightJoin() {
|
||||
return addFlag(Position.AFTER_SELECT, STRAIGHT_JOIN);
|
||||
}
|
||||
@ -198,6 +211,7 @@ public abstract class AbstractMySQLQuery<T, C extends AbstractSQLQuery<T, C>> ex
|
||||
* @param indexes index names
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(MySQLQuery.class)
|
||||
public C forceIndex(String... indexes) {
|
||||
return addJoinFlag(" force index (" + JOINER.join(indexes) + ")", JoinFlag.Position.END);
|
||||
}
|
||||
@ -209,6 +223,7 @@ public abstract class AbstractMySQLQuery<T, C extends AbstractSQLQuery<T, C>> ex
|
||||
* @param indexes index names
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(MySQLQuery.class)
|
||||
public C ignoreIndex(String... indexes) {
|
||||
return addJoinFlag(" ignore index (" + JOINER.join(indexes) + ")", JoinFlag.Position.END);
|
||||
}
|
||||
@ -220,6 +235,7 @@ public abstract class AbstractMySQLQuery<T, C extends AbstractSQLQuery<T, C>> ex
|
||||
* @param indexes index names
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(MySQLQuery.class)
|
||||
public C useIndex(String... indexes) {
|
||||
return addJoinFlag(" use index (" + JOINER.join(indexes) + ")", JoinFlag.Position.END);
|
||||
}
|
||||
@ -232,6 +248,7 @@ public abstract class AbstractMySQLQuery<T, C extends AbstractSQLQuery<T, C>> ex
|
||||
*
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(MySQLQuery.class)
|
||||
public C withRollup() {
|
||||
return addFlag(Position.AFTER_GROUP_BY, WITH_ROLLUP);
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@ import java.sql.Connection;
|
||||
|
||||
import javax.inject.Provider;
|
||||
|
||||
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
|
||||
import com.querydsl.core.QueryFlag.Position;
|
||||
import com.querydsl.core.QueryMetadata;
|
||||
import com.querydsl.core.types.Expression;
|
||||
@ -31,7 +32,7 @@ import com.querydsl.sql.Configuration;
|
||||
* @param <T> result type
|
||||
* @param <C> the concrete subtype
|
||||
*/
|
||||
public abstract class AbstractOracleQuery<T, C extends AbstractSQLQuery<T, C>> extends AbstractSQLQuery<T, C> {
|
||||
public abstract class AbstractOracleQuery<T, C extends AbstractOracleQuery<T, C>> extends AbstractSQLQuery<T, C> {
|
||||
|
||||
protected static final String CONNECT_BY = "\nconnect by ";
|
||||
|
||||
@ -57,6 +58,7 @@ public abstract class AbstractOracleQuery<T, C extends AbstractSQLQuery<T, C>> e
|
||||
* @param cond condition
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(OracleQuery.class)
|
||||
public C connectByPrior(Predicate cond) {
|
||||
return addFlag(Position.BEFORE_ORDER, CONNECT_BY_PRIOR, cond);
|
||||
}
|
||||
@ -67,6 +69,7 @@ public abstract class AbstractOracleQuery<T, C extends AbstractSQLQuery<T, C>> e
|
||||
* @param cond condition
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(OracleQuery.class)
|
||||
public C connectBy(Predicate cond) {
|
||||
return addFlag(Position.BEFORE_ORDER, CONNECT_BY, cond);
|
||||
}
|
||||
@ -77,6 +80,7 @@ public abstract class AbstractOracleQuery<T, C extends AbstractSQLQuery<T, C>> e
|
||||
* @param cond condition
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(OracleQuery.class)
|
||||
public C connectByNocyclePrior(Predicate cond) {
|
||||
return addFlag(Position.BEFORE_ORDER, CONNECT_BY_NOCYCLE_PRIOR, cond);
|
||||
}
|
||||
@ -87,6 +91,7 @@ public abstract class AbstractOracleQuery<T, C extends AbstractSQLQuery<T, C>> e
|
||||
* @param cond condition
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(OracleQuery.class)
|
||||
public <A> C startWith(Predicate cond) {
|
||||
return addFlag(Position.BEFORE_ORDER, START_WITH, cond);
|
||||
}
|
||||
@ -98,6 +103,7 @@ public abstract class AbstractOracleQuery<T, C extends AbstractSQLQuery<T, C>> e
|
||||
* @param path path
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(OracleQuery.class)
|
||||
public C orderSiblingsBy(Expression<?> path) {
|
||||
return addFlag(Position.BEFORE_ORDER, ORDER_SIBLINGS_BY, path);
|
||||
}
|
||||
|
||||
@ -17,6 +17,7 @@ import java.sql.Connection;
|
||||
|
||||
import javax.inject.Provider;
|
||||
|
||||
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
|
||||
import com.querydsl.core.QueryFlag;
|
||||
import com.querydsl.core.QueryFlag.Position;
|
||||
import com.querydsl.core.QueryMetadata;
|
||||
@ -37,7 +38,7 @@ import com.querydsl.sql.SQLQuery;
|
||||
* @see SQLQuery
|
||||
* @author tiwe
|
||||
*/
|
||||
public abstract class AbstractPostgreSQLQuery<T, C extends AbstractSQLQuery<T, C>> extends AbstractSQLQuery<T, C> {
|
||||
public abstract class AbstractPostgreSQLQuery<T, C extends AbstractPostgreSQLQuery<T, C>> extends AbstractSQLQuery<T, C> {
|
||||
public AbstractPostgreSQLQuery(Connection conn, Configuration configuration, QueryMetadata metadata) {
|
||||
super(conn, configuration, metadata);
|
||||
}
|
||||
@ -51,6 +52,7 @@ public abstract class AbstractPostgreSQLQuery<T, C extends AbstractSQLQuery<T, C
|
||||
*
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(PostgreSQLQuery.class)
|
||||
public C forShare() {
|
||||
// global forShare support was added later, delegating to super implementation
|
||||
return super.forShare();
|
||||
@ -62,6 +64,7 @@ public abstract class AbstractPostgreSQLQuery<T, C extends AbstractSQLQuery<T, C
|
||||
*
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(PostgreSQLQuery.class)
|
||||
public C noWait() {
|
||||
QueryFlag noWaitFlag = configuration.getTemplates().getNoWaitFlag();
|
||||
return addFlag(noWaitFlag);
|
||||
@ -73,6 +76,7 @@ public abstract class AbstractPostgreSQLQuery<T, C extends AbstractSQLQuery<T, C
|
||||
* @param paths tables
|
||||
* @return the current object
|
||||
*/
|
||||
@WithBridgeMethods(PostgreSQLQuery.class)
|
||||
public C of(RelationalPath<?>... paths) {
|
||||
StringBuilder builder = new StringBuilder(" of ");
|
||||
for (RelationalPath<?> path : paths) {
|
||||
@ -90,6 +94,7 @@ public abstract class AbstractPostgreSQLQuery<T, C extends AbstractSQLQuery<T, C
|
||||
* @param exprs
|
||||
* @return
|
||||
*/
|
||||
@WithBridgeMethods(PostgreSQLQuery.class)
|
||||
public C distinctOn(Expression<?>... exprs) {
|
||||
return addFlag(Position.AFTER_SELECT,
|
||||
Expressions.template(Object.class, "distinct on({0}) ",
|
||||
|
||||
@ -32,7 +32,7 @@ import com.querydsl.sql.TeradataTemplates;
|
||||
*
|
||||
* @author tiwe
|
||||
*/
|
||||
public abstract class AbstractTeradataQuery<T, C extends AbstractSQLQuery<T, C>> extends AbstractSQLQuery<T, C> {
|
||||
public abstract class AbstractTeradataQuery<T, C extends AbstractTeradataQuery<T, C>> extends AbstractSQLQuery<T, C> {
|
||||
public AbstractTeradataQuery(Connection conn) {
|
||||
this(conn, new Configuration(TeradataTemplates.DEFAULT), new DefaultQueryMetadata());
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user