[#8206] Add new Settings.inlineThreshold
This commit is contained in:
parent
7736f51a64
commit
ca1b59badc
@ -80,6 +80,8 @@ public class Settings
|
||||
@XmlElement(defaultValue = "PREPARED_STATEMENT")
|
||||
@XmlSchemaType(name = "string")
|
||||
protected StatementType statementType = StatementType.PREPARED_STATEMENT;
|
||||
@XmlElement(defaultValue = "0")
|
||||
protected Integer inlineThreshold = 0;
|
||||
@XmlElement(defaultValue = "true")
|
||||
protected Boolean executeLogging = true;
|
||||
@XmlElement(defaultValue = "false")
|
||||
@ -604,6 +606,38 @@ public class Settings
|
||||
this.statementType = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* The maximum number of allowed bind variables before inlining all values where <code>0</code> uses the dialect defaults: <ul>
|
||||
* <li>{@link org.jooq.SQLDialect#ACCESS} : 768</li>
|
||||
* <li>{@link org.jooq.SQLDialect#ASE} : 2000</li>
|
||||
* <li>{@link org.jooq.SQLDialect#INGRES} : 1024</li>
|
||||
* <li>{@link org.jooq.SQLDialect#ORACLE} : 32767</li>
|
||||
* <li>{@link org.jooq.SQLDialect#POSTGRES} : 32767</li>
|
||||
* <li>{@link org.jooq.SQLDialect#SQLITE} : 999</li>
|
||||
* <li>{@link org.jooq.SQLDialect#SQLSERVER} : 2100</li>
|
||||
* </ul>
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Integer }
|
||||
*
|
||||
*/
|
||||
public Integer getInlineThreshold() {
|
||||
return inlineThreshold;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the inlineThreshold property.
|
||||
*
|
||||
* @param value
|
||||
* allowed object is
|
||||
* {@link Integer }
|
||||
*
|
||||
*/
|
||||
public void setInlineThreshold(Integer value) {
|
||||
this.inlineThreshold = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* When set to true, this will add jOOQ's default logging ExecuteListeners.
|
||||
*
|
||||
@ -1424,6 +1458,11 @@ public class Settings
|
||||
return this;
|
||||
}
|
||||
|
||||
public Settings withInlineThreshold(Integer value) {
|
||||
setInlineThreshold(value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Settings withExecuteLogging(Boolean value) {
|
||||
setExecuteLogging(value);
|
||||
return this;
|
||||
@ -1662,6 +1701,11 @@ public class Settings
|
||||
sb.append(statementType);
|
||||
sb.append("</statementType>");
|
||||
}
|
||||
if (inlineThreshold!= null) {
|
||||
sb.append("<inlineThreshold>");
|
||||
sb.append(inlineThreshold);
|
||||
sb.append("</inlineThreshold>");
|
||||
}
|
||||
if (executeLogging!= null) {
|
||||
sb.append("<executeLogging>");
|
||||
sb.append(executeLogging);
|
||||
@ -1980,6 +2024,15 @@ public class Settings
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (inlineThreshold == null) {
|
||||
if (other.inlineThreshold!= null) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!inlineThreshold.equals(other.inlineThreshold)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (executeLogging == null) {
|
||||
if (other.executeLogging!= null) {
|
||||
return false;
|
||||
@ -2274,6 +2327,7 @@ public class Settings
|
||||
result = ((prime*result)+((paramType == null)? 0 :paramType.hashCode()));
|
||||
result = ((prime*result)+((paramCastMode == null)? 0 :paramCastMode.hashCode()));
|
||||
result = ((prime*result)+((statementType == null)? 0 :statementType.hashCode()));
|
||||
result = ((prime*result)+((inlineThreshold == null)? 0 :inlineThreshold.hashCode()));
|
||||
result = ((prime*result)+((executeLogging == null)? 0 :executeLogging.hashCode()));
|
||||
result = ((prime*result)+((executeWithOptimisticLocking == null)? 0 :executeWithOptimisticLocking.hashCode()));
|
||||
result = ((prime*result)+((executeWithOptimisticLockingExcludeUnversioned == null)? 0 :executeWithOptimisticLockingExcludeUnversioned.hashCode()));
|
||||
|
||||
@ -526,7 +526,12 @@ class DefaultRenderContext extends AbstractContext<RenderContext> implements Ren
|
||||
if (!param.isInline()) {
|
||||
bindValues.add(param);
|
||||
|
||||
switch (family()) {
|
||||
Integer threshold = settings().getInlineThreshold();
|
||||
if (threshold != null && threshold > 0) {
|
||||
checkForceInline(threshold);
|
||||
}
|
||||
else {
|
||||
switch (family()) {
|
||||
|
||||
|
||||
|
||||
@ -554,17 +559,18 @@ class DefaultRenderContext extends AbstractContext<RenderContext> implements Ren
|
||||
|
||||
|
||||
|
||||
// [#5701] Tests were conducted with PostgreSQL 9.5 and pgjdbc 9.4.1209
|
||||
case POSTGRES:
|
||||
checkForceInline(32767);
|
||||
break;
|
||||
// [#5701] Tests were conducted with PostgreSQL 9.5 and pgjdbc 9.4.1209
|
||||
case POSTGRES:
|
||||
checkForceInline(32767);
|
||||
break;
|
||||
|
||||
case SQLITE:
|
||||
checkForceInline(999);
|
||||
break;
|
||||
case SQLITE:
|
||||
checkForceInline(999);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -127,6 +127,18 @@ case of which, this defaults to INLINED]]></jxb:javadoc></jxb:property></appinfo
|
||||
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[The type of statement that is to be executed.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
<element name="inlineThreshold" type="int" minOccurs="0" maxOccurs="1" default="0">
|
||||
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[The maximum number of allowed bind variables before inlining all values where <code>0</code> uses the dialect defaults: <ul>
|
||||
<li>{@link org.jooq.SQLDialect#ACCESS} : 768</li>
|
||||
<li>{@link org.jooq.SQLDialect#ASE} : 2000</li>
|
||||
<li>{@link org.jooq.SQLDialect#INGRES} : 1024</li>
|
||||
<li>{@link org.jooq.SQLDialect#ORACLE} : 32767</li>
|
||||
<li>{@link org.jooq.SQLDialect#POSTGRES} : 32767</li>
|
||||
<li>{@link org.jooq.SQLDialect#SQLITE} : 999</li>
|
||||
<li>{@link org.jooq.SQLDialect#SQLSERVER} : 2100</li>
|
||||
</ul>]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
<element name="executeLogging" type="boolean" minOccurs="0" maxOccurs="1" default="true">
|
||||
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[When set to true, this will add jOOQ's default logging ExecuteListeners.]]></jxb:javadoc></jxb:property></appinfo></annotation>
|
||||
</element>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user