diff --git a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/Database.java b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/Database.java index bc2ef3cac5..68f82fa625 100644 --- a/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/Database.java +++ b/jOOQ-meta/src/main/java/org/jooq/meta/jaxb/Database.java @@ -19,9 +19,9 @@ import org.jooq.util.jaxb.tools.XMLBuilder; /** * Configuration of the database meta data source. - * - * - * + * + * + * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Database", propOrder = { @@ -207,7 +207,6 @@ public class Database implements Serializable, XMLAppendable *
  • {@link org.jooq.meta.sqlserver.SQLServerDatabase}
  • *
  • {@link org.jooq.meta.sybase.SybaseDatabase}
  • *
  • {@link org.jooq.meta.vertica.VerticaDatabase}
  • - *
  • {@link org.jooq.meta.yugabyte.YugabyteDatabase}
  • * *

    * This value can be used to reverse-engineer generic JDBC DatabaseMetaData (e.g. for MS Access). @@ -227,7 +226,7 @@ public class Database implements Serializable, XMLAppendable *

    * You can also provide your own org.jooq.meta.Database implementation * here, if your database is currently not supported - * + * */ public String getName() { return name; @@ -258,7 +257,6 @@ public class Database implements Serializable, XMLAppendable *

  • {@link org.jooq.meta.sqlserver.SQLServerDatabase}
  • *
  • {@link org.jooq.meta.sybase.SybaseDatabase}
  • *
  • {@link org.jooq.meta.vertica.VerticaDatabase}
  • - *
  • {@link org.jooq.meta.yugabyte.YugabyteDatabase}
  • * *

    * This value can be used to reverse-engineer generic JDBC DatabaseMetaData (e.g. for MS Access). @@ -278,7 +276,7 @@ public class Database implements Serializable, XMLAppendable *

    * You can also provide your own org.jooq.meta.Database implementation * here, if your database is currently not supported - * + * */ public void setName(String value) { this.name = value; @@ -288,25 +286,25 @@ public class Database implements Serializable, XMLAppendable * The flags that will be applied to all regular expressions from this configuration by default. *

    * The default value is "COMMENTS CASE_INSENSITIVE"Gets the value of the regexFlags property. - * + * *

    * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the regexFlags property. - * + * *

    * For example, to add a new item, do as follows: *

          *    getRegexFlags().add(newItem);
          * 
    - * - * + * + * *

    * Objects of the following type(s) are allowed in the list * {@link RegexFlag } - * - * + * + * */ public List getRegexFlags() { if (regexFlags == null) { @@ -317,11 +315,11 @@ public class Database implements Serializable, XMLAppendable /** * 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`) - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isRegexMatchesPartialQualification() { return regexMatchesPartialQualification; @@ -329,11 +327,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the regexMatchesPartialQualification property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setRegexMatchesPartialQualification(Boolean value) { this.regexMatchesPartialQualification = value; @@ -341,11 +339,11 @@ public class Database implements Serializable, XMLAppendable /** * 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; @@ -353,11 +351,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the sqlMatchesPartialQualification property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setSqlMatchesPartialQualification(Boolean value) { this.sqlMatchesPartialQualification = value; @@ -374,7 +372,7 @@ public class Database implements Serializable, XMLAppendable * using this syntax: (?i:expr) *

    * Whitespace is ignored and comments are possible unless overridden in {@link #getRegexFlags()}. - * + * */ public String getIncludes() { return includes; @@ -391,7 +389,7 @@ public class Database implements Serializable, XMLAppendable * using this syntax: (?i:expr) *

    * Whitespace is ignored and comments are possible unless overridden in {@link #getRegexFlags()}. - * + * */ public void setIncludes(String value) { this.includes = value; @@ -402,7 +400,7 @@ public class Database implements Serializable, XMLAppendable *

    * This is a Java regular expression. Use the pipe to separate several expressions. * Excludes match before includes, i.e. excludes have a higher priority. - * + * */ public String getExcludes() { return excludes; @@ -413,7 +411,7 @@ public class Database implements Serializable, XMLAppendable *

    * This is a Java regular expression. Use the pipe to separate several expressions. * Excludes match before includes, i.e. excludes have a higher priority. - * + * */ public void setExcludes(String value) { this.excludes = value; @@ -421,11 +419,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether include / exclude patterns should also match columns within tables. - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludeExcludeColumns() { return includeExcludeColumns; @@ -433,11 +431,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includeExcludeColumns property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludeExcludeColumns(Boolean value) { this.includeExcludeColumns = value; @@ -445,11 +443,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether include / exclude patterns should also match routines within packages. - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludeExcludePackageRoutines() { return includeExcludePackageRoutines; @@ -457,11 +455,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includeExcludePackageRoutines property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludeExcludePackageRoutines(Boolean value) { this.includeExcludePackageRoutines = value; @@ -469,11 +467,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether tables should be included in output produced by this database - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludeTables() { return includeTables; @@ -481,11 +479,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includeTables property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludeTables(Boolean value) { this.includeTables = value; @@ -493,11 +491,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether embeddable types should be included in output produced by this database - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludeEmbeddables() { return includeEmbeddables; @@ -505,11 +503,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includeEmbeddables property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludeEmbeddables(Boolean value) { this.includeEmbeddables = value; @@ -517,11 +515,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether routines should be included in output produced by this database - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludeRoutines() { return includeRoutines; @@ -529,11 +527,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includeRoutines property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludeRoutines(Boolean value) { this.includeRoutines = value; @@ -541,11 +539,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether trigger implementation routines should be included in output produced by this database (e.g. in PostgreSQL) - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludeTriggerRoutines() { return includeTriggerRoutines; @@ -553,11 +551,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includeTriggerRoutines property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludeTriggerRoutines(Boolean value) { this.includeTriggerRoutines = value; @@ -565,11 +563,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether packages should be included in output produced by this database - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludePackages() { return includePackages; @@ -577,11 +575,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includePackages property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludePackages(Boolean value) { this.includePackages = value; @@ -589,11 +587,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether routines contained in packages should be included in output produced by this database - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludePackageRoutines() { return includePackageRoutines; @@ -601,11 +599,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includePackageRoutines property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludePackageRoutines(Boolean value) { this.includePackageRoutines = value; @@ -613,11 +611,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether UDTs contained in packages should be included in output produced by this database - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludePackageUDTs() { return includePackageUDTs; @@ -625,11 +623,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includePackageUDTs property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludePackageUDTs(Boolean value) { this.includePackageUDTs = value; @@ -637,11 +635,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether constants contained in packages should be included in output produced by this database - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludePackageConstants() { return includePackageConstants; @@ -649,11 +647,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includePackageConstants property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludePackageConstants(Boolean value) { this.includePackageConstants = value; @@ -661,11 +659,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether udts should be included in output produced by this database - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludeUDTs() { return includeUDTs; @@ -673,11 +671,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includeUDTs property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludeUDTs(Boolean value) { this.includeUDTs = value; @@ -685,11 +683,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether domains should be included in output produced by this database - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludeDomains() { return includeDomains; @@ -697,11 +695,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includeDomains property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludeDomains(Boolean value) { this.includeDomains = value; @@ -709,11 +707,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether sequences should be included in output produced by this database - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludeSequences() { return includeSequences; @@ -721,11 +719,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includeSequences property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludeSequences(Boolean value) { this.includeSequences = value; @@ -733,11 +731,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether indexes should be included in output produced by this database - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludeIndexes() { return includeIndexes; @@ -745,11 +743,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includeIndexes property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludeIndexes(Boolean value) { this.includeIndexes = value; @@ -757,11 +755,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether primary keys should be included in output produced by this database - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludePrimaryKeys() { return includePrimaryKeys; @@ -769,11 +767,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includePrimaryKeys property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludePrimaryKeys(Boolean value) { this.includePrimaryKeys = value; @@ -781,11 +779,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether unique keys should be included in output produced by this database - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludeUniqueKeys() { return includeUniqueKeys; @@ -793,11 +791,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includeUniqueKeys property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludeUniqueKeys(Boolean value) { this.includeUniqueKeys = value; @@ -805,11 +803,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether foreign keys should be included in output produced by this database - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludeForeignKeys() { return includeForeignKeys; @@ -817,11 +815,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includeForeignKeys property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludeForeignKeys(Boolean value) { this.includeForeignKeys = value; @@ -829,11 +827,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether check constraints should be included in output produced by this database - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludeCheckConstraints() { return includeCheckConstraints; @@ -841,11 +839,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includeCheckConstraints property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludeCheckConstraints(Boolean value) { this.includeCheckConstraints = value; @@ -853,11 +851,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether system tables should be included in output produced by this database - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludeSystemTables() { return includeSystemTables; @@ -865,11 +863,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includeSystemTables property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludeSystemTables(Boolean value) { this.includeSystemTables = value; @@ -877,11 +875,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether system generated indexes should be included in output produced by this database - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludeSystemIndexes() { return includeSystemIndexes; @@ -889,11 +887,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includeSystemIndexes property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludeSystemIndexes(Boolean value) { this.includeSystemIndexes = value; @@ -901,11 +899,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether system generated check constraints should be included in output produced by this database - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludeSystemCheckConstraints() { return includeSystemCheckConstraints; @@ -913,11 +911,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includeSystemCheckConstraints property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludeSystemCheckConstraints(Boolean value) { this.includeSystemCheckConstraints = value; @@ -925,11 +923,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether system generated sequences should be included in output produced by this database - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludeSystemSequences() { return includeSystemSequences; @@ -937,11 +935,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includeSystemSequences property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludeSystemSequences(Boolean value) { this.includeSystemSequences = value; @@ -949,11 +947,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether system generated UDTs should be included in output produced by this database - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludeSystemUDTs() { return includeSystemUDTs; @@ -961,11 +959,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includeSystemUDTs property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludeSystemUDTs(Boolean value) { this.includeSystemUDTs = value; @@ -973,11 +971,11 @@ public class Database implements Serializable, XMLAppendable /** * This flag indicates whether invisible columns should be included in output produced by this database - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIncludeInvisibleColumns() { return includeInvisibleColumns; @@ -985,11 +983,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the includeInvisibleColumns property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIncludeInvisibleColumns(Boolean value) { this.includeInvisibleColumns = value; @@ -1000,7 +998,7 @@ public class Database implements Serializable, XMLAppendable *

    * This is a Java regular expression. Use the pipe to separate several expressions. * See {@link org.jooq.UpdatableRecord#store()} and {@link org.jooq.UpdatableRecord#delete()} for details about optimistic locking. - * + * */ public String getRecordVersionFields() { return recordVersionFields; @@ -1011,7 +1009,7 @@ public class Database implements Serializable, XMLAppendable *

    * This is a Java regular expression. Use the pipe to separate several expressions. * See {@link org.jooq.UpdatableRecord#store()} and {@link org.jooq.UpdatableRecord#delete()} for details about optimistic locking. - * + * */ public void setRecordVersionFields(String value) { this.recordVersionFields = value; @@ -1022,7 +1020,7 @@ public class Database implements Serializable, XMLAppendable *

    * This is a Java regular expression. Use the pipe to separate several expressions. * See {@link org.jooq.UpdatableRecord#store()} and {@link org.jooq.UpdatableRecord#delete()} for details about optimistic locking. - * + * */ public String getRecordTimestampFields() { return recordTimestampFields; @@ -1033,7 +1031,7 @@ public class Database implements Serializable, XMLAppendable *

    * This is a Java regular expression. Use the pipe to separate several expressions. * See {@link org.jooq.UpdatableRecord#store()} and {@link org.jooq.UpdatableRecord#delete()} for details about optimistic locking. - * + * */ public void setRecordTimestampFields(String value) { this.recordTimestampFields = value; @@ -1041,7 +1039,7 @@ public class Database implements Serializable, XMLAppendable /** * The synthetic objects configuration. - * + * */ public SyntheticObjectsType getSyntheticObjects() { return syntheticObjects; @@ -1049,7 +1047,7 @@ public class Database implements Serializable, XMLAppendable /** * The synthetic objects configuration. - * + * */ public void setSyntheticObjects(SyntheticObjectsType value) { this.syntheticObjects = value; @@ -1059,7 +1057,7 @@ public class Database implements Serializable, XMLAppendable * A regular expression matching all columns that represent identities. *

    * To be used if columns are not detected as automatically as identities. - * + * */ public String getSyntheticIdentities() { return syntheticIdentities; @@ -1069,7 +1067,7 @@ public class Database implements Serializable, XMLAppendable * A regular expression matching all columns that represent identities. *

    * To be used if columns are not detected as automatically as identities. - * + * */ public void setSyntheticIdentities(String value) { this.syntheticIdentities = value; @@ -1088,7 +1086,7 @@ public class Database implements Serializable, XMLAppendable * *

    * Synthetic primary keys will override existing primary keys. - * + * */ public String getSyntheticPrimaryKeys() { return syntheticPrimaryKeys; @@ -1107,7 +1105,7 @@ public class Database implements Serializable, XMLAppendable * *

    * Synthetic primary keys will override existing primary keys. - * + * */ public void setSyntheticPrimaryKeys(String value) { this.syntheticPrimaryKeys = value; @@ -1128,7 +1126,7 @@ public class Database implements Serializable, XMLAppendable * If several keys match, a warning is emitted and the first one encountered will be used. *

    * This flag will also replace synthetic primary keys, if it matches. - * + * */ public String getOverridePrimaryKeys() { return overridePrimaryKeys; @@ -1149,7 +1147,7 @@ public class Database implements Serializable, XMLAppendable * If several keys match, a warning is emitted and the first one encountered will be used. *

    * This flag will also replace synthetic primary keys, if it matches. - * + * */ public void setOverridePrimaryKeys(String value) { this.overridePrimaryKeys = value; @@ -1157,11 +1155,11 @@ public class Database implements Serializable, XMLAppendable /** * Generate {@link java.sql.Timestamp} fields for DATE columns. This is particularly useful for Oracle databases - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isDateAsTimestamp() { return dateAsTimestamp; @@ -1169,11 +1167,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the dateAsTimestamp property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setDateAsTimestamp(Boolean value) { this.dateAsTimestamp = value; @@ -1189,11 +1187,11 @@ public class Database implements Serializable, XMLAppendable *

    * @deprecated This feature is deprecated as of jOOQ 3.6.0 and will be removed again in * jOOQ 4.0. - * + * * @return * possible object is * {@link Boolean } - * + * */ @Deprecated public Boolean isIgnoreProcedureReturnValues() { @@ -1202,11 +1200,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the ignoreProcedureReturnValues property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ @Deprecated public void setIgnoreProcedureReturnValues(Boolean value) { @@ -1215,11 +1213,11 @@ public class Database implements Serializable, XMLAppendable /** * Generate jOOU data types for your unsigned data types, which are not natively supported in Java - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isUnsignedTypes() { return unsignedTypes; @@ -1227,11 +1225,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the unsignedTypes property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setUnsignedTypes(Boolean value) { this.unsignedTypes = value; @@ -1239,11 +1237,11 @@ public class Database implements Serializable, XMLAppendable /** * Include display width in type declaration. In some RDBMS (e.g. MariaDB, MySQL), fixed width integer types are optionally accompanied by a display width. This is sometimes abused to model BOOLEAN types via TINYINT(1). This flag allows for including that display width in the type declaration exposed by jOOQ-meta code, as if it were a numeric precision. - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isIntegerDisplayWidths() { return integerDisplayWidths; @@ -1251,11 +1249,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the integerDisplayWidths property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setIntegerDisplayWidths(Boolean value) { this.integerDisplayWidths = value; @@ -1266,7 +1264,7 @@ public class Database implements Serializable, XMLAppendable *

    * This cannot be combined with the {@link #getCatalogs()} configuration element. * If left empty (and without any {@link #getCatalogs()} configuration element), jOOQ will generate all available catalogs. - * + * */ public String getInputCatalog() { return inputCatalog; @@ -1277,7 +1275,7 @@ public class Database implements Serializable, XMLAppendable *

    * This cannot be combined with the {@link #getCatalogs()} configuration element. * If left empty (and without any {@link #getCatalogs()} configuration element), jOOQ will generate all available catalogs. - * + * */ public void setInputCatalog(String value) { this.inputCatalog = value; @@ -1291,7 +1289,7 @@ public class Database implements Serializable, XMLAppendable * will be the same as {@link #getInputCatalog()} *

    * This will be ignored if {@link #isOutputCatalogToDefault()} is set to true - * + * */ public String getOutputCatalog() { return outputCatalog; @@ -1305,7 +1303,7 @@ public class Database implements Serializable, XMLAppendable * will be the same as {@link #getInputCatalog()} *

    * This will be ignored if {@link #isOutputCatalogToDefault()} is set to true - * + * */ public void setOutputCatalog(String value) { this.outputCatalog = value; @@ -1314,11 +1312,11 @@ public class Database implements Serializable, XMLAppendable /** * A flag to indicate that the outputCatalog should be the "default" catalog, * which generates catalog-less, unqualified tables, procedures, etc. - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isOutputCatalogToDefault() { return outputCatalogToDefault; @@ -1326,11 +1324,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the outputCatalogToDefault property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setOutputCatalogToDefault(Boolean value) { this.outputCatalogToDefault = value; @@ -1341,7 +1339,7 @@ public class Database implements Serializable, XMLAppendable *

    * This cannot be combined with the {@link #getSchemata()} configuration element. * If left empty (and without any {@link #getSchemata()} configuration element), jOOQ will generate all available schemata. - * + * */ public String getInputSchema() { return inputSchema; @@ -1352,7 +1350,7 @@ public class Database implements Serializable, XMLAppendable *

    * This cannot be combined with the {@link #getSchemata()} configuration element. * If left empty (and without any {@link #getSchemata()} configuration element), jOOQ will generate all available schemata. - * + * */ public void setInputSchema(String value) { this.inputSchema = value; @@ -1364,9 +1362,9 @@ public class Database implements Serializable, XMLAppendable * Use this to override your local development * schema name for source code generation. If not specified, this * will be the same as {@link #getInputSchema()}. - * + * * This will be ignored if {@link #isOutputSchemaToDefault()} is set to true - * + * */ public String getOutputSchema() { return outputSchema; @@ -1378,9 +1376,9 @@ public class Database implements Serializable, XMLAppendable * Use this to override your local development * schema name for source code generation. If not specified, this * will be the same as {@link #getInputSchema()}. - * + * * This will be ignored if {@link #isOutputSchemaToDefault()} is set to true - * + * */ public void setOutputSchema(String value) { this.outputSchema = value; @@ -1389,11 +1387,11 @@ public class Database implements Serializable, XMLAppendable /** * A flag to indicate that the outputSchema should be the "default" schema, * which generates schema-less, unqualified tables, procedures, etc. - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isOutputSchemaToDefault() { return outputSchemaToDefault; @@ -1401,11 +1399,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the outputSchemaToDefault property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setOutputSchemaToDefault(Boolean value) { this.outputSchemaToDefault = value; @@ -1426,7 +1424,7 @@ public class Database implements Serializable, XMLAppendable *

    * Schema versions will be generated into the {@link javax.annotation.processing.Generated} annotation on * generated artefacts. - * + * */ public String getSchemaVersionProvider() { return schemaVersionProvider; @@ -1447,7 +1445,7 @@ public class Database implements Serializable, XMLAppendable *

    * Schema versions will be generated into the {@link javax.annotation.processing.Generated} annotation on * generated artefacts. - * + * */ public void setSchemaVersionProvider(String value) { this.schemaVersionProvider = value; @@ -1467,7 +1465,7 @@ public class Database implements Serializable, XMLAppendable *

    * Catalog versions will be generated into the {@link javax.annotation.processing.Generated} annotation on * generated artefacts. - * + * */ public String getCatalogVersionProvider() { return catalogVersionProvider; @@ -1487,7 +1485,7 @@ public class Database implements Serializable, XMLAppendable *

    * Catalog versions will be generated into the {@link javax.annotation.processing.Generated} annotation on * generated artefacts. - * + * */ public void setCatalogVersionProvider(String value) { this.catalogVersionProvider = value; @@ -1497,7 +1495,7 @@ public class Database implements Serializable, XMLAppendable * A custom {@link java.util.Comparator} that can compare two {@link org.jooq.meta.Definition} objects to determine their order. *

    * This comparator can be used to influence the order of any object that is produced by jOOQ meta, and thus, indirectly, the order of declared objects in generated code. - * + * */ public String getOrderProvider() { return orderProvider; @@ -1507,7 +1505,7 @@ public class Database implements Serializable, XMLAppendable * A custom {@link java.util.Comparator} that can compare two {@link org.jooq.meta.Definition} objects to determine their order. *

    * This comparator can be used to influence the order of any object that is produced by jOOQ meta, and thus, indirectly, the order of declared objects in generated code. - * + * */ public void setOrderProvider(String value) { this.orderProvider = value; @@ -1517,7 +1515,7 @@ public class Database implements Serializable, XMLAppendable * A regular expression matching all primary key declarations for which wrapper types should be generated, and for their referencing foreign keys. *

    * This feature is available in the commercial distribution only. - * + * */ public String getEmbeddablePrimaryKeys() { return embeddablePrimaryKeys; @@ -1527,7 +1525,7 @@ public class Database implements Serializable, XMLAppendable * A regular expression matching all primary key declarations for which wrapper types should be generated, and for their referencing foreign keys. *

    * This feature is available in the commercial distribution only. - * + * */ public void setEmbeddablePrimaryKeys(String value) { this.embeddablePrimaryKeys = value; @@ -1537,7 +1535,7 @@ public class Database implements Serializable, XMLAppendable * A regular expression matching all unique key declarations for which wrapper types should be generated, and for their referencing foreign keys. *

    * This feature is available in the commercial distribution only. - * + * */ public String getEmbeddableUniqueKeys() { return embeddableUniqueKeys; @@ -1547,7 +1545,7 @@ public class Database implements Serializable, XMLAppendable * A regular expression matching all unique key declarations for which wrapper types should be generated, and for their referencing foreign keys. *

    * This feature is available in the commercial distribution only. - * + * */ public void setEmbeddableUniqueKeys(String value) { this.embeddableUniqueKeys = value; @@ -1557,7 +1555,7 @@ public class Database implements Serializable, XMLAppendable * A regular expression matching all domain type declarations for which wrapper types should be generated. *

    * This feature is available in the commercial distribution only. - * + * */ public String getEmbeddableDomains() { return embeddableDomains; @@ -1567,7 +1565,7 @@ public class Database implements Serializable, XMLAppendable * A regular expression matching all domain type declarations for which wrapper types should be generated. *

    * This feature is available in the commercial distribution only. - * + * */ public void setEmbeddableDomains(String value) { this.embeddableDomains = value; @@ -1575,11 +1573,11 @@ public class Database implements Serializable, XMLAppendable /** * Historically, zero-scale decimal types are generated as their most appropriate, corresponding integer type (e.g. NUMBER(2, 0) and less: Byte). This allows for turning off this feature. In case of conflict between this rule and actual {@link #getForcedTypes()}, the latter will win. - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isForceIntegerTypesOnZeroScaleDecimals() { return forceIntegerTypesOnZeroScaleDecimals; @@ -1587,11 +1585,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the forceIntegerTypesOnZeroScaleDecimals property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setForceIntegerTypesOnZeroScaleDecimals(Boolean value) { this.forceIntegerTypesOnZeroScaleDecimals = value; @@ -1607,11 +1605,11 @@ public class Database implements Serializable, XMLAppendable *

    * While this flag defaults to true for most databases, it defaults to false * for Oracle. - * + * * @return * possible object is * {@link Boolean } - * + * */ public Boolean isTableValuedFunctions() { return tableValuedFunctions; @@ -1619,11 +1617,11 @@ public class Database implements Serializable, XMLAppendable /** * Sets the value of the tableValuedFunctions property. - * + * * @param value * allowed object is * {@link Boolean } - * + * */ public void setTableValuedFunctions(Boolean value) { this.tableValuedFunctions = value; @@ -1631,7 +1629,7 @@ public class Database implements Serializable, XMLAppendable /** * The number of seconds that are considered "slow" before a query is logged to indicate a bug, 0 for not logging. - * + * */ public Integer getLogSlowQueriesAfterSeconds() { return logSlowQueriesAfterSeconds; @@ -1639,7 +1637,7 @@ public class Database implements Serializable, XMLAppendable /** * The number of seconds that are considered "slow" before a query is logged to indicate a bug, 0 for not logging. - * + * */ public void setLogSlowQueriesAfterSeconds(Integer value) { this.logSlowQueriesAfterSeconds = value; @@ -1647,7 +1645,7 @@ public class Database implements Serializable, XMLAppendable /** * The number of seconds that are considered "slow" before a result set is logged to indicate a bug, 0 for not logging. - * + * */ public Integer getLogSlowResultsAfterSeconds() { return logSlowResultsAfterSeconds; @@ -1655,7 +1653,7 @@ public class Database implements Serializable, XMLAppendable /** * The number of seconds that are considered "slow" before a result set is logged to indicate a bug, 0 for not logging. - * + * */ public void setLogSlowResultsAfterSeconds(Integer value) { this.logSlowResultsAfterSeconds = value; @@ -1778,7 +1776,6 @@ public class Database implements Serializable, XMLAppendable *

  • {@link org.jooq.meta.sqlserver.SQLServerDatabase}
  • *
  • {@link org.jooq.meta.sybase.SybaseDatabase}
  • *
  • {@link org.jooq.meta.vertica.VerticaDatabase}
  • - *
  • {@link org.jooq.meta.yugabyte.YugabyteDatabase}
  • * *

    * This value can be used to reverse-engineer generic JDBC DatabaseMetaData (e.g. for MS Access). @@ -1798,7 +1795,7 @@ public class Database implements Serializable, XMLAppendable *

    * You can also provide your own org.jooq.meta.Database implementation * here, if your database is currently not supported - * + * */ public Database withName(String value) { setName(value); @@ -1809,25 +1806,25 @@ public class Database implements Serializable, XMLAppendable * The flags that will be applied to all regular expressions from this configuration by default. *

    * The default value is "COMMENTS CASE_INSENSITIVE"Gets the value of the regexFlags property. - * + * *

    * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the regexFlags property. - * + * *

    * For example, to add a new item, do as follows: *

          *    getRegexFlags().add(newItem);
          * 
    - * - * + * + * *

    * Objects of the following type(s) are allowed in the list * {@link RegexFlag } - * - * + * + * */ public Database withRegexFlags(RegexFlag... values) { if (values!= null) { @@ -1842,25 +1839,25 @@ public class Database implements Serializable, XMLAppendable * The flags that will be applied to all regular expressions from this configuration by default. *

    * The default value is "COMMENTS CASE_INSENSITIVE"Gets the value of the regexFlags property. - * + * *

    * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a set method for the regexFlags property. - * + * *

    * For example, to add a new item, do as follows: *

          *    getRegexFlags().add(newItem);
          * 
    - * - * + * + * *

    * Objects of the following type(s) are allowed in the list * {@link RegexFlag } - * - * + * + * */ public Database withRegexFlags(Collection values) { if (values!= null) { @@ -1890,7 +1887,7 @@ public class Database implements Serializable, XMLAppendable * using this syntax: (?i:expr) *

    * Whitespace is ignored and comments are possible unless overridden in {@link #getRegexFlags()}. - * + * */ public Database withIncludes(String value) { setIncludes(value); @@ -1902,7 +1899,7 @@ public class Database implements Serializable, XMLAppendable *

    * This is a Java regular expression. Use the pipe to separate several expressions. * Excludes match before includes, i.e. excludes have a higher priority. - * + * */ public Database withExcludes(String value) { setExcludes(value); @@ -2034,7 +2031,7 @@ public class Database implements Serializable, XMLAppendable *

    * This is a Java regular expression. Use the pipe to separate several expressions. * See {@link org.jooq.UpdatableRecord#store()} and {@link org.jooq.UpdatableRecord#delete()} for details about optimistic locking. - * + * */ public Database withRecordVersionFields(String value) { setRecordVersionFields(value); @@ -2046,7 +2043,7 @@ public class Database implements Serializable, XMLAppendable *

    * This is a Java regular expression. Use the pipe to separate several expressions. * See {@link org.jooq.UpdatableRecord#store()} and {@link org.jooq.UpdatableRecord#delete()} for details about optimistic locking. - * + * */ public Database withRecordTimestampFields(String value) { setRecordTimestampFields(value); @@ -2055,7 +2052,7 @@ public class Database implements Serializable, XMLAppendable /** * The synthetic objects configuration. - * + * */ public Database withSyntheticObjects(SyntheticObjectsType value) { setSyntheticObjects(value); @@ -2066,7 +2063,7 @@ public class Database implements Serializable, XMLAppendable * A regular expression matching all columns that represent identities. *

    * To be used if columns are not detected as automatically as identities. - * + * */ public Database withSyntheticIdentities(String value) { setSyntheticIdentities(value); @@ -2086,7 +2083,7 @@ public class Database implements Serializable, XMLAppendable * *

    * Synthetic primary keys will override existing primary keys. - * + * */ public Database withSyntheticPrimaryKeys(String value) { setSyntheticPrimaryKeys(value); @@ -2108,7 +2105,7 @@ public class Database implements Serializable, XMLAppendable * If several keys match, a warning is emitted and the first one encountered will be used. *

    * This flag will also replace synthetic primary keys, if it matches. - * + * */ public Database withOverridePrimaryKeys(String value) { setOverridePrimaryKeys(value); @@ -2140,7 +2137,7 @@ public class Database implements Serializable, XMLAppendable *

    * This cannot be combined with the {@link #getCatalogs()} configuration element. * If left empty (and without any {@link #getCatalogs()} configuration element), jOOQ will generate all available catalogs. - * + * */ public Database withInputCatalog(String value) { setInputCatalog(value); @@ -2155,7 +2152,7 @@ public class Database implements Serializable, XMLAppendable * will be the same as {@link #getInputCatalog()} *

    * This will be ignored if {@link #isOutputCatalogToDefault()} is set to true - * + * */ public Database withOutputCatalog(String value) { setOutputCatalog(value); @@ -2172,7 +2169,7 @@ public class Database implements Serializable, XMLAppendable *

    * This cannot be combined with the {@link #getSchemata()} configuration element. * If left empty (and without any {@link #getSchemata()} configuration element), jOOQ will generate all available schemata. - * + * */ public Database withInputSchema(String value) { setInputSchema(value); @@ -2185,9 +2182,9 @@ public class Database implements Serializable, XMLAppendable * Use this to override your local development * schema name for source code generation. If not specified, this * will be the same as {@link #getInputSchema()}. - * + * * This will be ignored if {@link #isOutputSchemaToDefault()} is set to true - * + * */ public Database withOutputSchema(String value) { setOutputSchema(value); @@ -2214,7 +2211,7 @@ public class Database implements Serializable, XMLAppendable *

    * Schema versions will be generated into the {@link javax.annotation.processing.Generated} annotation on * generated artefacts. - * + * */ public Database withSchemaVersionProvider(String value) { setSchemaVersionProvider(value); @@ -2235,7 +2232,7 @@ public class Database implements Serializable, XMLAppendable *

    * Catalog versions will be generated into the {@link javax.annotation.processing.Generated} annotation on * generated artefacts. - * + * */ public Database withCatalogVersionProvider(String value) { setCatalogVersionProvider(value); @@ -2246,7 +2243,7 @@ public class Database implements Serializable, XMLAppendable * A custom {@link java.util.Comparator} that can compare two {@link org.jooq.meta.Definition} objects to determine their order. *

    * This comparator can be used to influence the order of any object that is produced by jOOQ meta, and thus, indirectly, the order of declared objects in generated code. - * + * */ public Database withOrderProvider(String value) { setOrderProvider(value); @@ -2257,7 +2254,7 @@ public class Database implements Serializable, XMLAppendable * A regular expression matching all primary key declarations for which wrapper types should be generated, and for their referencing foreign keys. *

    * This feature is available in the commercial distribution only. - * + * */ public Database withEmbeddablePrimaryKeys(String value) { setEmbeddablePrimaryKeys(value); @@ -2268,7 +2265,7 @@ public class Database implements Serializable, XMLAppendable * A regular expression matching all unique key declarations for which wrapper types should be generated, and for their referencing foreign keys. *

    * This feature is available in the commercial distribution only. - * + * */ public Database withEmbeddableUniqueKeys(String value) { setEmbeddableUniqueKeys(value); @@ -2279,7 +2276,7 @@ public class Database implements Serializable, XMLAppendable * A regular expression matching all domain type declarations for which wrapper types should be generated. *

    * This feature is available in the commercial distribution only. - * + * */ public Database withEmbeddableDomains(String value) { setEmbeddableDomains(value); @@ -2298,7 +2295,7 @@ public class Database implements Serializable, XMLAppendable /** * The number of seconds that are considered "slow" before a query is logged to indicate a bug, 0 for not logging. - * + * */ public Database withLogSlowQueriesAfterSeconds(Integer value) { setLogSlowQueriesAfterSeconds(value); @@ -2307,7 +2304,7 @@ public class Database implements Serializable, XMLAppendable /** * The number of seconds that are considered "slow" before a result set is logged to indicate a bug, 0 for not logging. - * + * */ public Database withLogSlowResultsAfterSeconds(Integer value) { setLogSlowResultsAfterSeconds(value); diff --git a/jOOQ/src/main/java/org/jooq/ParserCLI.java b/jOOQ/src/main/java/org/jooq/ParserCLI.java index 5caf4e2f74..f6325eec33 100644 --- a/jOOQ/src/main/java/org/jooq/ParserCLI.java +++ b/jOOQ/src/main/java/org/jooq/ParserCLI.java @@ -120,6 +120,8 @@ public final class ParserCLI { settings.setParseNameCase(a.parseNameCase); if (a.parseNamedParamPrefix != null) settings.setParseNamedParamPrefix(a.parseNamedParamPrefix); + if (a.parseRetainCommentsBetweenQueries != null) + settings.setParseRetainCommentsBetweenQueries(a.parseRetainCommentsBetweenQueries); if (a.parseSetCommands != null) settings.setParseSetCommands(a.parseSetCommands); if (a.parseTimestampFormat != null) @@ -254,6 +256,12 @@ public final class ParserCLI { displayParseNamedParamPrefix(a); } + else if ("parse-retain-comments-between-queries".equals(flag)) { + if (arg != null) + a.parseRetainCommentsBetweenQueries = Boolean.parseBoolean(arg.toLowerCase()); + + displayParseRetainCommentsBetweenQueries(a); + } else if ("parse-set-commands".equals(flag)) { if (arg != null) a.parseSetCommands = Boolean.parseBoolean(arg.toLowerCase()); @@ -396,6 +404,10 @@ public final class ParserCLI { System.out.println("Parse named param prefix : " + a.parseNamedParamPrefix); } + private static void displayParseRetainCommentsBetweenQueries(Args a) { + System.out.println("Retain comments between queries : " + a.parseRetainCommentsBetweenQueries); + } + private static void displayParseSetCommands(Args a) { System.out.println("Parse set commands : " + a.parseSetCommands); } @@ -529,6 +541,8 @@ public final class ParserCLI { result.parseNamedParamPrefix = args[++i]; else if ("--parse-set-commands".equals(args[i])) result.parseSetCommands = true; + else if ("--parse-retain-comments-between-queries".equals(args[i])) + result.parseRetainCommentsBetweenQueries = true; else if ("--parse-timestamp-format".equals(args[i])) result.parseTimestampFormat = args[++i]; else if ("--parse-unknown-functions".equals(args[i])) @@ -601,6 +615,7 @@ public final class ParserCLI { System.out.println(" --parse-locale "); System.out.println(" --parse-name-case "); System.out.println(" --parse-named-param-prefix "); + System.out.println(" --parse-retain-comments-between-queries"); System.out.println(" --parse-set-commands"); System.out.println(" --parse-timestamp-format "); System.out.println(" --parse-unknown-functions "); @@ -638,6 +653,7 @@ public final class ParserCLI { System.out.println(" /parse-locale "); System.out.println(" /parse-name-case "); System.out.println(" /parse-named-param-prefix "); + System.out.println(" /parse-retain-comments-between-queries "); System.out.println(" /parse-set-commands "); System.out.println(" /parse-timestamp-format "); System.out.println(" /parse-unknown-functions "); @@ -684,6 +700,7 @@ public final class ParserCLI { Locale parseLocale = d.getParseLocale(); ParseNameCase parseNameCase = d.getParseNameCase(); String parseNamedParamPrefix = d.getParseNamedParamPrefix(); + Boolean parseRetainCommentsBetweenQueries = d.isParseRetainCommentsBetweenQueries(); Boolean parseSetCommands = d.isParseSetCommands(); String parseTimestampFormat = d.getParseTimestampFormat(); ParseUnknownFunctions parseUnknownFunctions = d.getParseUnknownFunctions(); diff --git a/jOOQ/src/main/java/org/jooq/conf/Settings.java b/jOOQ/src/main/java/org/jooq/conf/Settings.java index 6519451f7d..28f996253d 100644 --- a/jOOQ/src/main/java/org/jooq/conf/Settings.java +++ b/jOOQ/src/main/java/org/jooq/conf/Settings.java @@ -316,6 +316,8 @@ public class Settings protected String parseIgnoreCommentStart = "[jooq ignore start]"; @XmlElement(defaultValue = "[jooq ignore stop]") protected String parseIgnoreCommentStop = "[jooq ignore stop]"; + @XmlElement(defaultValue = "false") + protected Boolean parseRetainCommentsBetweenQueries = false; @XmlElement(defaultValue = "true") protected Boolean parseMetaDefaultExpressions = true; @XmlElement(defaultValue = "true") @@ -2881,6 +2883,36 @@ public class Settings this.parseIgnoreCommentStop = value; } + /** + * [#12538] Whether the parser should retain comments and whitespace between queries when parsing multiple queries through {@link org.jooq.Parser#parse(String)}. + *

    + * jOOQ's query object model doesn't have a way to represent comments + * or other whitespace, and as such, the parser simply skips them by default. + * However, it may be desirable to retain comments before or in between top + * level queries, when parsing multiple such queries in a script. Comments + * inside of queries (including procedural statements) are still not supported. + * + * @return + * possible object is + * {@link Boolean } + * + */ + public Boolean isParseRetainCommentsBetweenQueries() { + return parseRetainCommentsBetweenQueries; + } + + /** + * Sets the value of the parseRetainCommentsBetweenQueries property. + * + * @param value + * allowed object is + * {@link Boolean } + * + */ + public void setParseRetainCommentsBetweenQueries(Boolean value) { + this.parseRetainCommentsBetweenQueries = value; + } + /** * [#8469] Whether to parse default expressions retrieved from {@link java.sql.DatabaseMetaData}. * @@ -3911,6 +3943,11 @@ public class Settings return this; } + public Settings withParseRetainCommentsBetweenQueries(Boolean value) { + setParseRetainCommentsBetweenQueries(value); + return this; + } + public Settings withParseMetaDefaultExpressions(Boolean value) { setParseMetaDefaultExpressions(value); return this; @@ -4102,6 +4139,7 @@ public class Settings builder.append("parseIgnoreComments", parseIgnoreComments); builder.append("parseIgnoreCommentStart", parseIgnoreCommentStart); builder.append("parseIgnoreCommentStop", parseIgnoreCommentStop); + builder.append("parseRetainCommentsBetweenQueries", parseRetainCommentsBetweenQueries); builder.append("parseMetaDefaultExpressions", parseMetaDefaultExpressions); builder.append("applyWorkaroundFor7962", applyWorkaroundFor7962); builder.append("interpreterSearchPath", "schema", interpreterSearchPath); @@ -5172,6 +5210,15 @@ public class Settings return false; } } + if (parseRetainCommentsBetweenQueries == null) { + if (other.parseRetainCommentsBetweenQueries!= null) { + return false; + } + } else { + if (!parseRetainCommentsBetweenQueries.equals(other.parseRetainCommentsBetweenQueries)) { + return false; + } + } if (parseMetaDefaultExpressions == null) { if (other.parseMetaDefaultExpressions!= null) { return false; @@ -5340,6 +5387,7 @@ public class Settings result = ((prime*result)+((parseIgnoreComments == null)? 0 :parseIgnoreComments.hashCode())); result = ((prime*result)+((parseIgnoreCommentStart == null)? 0 :parseIgnoreCommentStart.hashCode())); result = ((prime*result)+((parseIgnoreCommentStop == null)? 0 :parseIgnoreCommentStop.hashCode())); + result = ((prime*result)+((parseRetainCommentsBetweenQueries == null)? 0 :parseRetainCommentsBetweenQueries.hashCode())); result = ((prime*result)+((parseMetaDefaultExpressions == null)? 0 :parseMetaDefaultExpressions.hashCode())); result = ((prime*result)+((applyWorkaroundFor7962 == null)? 0 :applyWorkaroundFor7962 .hashCode())); result = ((prime*result)+((interpreterSearchPath == null)? 0 :interpreterSearchPath.hashCode())); diff --git a/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java b/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java index bc44295ab8..5c83e08980 100644 --- a/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/ParserImpl.java @@ -791,15 +791,33 @@ final class DefaultParseContext extends AbstractScope implements ParseContext { static final Set SUPPORTS_HASH_COMMENT_SYNTAX = SQLDialect.supportedBy(MARIADB, MYSQL); + static final Pattern P_TRIM = Pattern.compile("^ *\\r?\\n?(.*?) *$"); final Queries parse() { return wrap(() -> { List result = new ArrayList<>(); Query query; + int p = positionBeforeWhitespace; do { parseDelimiterSpecifications(); - while (parseDelimiterIf(false)); + + while (parseDelimiterIf(false)) + p = positionBeforeWhitespace; + + skipWhitespace: + if (TRUE.equals(settings().isParseRetainCommentsBetweenQueries()) && p < position) { + + retainWhitespace: { + for (int i = p; i < position; i++) + if (character(i) != ' ') + break retainWhitespace; + + break skipWhitespace; + } + + result.add(new IgnoreQuery(P_TRIM.matcher(substring(p, position)).replaceFirst("$1"))); + } query = patchParsedQuery(parseQuery(false, false)); if (query == IGNORE || query == IGNORE_NO_DELIMITER) @@ -807,7 +825,7 @@ final class DefaultParseContext extends AbstractScope implements ParseContext { if (query != null) result.add(query); } - while (parseDelimiterIf(true) && !done()); + while (parseDelimiterIf(true) && (p = positionBeforeWhitespace) >= 0 && !done()); return done("Unexpected token or missing query delimiter", dsl.queries(result)); }); @@ -13366,9 +13384,9 @@ final class DefaultParseContext extends AbstractScope implements ParseContext { } private final boolean parseWhitespaceIf() { - int p = position(); - position(afterWhitespace(p)); - return p != position(); + positionBeforeWhitespace = position(); + position(afterWhitespace(positionBeforeWhitespace)); + return positionBeforeWhitespace != position(); } private final int afterWhitespace(int p) { @@ -13698,17 +13716,25 @@ final class DefaultParseContext extends AbstractScope implements ParseContext { "FOR" }; - private static final DDLQuery IGNORE = new IgnoreQuery(); - private static final Query IGNORE_NO_DELIMITER = new IgnoreQuery(); + private static final DDLQuery IGNORE = new IgnoreQuery(); + private static final Query IGNORE_NO_DELIMITER = new IgnoreQuery(); + + static final class IgnoreQuery extends AbstractDDLQuery implements UEmpty { + private final String sql; - private static final class IgnoreQuery extends AbstractDDLQuery implements UEmpty { IgnoreQuery() { + this("/* ignored */"); + } + + IgnoreQuery(String sql) { super(CTX.configuration()); + + this.sql = sql; } @Override public void accept(Context ctx) { - ctx.sql("/* ignored */"); + ctx.sql(sql); } } @@ -13719,6 +13745,7 @@ final class DefaultParseContext extends AbstractScope implements ParseContext { private final ParseWithMetaLookups metaLookups; private boolean metaLookupsForceIgnore; private final Consumer> bindParamListener; + private int positionBeforeWhitespace; private int position = 0; private boolean ignoreHints = true; private final Object[] bindings; diff --git a/jOOQ/src/main/java/org/jooq/impl/QueriesImpl.java b/jOOQ/src/main/java/org/jooq/impl/QueriesImpl.java index 06230020d6..1bb53959a9 100644 --- a/jOOQ/src/main/java/org/jooq/impl/QueriesImpl.java +++ b/jOOQ/src/main/java/org/jooq/impl/QueriesImpl.java @@ -58,6 +58,7 @@ import org.jooq.Query; import org.jooq.ResultQuery; import org.jooq.Results; import org.jooq.Traverser; +import org.jooq.impl.DefaultParseContext.IgnoreQuery; import org.jooq.impl.QOM.MList; import org.jooq.QueryPart; import org.jooq.impl.ResultsImpl.ResultOrRowsImpl; @@ -151,7 +152,10 @@ final class QueriesImpl extends AbstractAttachableQueryPart implements Queries { else ctx.formatSeparator(); - ctx.visit(query).sql(';'); + ctx.visit(query); + + if (!(query instanceof IgnoreQuery)) + ctx.sql(';'); } } diff --git a/jOOQ/src/main/resources/xsd/jooq-runtime-3.16.0.xsd b/jOOQ/src/main/resources/xsd/jooq-runtime-3.16.0.xsd index a1f3652c80..d326738be8 100644 --- a/jOOQ/src/main/resources/xsd/jooq-runtime-3.16.0.xsd +++ b/jOOQ/src/main/resources/xsd/jooq-runtime-3.16.0.xsd @@ -705,6 +705,16 @@ This feature is available in the commercial distribution only.]]>< + + + +jOOQ's query object model doesn't have a way to represent comments +or other whitespace, and as such, the parser simply skips them by default. +However, it may be desirable to retain comments before or in between top +level queries, when parsing multiple such queries in a script. Comments +inside of queries (including procedural statements) are still not supported.]]> +