The Wayback Machine - https://web.archive.org/web/20201011182843/https://github.com/JSQLParser/JSqlParser/pull/1045
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation visitor framework #1045

Open
wants to merge 263 commits into
base: master
from
Open

Conversation

@gitmotte
Copy link
Contributor

@gitmotte gitmotte commented Sep 11, 2020

#1005

extensible validation visitor framework
add (package net.sf.jsqlparser.util.validation)

  • an extensible validation visitor framework: ValidationCapability and its subtypes
    • FeatureSetValidation,
    • DatabaseMetaDataValidation,
    • AllowedTypesValidation

add (package net.sf.jsqlparser.parser.feature)

  • FeatureConfiguration class : common way for configurations of parser-features (supports Object-values - with convenience methods for boolean getAsBoolean, String getAsString)
  • Feature/FeatureSet classes : jsqlparser features which can be collected in featuresets

changes in branch https://github.com/gitmotte/JSqlParser/tree/master.validate within packages

  • net.sf.jsqlparser.util.validation
  • net.sf.jsqlparser.parser.feature
gitmotte added 30 commits Jul 6, 2020
* add some constructors
* fix and add "with" / "add" methods
* add some constructors
* add some with-methods
* add getter/setter named after the field without abbrivation
@gitmotte gitmotte changed the title WIP: Validation visitor framework Validation visitor framework Sep 22, 2020
@gitmotte
Copy link
Contributor Author

@gitmotte gitmotte commented Sep 22, 2020

@wumpz i think the next steps, bugfixes or features should be developed with new pull-requests


public JSQLParserException() {
super();
}

public JSQLParserException(String arg0) {
super(arg0);
public JSQLParserException(String message, Throwable cause) {

This comment has been minimized.

@AnEmortalKid

AnEmortalKid Sep 22, 2020
Contributor

changed the class which means we should update the serial right?

This comment has been minimized.

@gitmotte

gitmotte Sep 22, 2020
Author Contributor

ok, done

@AnEmortalKid
Copy link
Contributor

@AnEmortalKid AnEmortalKid commented Sep 22, 2020

Should this be split in chunks?

FeatureConfiguration class : common way for configurations of parser-features (supports Object-values - with convenience methods for boolean getAsBoolean, String getAsString)
Feature/FeatureSet classes : jsqlparser features which can be collected in featuresets

  1. extensible validation visitor framework
@gitmotte
Copy link
Contributor Author

@gitmotte gitmotte commented Sep 22, 2020

Should this be split in chunks?

No, the validation-framework depends on Feature/FeatureSet's, features could be parser-features like switching the ability for parsing the Square-Bracket Quotation (SQLServer-Feature) on or off - those Features are configured with FeatureConfiguration.
The most Feature's are currently only Validation-Features, the parser supports all of them, but we like to ensure a specific syntax (i.e. for postgresql database, see DatabaseType.POSTGRESQL) or we like to ensure sql-scripts do not change the DDL within your database (i.e. by validate against FeaturesAllowed.DML)
Therefore all Feature's can be validated (by extending the Validator-Visitors), but not all Feature's allow a parser-configuration.
And there are more validation-possibilities like

  • DatabaseMetaDataValidation (validate for names against a given database-connection)
  • AllowedTypesValidation (validate the model for correctness, i.e. when using the model-builder-pattern) (not supported within the validators currently)
  • ...
  • DatabaseType, Version: validate against features supported by one or multiple databases / versions of databases
  • FeaturesAllowed: validate against allowed features (like the sql GRANT, but without testing it against a database)
@gitmotte
Copy link
Contributor Author

@gitmotte gitmotte commented Sep 30, 2020

it's ready to merge now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.