[#7312] WIP
This commit is contained in:
parent
cbc2c677a1
commit
c2a5dc320f
@ -68,6 +68,8 @@ public class Settings
|
||||
protected Boolean renderScalarSubqueriesForStoredFunctions = false;
|
||||
@XmlElement(defaultValue = "true")
|
||||
protected Boolean renderOrderByRownumberForEmulatedPagination = true;
|
||||
@XmlElement(defaultValue = "false")
|
||||
protected Boolean transformTableListsToAnsiJoin = false;
|
||||
@XmlElement(defaultValue = "DEFAULT")
|
||||
@XmlSchemaType(name = "string")
|
||||
protected BackslashEscaping backslashEscaping = BackslashEscaping.DEFAULT;
|
||||
@ -500,6 +502,38 @@ public class Settings
|
||||
this.renderOrderByRownumberForEmulatedPagination = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform table lists to ANSI join if possible
|
||||
* <p>
|
||||
* (Very) historically, prior to ANSI join syntax, joins were implemented by listing tables in
|
||||
* the FROM clause and providing join predicates in the WHERE clause, possibly using vendor specific
|
||||
* operators like <code>(+)</code> (Oracle, DB2) or <code>*=</code> (SQL Server) for outer join
|
||||
* support. Migrating such join syntax is tedious. The jOOQ parser can parse the old syntax and
|
||||
* this flag enables the transformation to ANSI join syntax.
|
||||
* <p>
|
||||
* This feature is available in the commercial distribution only.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public Boolean isTransformTableListsToAnsiJoin() {
|
||||
return transformTableListsToAnsiJoin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the transformTableListsToAnsiJoin property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Boolean }
|
||||
*
|
||||
*/
|
||||
public void setTransformTableListsToAnsiJoin(Boolean value) {
|
||||
this.transformTableListsToAnsiJoin = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether string literals should be escaped with backslash.
|
||||
*
|
||||
@ -1438,6 +1472,11 @@ public class Settings
|
||||
return this;
|
||||
}
|
||||
|
||||
public Settings withTransformTableListsToAnsiJoin(Boolean value) {
|
||||
setTransformTableListsToAnsiJoin(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Settings withBackslashEscaping(BackslashEscaping value) {
|
||||
setBackslashEscaping(value);
|
||||
return this;
|
||||
@ -1681,6 +1720,11 @@ public class Settings
|
||||
sb.append(renderOrderByRownumberForEmulatedPagination);
|
||||
sb.append("</renderOrderByRownumberForEmulatedPagination>");
|
||||
}
|
||||
if (transformTableListsToAnsiJoin!= null) {
|
||||
sb.append("<transformTableListsToAnsiJoin>");
|
||||
sb.append(transformTableListsToAnsiJoin);
|
||||
sb.append("</transformTableListsToAnsiJoin>");
|
||||
}
|
||||
if (backslashEscaping!= null) {
|
||||
sb.append("<backslashEscaping>");
|
||||
sb.append(backslashEscaping);
|
||||
@ -1988,6 +2032,15 @@ public class Settings
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (transformTableListsToAnsiJoin == null) {
|
||||
if (other.transformTableListsToAnsiJoin!= null) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!transformTableListsToAnsiJoin.equals(other.transformTableListsToAnsiJoin)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (backslashEscaping == null) {
|
||||
if (other.backslashEscaping!= null) {
|
||||
return false;
|
||||
@ -2323,6 +2376,7 @@ public class Settings
|
||||
result = ((prime*result)+((renderFormatting == null)? 0 :renderFormatting.hashCode()));
|
||||
result = ((prime*result)+((renderScalarSubqueriesForStoredFunctions == null)? 0 :renderScalarSubqueriesForStoredFunctions.hashCode()));
|
||||
result = ((prime*result)+((renderOrderByRownumberForEmulatedPagination == null)? 0 :renderOrderByRownumberForEmulatedPagination.hashCode()));
|
||||
result = ((prime*result)+((transformTableListsToAnsiJoin == null)? 0 :transformTableListsToAnsiJoin.hashCode()));
|
||||
result = ((prime*result)+((backslashEscaping == null)? 0 :backslashEscaping.hashCode()));
|
||||
result = ((prime*result)+((paramType == null)? 0 :paramType.hashCode()));
|
||||
result = ((prime*result)+((paramCastMode == null)? 0 :paramCastMode.hashCode()));
|
||||
|
||||
@ -1306,15 +1306,24 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
;
|
||||
|
||||
List<Condition> semiAntiJoinPredicates = null;
|
||||
ConditionProviderImpl where = getWhere();
|
||||
|
||||
if (hasFrom) {
|
||||
Object previousCollect = context.data(DATA_COLLECT_SEMI_ANTI_JOIN, true);
|
||||
Object previousCollected = context.data(DATA_COLLECTED_SEMI_ANTI_JOIN, null);
|
||||
|
||||
TableList tablelist = getFrom();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
context.formatSeparator()
|
||||
.visit(K_FROM)
|
||||
.sql(' ')
|
||||
.visit(getFrom());
|
||||
.visit(tablelist);
|
||||
|
||||
|
||||
|
||||
@ -1338,7 +1347,6 @@ final class SelectQueryImpl<R extends Record> extends AbstractResultQuery<R> imp
|
||||
// WHERE clause
|
||||
// ------------
|
||||
context.start(SELECT_WHERE);
|
||||
ConditionProviderImpl where = getWhere();
|
||||
|
||||
if (TRUE.equals(context.data().get(BooleanDataKey.DATA_SELECT_NO_DATA)))
|
||||
context.formatSeparator()
|
||||
|
||||
@ -101,6 +101,18 @@ jOOQ to not generate the additional <code>ORDER BY</code> clause.
|
||||
For details, see <a href="https://github.com/jOOQ/jOOQ/issues/7609">https://github.com/jOOQ/jOOQ/issues/7609</a>.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
<element name="transformTableListsToAnsiJoin" type="boolean" minOccurs="0" maxOccurs="1" default="false">
|
||||
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Transform table lists to ANSI join if possible
|
||||
<p>
|
||||
(Very) historically, prior to ANSI join syntax, joins were implemented by listing tables in
|
||||
the FROM clause and providing join predicates in the WHERE clause, possibly using vendor specific
|
||||
operators like <code>(+)</code> (Oracle, DB2) or <code>*=</code> (SQL Server) for outer join
|
||||
support. Migrating such join syntax is tedious. The jOOQ parser can parse the old syntax and
|
||||
this flag enables the transformation to ANSI join syntax.
|
||||
<p>
|
||||
This feature is available in the commercial distribution only.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
<element name="backslashEscaping" type="jooq-runtime:BackslashEscaping" minOccurs="0" maxOccurs="1" default="DEFAULT">
|
||||
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Whether string literals should be escaped with backslash.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user