[#8447] Add <sqlMatchesPartialQualification>

This commit is contained in:
lukaseder 2019-03-26 10:54:54 +01:00
parent d31c34c91a
commit 2ea2d93736
5 changed files with 77 additions and 1 deletions

View File

@ -526,6 +526,7 @@ public class GenerationTool {
}
}
database.setRegexMatchesPartialQualification(!FALSE.equals(d.isRegexMatchesPartialQualification()));
database.setSqlMatchesPartialQualification(!FALSE.equals(d.isSqlMatchesPartialQualification()));
SchemaVersionProvider svp = null;
CatalogVersionProvider cvp = null;

View File

@ -109,6 +109,7 @@ public abstract class AbstractDatabase implements Database {
private SQLDialect dialect;
private Connection connection;
private boolean regexMatchesPartialQualification;
private boolean sqlMatchesPartialQualification;
private List<Filter> filters;
private String[] excludes;
private String[] includes = { ".*" };
@ -388,7 +389,7 @@ public abstract class AbstractDatabase implements Database {
if (set == null)
return false;
if (!getRegexMatchesPartialQualification())
if (!getSqlMatchesPartialQualification())
return set.contains(definition.getName())
|| set.contains(definition.getQualifiedName());
@ -911,6 +912,16 @@ public abstract class AbstractDatabase implements Database {
return regexMatchesPartialQualification;
}
@Override
public final void setSqlMatchesPartialQualification(boolean sqlMatchesPartialQualification) {
this.sqlMatchesPartialQualification = sqlMatchesPartialQualification;
}
@Override
public final boolean getSqlMatchesPartialQualification() {
return sqlMatchesPartialQualification;
}
@Override
public void setRecordVersionFields(String[] recordVersionFields) {
this.recordVersionFields = recordVersionFields;

View File

@ -619,6 +619,20 @@ public interface Database extends AutoCloseable {
*/
boolean getRegexMatchesPartialQualification();
/**
* Whether the SQL statements matching database objects should match
* partially qualified names as well as fully qualified and unqualified
* names.
*/
void setSqlMatchesPartialQualification(boolean sqlMatchesPartialQualification);
/**
* Whether the SQL statements matching database objects should match
* partially qualified names as well as fully qualified and unqualified
* names.
*/
boolean getSqlMatchesPartialQualification();
/**
* Table columns matching these regular expressions will be considered as
* record version fields in generated code.

View File

@ -46,6 +46,8 @@ public class Database implements Serializable
protected List<RegexFlag> regexFlags;
@XmlElement(defaultValue = "true")
protected Boolean regexMatchesPartialQualification = true;
@XmlElement(defaultValue = "true")
protected Boolean sqlMatchesPartialQualification = true;
@XmlElement(defaultValue = ".*")
@XmlJavaTypeAdapter(StringAdapter.class)
protected String includes = ".*";
@ -278,6 +280,30 @@ public class Database implements Serializable
this.regexMatchesPartialQualification = value;
}
/**
* Whether SQL queries that match qualified object names also match partial qualifications (e.g. `table\.column` matches `schema.table.column`) or only full and/or no qualifications (e.g. `schema\.table\.column` and `column` match `schema.table.column`)
*
* @return
* possible object is
* {@link Boolean }
*
*/
public Boolean isSqlMatchesPartialQualification() {
return sqlMatchesPartialQualification;
}
/**
* Sets the value of the sqlMatchesPartialQualification property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setSqlMatchesPartialQualification(Boolean value) {
this.sqlMatchesPartialQualification = value;
}
/**
* All elements that are generated from your schema.
* <p>
@ -1424,6 +1450,11 @@ public class Database implements Serializable
return this;
}
public Database withSqlMatchesPartialQualification(Boolean value) {
setSqlMatchesPartialQualification(value);
return this;
}
public Database withIncludes(String value) {
setIncludes(value);
return this;
@ -1788,6 +1819,11 @@ public class Database implements Serializable
sb.append(regexMatchesPartialQualification);
sb.append("</regexMatchesPartialQualification>");
}
if (sqlMatchesPartialQualification!= null) {
sb.append("<sqlMatchesPartialQualification>");
sb.append(sqlMatchesPartialQualification);
sb.append("</sqlMatchesPartialQualification>");
}
if (includes!= null) {
sb.append("<includes>");
sb.append(includes);
@ -2088,6 +2124,15 @@ public class Database implements Serializable
return false;
}
}
if (sqlMatchesPartialQualification == null) {
if (other.sqlMatchesPartialQualification!= null) {
return false;
}
} else {
if (!sqlMatchesPartialQualification.equals(other.sqlMatchesPartialQualification)) {
return false;
}
}
if (includes == null) {
if (other.includes!= null) {
return false;
@ -2512,6 +2557,7 @@ public class Database implements Serializable
result = ((prime*result)+((name == null)? 0 :name.hashCode()));
result = ((prime*result)+((regexFlags == null)? 0 :regexFlags.hashCode()));
result = ((prime*result)+((regexMatchesPartialQualification == null)? 0 :regexMatchesPartialQualification.hashCode()));
result = ((prime*result)+((sqlMatchesPartialQualification == null)? 0 :sqlMatchesPartialQualification.hashCode()));
result = ((prime*result)+((includes == null)? 0 :includes.hashCode()));
result = ((prime*result)+((excludes == null)? 0 :excludes.hashCode()));
result = ((prime*result)+((includeExcludeColumns == null)? 0 :includeExcludeColumns.hashCode()));

View File

@ -449,6 +449,10 @@ The default value is "COMMENTS CASE_INSENSITIVE"]]></jxb:javadoc></jxb:property>
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Whether regular expressions that match qualified object names also match partial qualifications (e.g. `table\.column` matches `schema.table.column`) or only full and/or no qualifications (e.g. `schema\.table\.column` and `column` match `schema.table.column`)]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="sqlMatchesPartialQualification" type="boolean" minOccurs="0" maxOccurs="1" default="true">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[Whether SQL queries that match qualified object names also match partial qualifications (e.g. `table\.column` matches `schema.table.column`) or only full and/or no qualifications (e.g. `schema\.table\.column` and `column` match `schema.table.column`)]]></jxb:javadoc></jxb:property></appinfo></annotation>
</element>
<element name="includes" type="string" default=".*" minOccurs="0" maxOccurs="1">
<annotation><appinfo><jxb:property><jxb:javadoc><![CDATA[All elements that are generated from your schema.
<p>