[jOOQ/jOOQ#6311] Add <oracleUseDBAViews/> flag to code generator to use DBA_XYZ views instead of ALL_XYZ views

This commit is contained in:
Lukas Eder 2022-09-22 16:14:27 +02:00
parent a06bdd538f
commit 3893d1e324
3 changed files with 58 additions and 5 deletions

View File

@ -436,6 +436,13 @@ public class GenerationTool {
? databaseClass(connection)
: databaseClass(j);
database = databaseClass.newInstance();
database.setBasedir(configuration.getBasedir());
database.setProperties(properties(d.getProperties()));
database.setOnError(configuration.getOnError());

View File

@ -167,6 +167,8 @@ public class Database implements Serializable, XMLAppendable
@XmlElement(defaultValue = "true")
protected Boolean forceIntegerTypesOnZeroScaleDecimals = true;
protected Boolean tableValuedFunctions;
@XmlElement(defaultValue = "false")
protected Boolean oracleUseDBAViews = false;
@XmlElement(defaultValue = "5")
protected Integer logSlowQueriesAfterSeconds = 5;
@XmlElement(defaultValue = "5")
@ -1871,6 +1873,30 @@ public class Database implements Serializable, XMLAppendable
this.tableValuedFunctions = value;
}
/**
* Specify whether to use the Oracle DBA_XYZ views instead of the ALL_XYZ views.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isOracleUseDBAViews() {
return oracleUseDBAViews;
}
/**
* Sets the value of the oracleUseDBAViews property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setOracleUseDBAViews(Boolean value) {
this.oracleUseDBAViews = value;
}
/**
* The number of seconds that are considered "slow" before a query is logged to indicate a bug, 0 for not logging.
*
@ -2608,6 +2634,11 @@ public class Database implements Serializable, XMLAppendable
return this;
}
public Database withOracleUseDBAViews(Boolean value) {
setOracleUseDBAViews(value);
return this;
}
/**
* The number of seconds that are considered "slow" before a query is logged to indicate a bug, 0 for not logging.
*
@ -2864,6 +2895,7 @@ public class Database implements Serializable, XMLAppendable
builder.append("forcedTypesForXMLSchemaCollections", forcedTypesForXMLSchemaCollections);
builder.append("forceIntegerTypesOnZeroScaleDecimals", forceIntegerTypesOnZeroScaleDecimals);
builder.append("tableValuedFunctions", tableValuedFunctions);
builder.append("oracleUseDBAViews", oracleUseDBAViews);
builder.append("logSlowQueriesAfterSeconds", logSlowQueriesAfterSeconds);
builder.append("logSlowResultsAfterSeconds", logSlowResultsAfterSeconds);
builder.append("properties", "property", properties);
@ -3453,6 +3485,15 @@ public class Database implements Serializable, XMLAppendable
return false;
}
}
if (oracleUseDBAViews == null) {
if (other.oracleUseDBAViews!= null) {
return false;
}
} else {
if (!oracleUseDBAViews.equals(other.oracleUseDBAViews)) {
return false;
}
}
if (logSlowQueriesAfterSeconds == null) {
if (other.logSlowQueriesAfterSeconds!= null) {
return false;
@ -3612,6 +3653,7 @@ public class Database implements Serializable, XMLAppendable
result = ((prime*result)+((forcedTypesForXMLSchemaCollections == null)? 0 :forcedTypesForXMLSchemaCollections.hashCode()));
result = ((prime*result)+((forceIntegerTypesOnZeroScaleDecimals == null)? 0 :forceIntegerTypesOnZeroScaleDecimals.hashCode()));
result = ((prime*result)+((tableValuedFunctions == null)? 0 :tableValuedFunctions.hashCode()));
result = ((prime*result)+((oracleUseDBAViews == null)? 0 :oracleUseDBAViews.hashCode()));
result = ((prime*result)+((logSlowQueriesAfterSeconds == null)? 0 :logSlowQueriesAfterSeconds.hashCode()));
result = ((prime*result)+((logSlowResultsAfterSeconds == null)? 0 :logSlowResultsAfterSeconds.hashCode()));
result = ((prime*result)+((properties == null)? 0 :properties.hashCode()));

View File

@ -1067,6 +1067,10 @@ and VARRAY types in Oracle.
While this flag defaults to true for most databases, it defaults to false
for Oracle.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="oracleUseDBAViews" type="boolean" minOccurs="0" maxOccurs="1" default="false">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Specify whether to use the Oracle DBA_XYZ views instead of the ALL_XYZ views.]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="logSlowQueriesAfterSeconds" type="int" minOccurs="0" maxOccurs="1" default="5">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[The number of seconds that are considered "slow" before a query is logged to indicate a bug, 0 for not logging.]]></jxb:javadoc></jxb:property></appinfo></annotation>
@ -2485,10 +2489,10 @@ e.g. org.jooq.generated.schema1, org.jooq.generated.schema2]]></jxb:javadoc></jx
</simpleType>
<simpleType name="GeneratedSerialVersionUID">
<restriction base="string">
<enumeration value="HASH"/>
<enumeration value="CONSTANT"/>
<enumeration value="OFF"/>
</restriction>
<restriction base="string">
<enumeration value="HASH"/>
<enumeration value="CONSTANT"/>
<enumeration value="OFF"/>
</restriction>
</simpleType>
</schema>