diff --git a/.github/workflows/upload_release_asset.yml b/.github/workflows/github_release.yml similarity index 71% rename from .github/workflows/upload_release_asset.yml rename to .github/workflows/github_release.yml index 8edd221f..3afc9046 100644 --- a/.github/workflows/upload_release_asset.yml +++ b/.github/workflows/github_release.yml @@ -1,14 +1,17 @@ -name: Upload Release Asset +name: GitHub Release on: workflow_dispatch: inputs: - version: - description: 'Release version' - required: true upload_url: description: 'Upload URL' required: true + asset_name: + description: 'Asset file name' + required: true + asset_path: + description: 'Asset file path' + required: true jobs: build: @@ -28,6 +31,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ github.event.inputs.upload_url }} - asset_path: ./target/sql-statement-builder-${{ github.event.inputs.version }}.jar - asset_name: sql-statement-builder-${{ github.event.inputs.version }}.jar + asset_path: ${{ github.event.inputs.asset_path }} + asset_name: ${{ github.event.inputs.asset_name }} asset_content_type: application/java-archive \ No newline at end of file diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index dcaf65de..2a4f4d9d 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -5,12 +5,12 @@ name: Dependencies Check on: schedule: - - cron: "0 4 * * *" + - cron: "0 2 * * *" jobs: build: runs-on: ubuntu-latest - + steps: - uses: actions/checkout@v2 - name: Set up JDK 11 @@ -18,4 +18,4 @@ jobs: with: java-version: 11 - name: Checking dependencies for vulnerabilities - run: mvn org.sonatype.ossindex.maven:ossindex-maven-plugin:audit -f pom.xml + run: mvn org.sonatype.ossindex.maven:ossindex-maven-plugin:audit -f pom.xml \ No newline at end of file diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs index d5ad650e..e3a85800 100644 --- a/.settings/org.eclipse.jdt.core.prefs +++ b/.settings/org.eclipse.jdt.core.prefs @@ -1,4 +1,13 @@ eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.annotation.inheritNullAnnotations=disabled +org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore +org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull +org.eclipse.jdt.core.compiler.annotation.nonnull.secondary= +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault +org.eclipse.jdt.core.compiler.annotation.nonnullbydefault.secondary= +org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable +org.eclipse.jdt.core.compiler.annotation.nullable.secondary= +org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 @@ -7,11 +16,101 @@ org.eclipse.jdt.core.compiler.compliance=11 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.APILeak=warning +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore +org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning +org.eclipse.jdt.core.compiler.problem.nonnullTypeVariableFromLegacyInvocation=warning +org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error +org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=warning +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore +org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore +org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore +org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=disabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore +org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning +org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=ignore +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentType=warning +org.eclipse.jdt.core.compiler.problem.unlikelyCollectionMethodArgumentTypeStrict=disabled +org.eclipse.jdt.core.compiler.problem.unlikelyEqualsArgumentType=info +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore +org.eclipse.jdt.core.compiler.problem.unstableAutoModuleName=warning +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled +org.eclipse.jdt.core.compiler.problem.unusedExceptionParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedImport=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning +org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.release=disabled org.eclipse.jdt.core.compiler.source=11 org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns=false @@ -27,7 +126,6 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_c org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_assignment=0 -org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16 org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator=16 org.eclipse.jdt.core.formatter.alignment_for_compact_if=16 org.eclipse.jdt.core.formatter.alignment_for_compact_loops=16 @@ -58,9 +156,7 @@ org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0 org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0 org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16 org.eclipse.jdt.core.formatter.blank_lines_after_imports=1 -org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_after_package=1 -org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_field=0 org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0 org.eclipse.jdt.core.formatter.blank_lines_before_imports=1 @@ -69,7 +165,6 @@ org.eclipse.jdt.core.formatter.blank_lines_before_method=1 org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1 org.eclipse.jdt.core.formatter.blank_lines_before_package=0 org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1 -org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch=0 org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1 org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line @@ -83,7 +178,7 @@ org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line -org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=false +org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=true org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false @@ -139,12 +234,9 @@ org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=d org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert org.eclipse.jdt.core.formatter.insert_space_after_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case=insert -org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert -org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert @@ -172,7 +264,6 @@ org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declar org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert -org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert @@ -211,11 +302,8 @@ org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation=insert org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert org.eclipse.jdt.core.formatter.insert_space_before_additive_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert -org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case=insert -org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default=insert org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert -org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator=insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert @@ -260,7 +348,6 @@ org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_decla org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert -org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert @@ -341,12 +428,7 @@ org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line=one_line_never org.eclipse.jdt.core.formatter.lineSplit=120 org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false -org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block=0 -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block=0 org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block=0 -org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body=0 -org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block=0 org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1 org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines @@ -365,7 +447,6 @@ org.eclipse.jdt.core.formatter.use_on_off_tags=false org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true org.eclipse.jdt.core.formatter.wrap_before_additive_operator=true org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator=true org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true org.eclipse.jdt.core.formatter.wrap_before_logical_operator=true diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs index 6fc90cf3..e7e7880e 100644 --- a/.settings/org.eclipse.jdt.ui.prefs +++ b/.settings/org.eclipse.jdt.ui.prefs @@ -1,6 +1,67 @@ +cleanup.add_default_serial_version_id=true +cleanup.add_generated_serial_version_id=false +cleanup.add_missing_annotations=true +cleanup.add_missing_deprecated_annotations=true +cleanup.add_missing_methods=false +cleanup.add_missing_nls_tags=false +cleanup.add_missing_override_annotations=true +cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_serial_version_id=false +cleanup.always_use_blocks=true +cleanup.always_use_parentheses_in_expressions=false +cleanup.always_use_this_for_non_static_field_access=true +cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_functional_interfaces=true +cleanup.convert_to_enhanced_for_loop=true +cleanup.correct_indentation=true +cleanup.format_source_code=true +cleanup.format_source_code_changes_only=false +cleanup.insert_inferred_type_arguments=false +cleanup.make_local_variable_final=true +cleanup.make_parameters_final=true +cleanup.make_private_fields_final=true +cleanup.make_type_abstract_if_missing_method=false +cleanup.make_variable_declarations_final=true +cleanup.never_use_blocks=false +cleanup.never_use_parentheses_in_expressions=true +cleanup.organize_imports=false +cleanup.qualify_static_field_accesses_with_declaring_class=false +cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true +cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true +cleanup.qualify_static_member_accesses_with_declaring_class=true +cleanup.qualify_static_method_accesses_with_declaring_class=false +cleanup.remove_private_constructors=true +cleanup.remove_redundant_modifiers=false +cleanup.remove_redundant_semicolons=true +cleanup.remove_redundant_type_arguments=true +cleanup.remove_trailing_whitespaces=true +cleanup.remove_trailing_whitespaces_all=true +cleanup.remove_trailing_whitespaces_ignore_empty=false +cleanup.remove_unnecessary_casts=true +cleanup.remove_unnecessary_nls_tags=true +cleanup.remove_unused_imports=true +cleanup.remove_unused_local_variables=false +cleanup.remove_unused_private_fields=true +cleanup.remove_unused_private_members=true +cleanup.remove_unused_private_methods=true +cleanup.remove_unused_private_types=true +cleanup.sort_members=false +cleanup.sort_members_all=false +cleanup.use_anonymous_class_creation=false +cleanup.use_blocks=true +cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_lambda=true +cleanup.use_parentheses_in_expressions=true +cleanup.use_this_for_non_static_field_access=true +cleanup.use_this_for_non_static_field_access_only_if_necessary=false +cleanup.use_this_for_non_static_method_access=false +cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup_profile=_Exasol +cleanup_settings_version=2 eclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_settings_version=17 +formatter_profile=_Exasol +formatter_settings_version=16 org.eclipse.jdt.ui.ignorelowercasenames=true org.eclipse.jdt.ui.importorder=java;javax;org;com; org.eclipse.jdt.ui.ondemandthreshold=3 @@ -56,7 +117,6 @@ sp_cleanup.remove_unused_private_types=true sp_cleanup.sort_members=false sp_cleanup.sort_members_all=false sp_cleanup.use_anonymous_class_creation=false -sp_cleanup.use_autoboxing=false sp_cleanup.use_blocks=true sp_cleanup.use_blocks_only_for_return_and_throw=false sp_cleanup.use_lambda=true @@ -65,4 +125,3 @@ sp_cleanup.use_this_for_non_static_field_access=true sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false sp_cleanup.use_this_for_non_static_method_access=false sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true -sp_cleanup.use_unboxing=false diff --git a/doc/changes/changelog.md b/doc/changes/changelog.md index a2356338..a2c1f91a 100644 --- a/doc/changes/changelog.md +++ b/doc/changes/changelog.md @@ -1,4 +1,5 @@ # Changes -* [4.1.0](changes-4.1.0.md) -* [4.0.0](changes-4.0.0.md) \ No newline at end of file +* [4.2.0](changes_4.2.0.md) +* [4.1.0](changes_4.1.0.md) +* [4.0.0](changes_4.0.0.md) \ No newline at end of file diff --git a/doc/changes/changes-4.0.0.md b/doc/changes/changes_4.0.0.md similarity index 100% rename from doc/changes/changes-4.0.0.md rename to doc/changes/changes_4.0.0.md diff --git a/doc/changes/changes-4.1.0.md b/doc/changes/changes_4.1.0.md similarity index 100% rename from doc/changes/changes-4.1.0.md rename to doc/changes/changes_4.1.0.md diff --git a/doc/changes/changes_4.2.0.md b/doc/changes/changes_4.2.0.md new file mode 100644 index 00000000..52414fd3 --- /dev/null +++ b/doc/changes/changes_4.2.0.md @@ -0,0 +1,17 @@ +# SQL Statement Builder 4.2.0, released 2020-10-?? + +Code Name: LIKE predicate support + +## Features / Enhancements + +* #91: Added support for LIKE predicate. + +## Dependency updates + +* Added org.junit.jupiter:junit-jupiter:5.7.0 +* Updated org.mockito:mockito-core:jar:3.3.3 to version 3.5.13 +* Updated org.mockito:mockito-junit-jupiter:jar:3.3.3 to version 3.5.13 +* Updated nl.jqno.equalsverifier:equalsverifier:jar:3.4.1 to version 3.4.3 +* Removed org.junit.jupiter:junit-jupiter-engine +* Removed org.junit.jupiter:junit-jupiter-params +* Removed org.junit.platform:junit-platform-runner diff --git a/pom.xml b/pom.xml index 0bae3270..70afae0b 100644 --- a/pom.xml +++ b/pom.xml @@ -15,9 +15,6 @@ UTF-8 UTF-8 11 - 5.6.2 - 1.6.2 - 3.0.0-M4 true @@ -69,20 +66,8 @@ org.junit.jupiter - junit-jupiter-engine - ${junit.version} - test - - - org.junit.platform - junit-platform-runner - ${junit.platform.version} - test - - - org.junit.jupiter - junit-jupiter-params - ${junit.version} + junit-jupiter + 5.7.0 test @@ -94,19 +79,19 @@ org.mockito mockito-core - 3.3.3 + 3.5.13 test org.mockito mockito-junit-jupiter - 3.3.3 + 3.5.13 test nl.jqno.equalsverifier equalsverifier - 3.4.1 + 3.4.3 test @@ -143,7 +128,7 @@ org.apache.maven.plugins maven-surefire-plugin - ${maven.surefire.version} + 3.0.0-M4 org.apache.maven.plugins diff --git a/src/main/java/com/exasol/sql/dql/select/Select.java b/src/main/java/com/exasol/sql/dql/select/Select.java index ba8061cd..6fe4b5bd 100644 --- a/src/main/java/com/exasol/sql/dql/select/Select.java +++ b/src/main/java/com/exasol/sql/dql/select/Select.java @@ -55,7 +55,7 @@ public Select field(final String... names) { /** * Add a function. * - * @param functionName a name of function + * @param functionName a name of function * @param valueExpressions zero or more value expression * @return this instance for fluent programming */ @@ -66,8 +66,8 @@ public Select function(final FunctionName functionName, final ValueExpression... /** * Add a function. * - * @param functionName name of the function - * @param valueExpressions zero or more value expression + * @param functionName name of the function + * @param valueExpressions zero or more value expression * @param derivedColumnName name under which you can refer to the derived column * @return this instance for fluent programming */ @@ -82,9 +82,9 @@ public Select function(final FunctionName functionName, final String derivedColu /** * Add a User Defined Function. * - * @param functionName name of function + * @param functionName name of function * @param emitsColumnsDefinition column definitions for emits - * @param valueExpressions zero or more value expressions + * @param valueExpressions zero or more value expressions * @return this instance for fluent programming */ @@ -103,7 +103,7 @@ private Select createUdf(final Function udf) { /** * Add a User Defined Function. * - * @param functionName a name of function + * @param functionName a name of function * @param valueExpressions zero or more value expressions * @return this instance for fluent programming */ @@ -115,25 +115,50 @@ public Select udf(final String functionName, final ValueExpression... valueExpre /** * Add an arithmetic expression. * + * @deprecated please use a {@link #valueExpression(ValueExpression)} valueExpression} method instead. * @param arithmeticExpression arithmetic expression * @return this instance for fluent programming */ + @Deprecated public Select arithmeticExpression(final BinaryArithmeticExpression arithmeticExpression) { - final DerivedColumn derivedColumn = new DerivedColumn(this, arithmeticExpression); - this.derivedColumns.add(derivedColumn); - return this; + return valueExpression(arithmeticExpression); } /** * Add an arithmetic expression. - * + * + * @deprecated please use a {@link #valueExpression(ValueExpression, String)} valueExpression} method instead. * @param arithmeticExpression arithmetic expression - * @param derivedColumnName name under which you can refer to the derived column + * @param derivedColumnName name under which you can refer to the derived column * @return this instance for fluent programming */ + @Deprecated public Select arithmeticExpression(final BinaryArithmeticExpression arithmeticExpression, final String derivedColumnName) { - final DerivedColumn derivedColumn = new DerivedColumn(this, arithmeticExpression, derivedColumnName); + return valueExpression(arithmeticExpression, derivedColumnName); + } + + /** + * Add a value expression. + * + * @param valueExpression value expression + * @return this instance for fluent programming + */ + public Select valueExpression(final ValueExpression valueExpression) { + final DerivedColumn derivedColumn = new DerivedColumn(this, valueExpression); + this.derivedColumns.add(derivedColumn); + return this; + } + + /** + * Add a value expression expression. + * + * @param valueExpression value expression + * @param derivedColumnName name under which you can refer to the derived column + * @return this instance for fluent programming + */ + public Select valueExpression(final ValueExpression valueExpression, final String derivedColumnName) { + final DerivedColumn derivedColumn = new DerivedColumn(this, valueExpression, derivedColumnName); this.derivedColumns.add(derivedColumn); return this; } @@ -172,7 +197,7 @@ public synchronized Select limit(final int count) { * Create a new full outer {@link LimitClause}. * * @param offset index of the first row in the query result - * @param count maximum number of rows to be included in query result + * @param count maximum number of rows to be included in query result * @return this for fluent programming * @throws IllegalStateException if a limit clause already exists */ diff --git a/src/main/java/com/exasol/sql/expression/And.java b/src/main/java/com/exasol/sql/expression/And.java index 1716d0ed..5b550a52 100644 --- a/src/main/java/com/exasol/sql/expression/And.java +++ b/src/main/java/com/exasol/sql/expression/And.java @@ -1,7 +1,7 @@ package com.exasol.sql.expression; /** - * This class represents + * This class represents a logical AND predicate. */ public class And extends AbstractBooleanExpression { /** diff --git a/src/main/java/com/exasol/sql/expression/BooleanExpressionVisitor.java b/src/main/java/com/exasol/sql/expression/BooleanExpressionVisitor.java index e529ad58..c932c788 100644 --- a/src/main/java/com/exasol/sql/expression/BooleanExpressionVisitor.java +++ b/src/main/java/com/exasol/sql/expression/BooleanExpressionVisitor.java @@ -23,4 +23,8 @@ public interface BooleanExpressionVisitor { public void visit(Comparison comparison); public void leave(Comparison comparison); + + public void visit(Like like); + + public void leave(Like like); } \ No newline at end of file diff --git a/src/main/java/com/exasol/sql/expression/BooleanTerm.java b/src/main/java/com/exasol/sql/expression/BooleanTerm.java index 4a69f7df..271586ec 100644 --- a/src/main/java/com/exasol/sql/expression/BooleanTerm.java +++ b/src/main/java/com/exasol/sql/expression/BooleanTerm.java @@ -46,6 +46,22 @@ public static BooleanExpression or(final BooleanExpression... expressions) { return new Or(expressions); } + public static BooleanExpression like(final ValueExpression left, final ValueExpression right) { + return Like.builder().left(left).right(right).build(); + } + + public static BooleanExpression like(final ValueExpression left, final ValueExpression right, char escape) { + return Like.builder().left(left).right(right).escape(escape).build(); + } + + public static BooleanExpression notLike(final ValueExpression left, final ValueExpression right) { + return Like.builder().left(left).right(right).not().build(); + } + + public static BooleanExpression notLike(final ValueExpression left, final ValueExpression right, char escape) { + return Like.builder().left(left).right(right).not().escape(escape).build(); + } + // [impl->dsn~boolean-operation.comparison.constructing-from-strings~1] public static BooleanExpression compare(final ValueExpression left, final String operatorSymbol, final ValueExpression right) { @@ -91,7 +107,7 @@ public static BooleanExpression ge(final ValueExpression left, final ValueExpres /** * Create a logical operation from an operator name and a list of operands * - * @param operator name of the operator + * @param operator name of the operator * @param expressions operands * @return instance of either {@link And}, {@link Or} or {@link Not} * @throws IllegalArgumentException if the operator is unknown or null diff --git a/src/main/java/com/exasol/sql/expression/Comparison.java b/src/main/java/com/exasol/sql/expression/Comparison.java index 1372071f..3c509163 100644 --- a/src/main/java/com/exasol/sql/expression/Comparison.java +++ b/src/main/java/com/exasol/sql/expression/Comparison.java @@ -7,9 +7,9 @@ public class Comparison extends AbstractBooleanExpression { private final ValueExpression rightOperand; // [impl->dsn~boolean-operation.comparison.constructing-from-enum~1] - public Comparison(final ComparisonOperator equal, final ValueExpression leftOperand, + public Comparison(final ComparisonOperator comparisonOperator, final ValueExpression leftOperand, final ValueExpression rightOperand) { - this.operator = equal; + this.operator = comparisonOperator; this.leftOperand = leftOperand; this.rightOperand = rightOperand; } diff --git a/src/main/java/com/exasol/sql/expression/Like.java b/src/main/java/com/exasol/sql/expression/Like.java new file mode 100644 index 00000000..55548112 --- /dev/null +++ b/src/main/java/com/exasol/sql/expression/Like.java @@ -0,0 +1,144 @@ +package com.exasol.sql.expression; + +/** + * This class represents a logical LIKE predicate. + */ +public class Like extends AbstractBooleanExpression { + private final ValueExpression leftOperand; + private final ValueExpression rightOperand; + private final boolean not; + private final Character escape; + + private Like(final Builder builder) { + this.leftOperand = builder.left; + this.rightOperand = builder.right; + this.not = builder.not; + this.escape = builder.escape; + } + + /** + * Create a new builder for {@link Like}. + * + * @return new {@link Builder} + */ + public static Builder builder() { + return new Builder(); + } + + /** + * Get the left-hand side operator. + * + * @return left operator + */ + public ValueExpression getLeftOperand() { + return this.leftOperand; + } + + /** + * Get the right-hand side operator. + * + * @return right operator + */ + public ValueExpression getRightOperand() { + return this.rightOperand; + } + + /** + * Check if LIKE predicate has NOT. + * + * @return true if contains not + */ + public boolean hasNot() { + return this.not; + } + + /** + * Check if LIKE predicate has ESCAPE. + * + * @return true if contains not + */ + public boolean hasEscape() { + return this.escape != null; + } + + /** + * Get an escape character. + * + * @return escape char + */ + public Character getEscape() { + return this.escape; + } + + @Override + public void acceptConcrete(final BooleanExpressionVisitor visitor) { + visitor.visit(this); + } + + @Override + public void dismissConcrete(final BooleanExpressionVisitor visitor) { + visitor.leave(this); + } + + /** + * A builder for {@link Like}. + */ + public static class Builder { + private ValueExpression left; + private ValueExpression right; + private boolean not = false; + private Character escape = null; + + /** + * Add the left operand. + * + * @param left left operand + * @return this for fluent programming + */ + public Builder left(final ValueExpression left) { + this.left = left; + return this; + } + + /** + * Add the right operand. + * + * @param right right operand + * @return this for fluent programming + */ + public Builder right(final ValueExpression right) { + this.right = right; + return this; + } + + /** + * Set for NOT LIKE expression. + * + * @return this for fluent programming + */ + public Builder not() { + this.not = true; + return this; + } + + /** + * Add an escape character. + * + * @param escape escape character + * @return this for fluent programming + */ + public Builder escape(final char escape) { + this.escape = escape; + return this; + } + + /** + * Create a new instance of {@link Like}. + * + * @return new instance of {@link Like} + */ + public Like build() { + return new Like(this); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/exasol/sql/expression/Not.java b/src/main/java/com/exasol/sql/expression/Not.java index d77c94bd..c52e9752 100644 --- a/src/main/java/com/exasol/sql/expression/Not.java +++ b/src/main/java/com/exasol/sql/expression/Not.java @@ -1,7 +1,7 @@ package com.exasol.sql.expression; /** - * This class implements the logical unary NOT + * This class implements the logical unary NOT predicate. */ public class Not extends AbstractBooleanExpression { /** diff --git a/src/main/java/com/exasol/sql/expression/Or.java b/src/main/java/com/exasol/sql/expression/Or.java index 49518e25..193028c6 100644 --- a/src/main/java/com/exasol/sql/expression/Or.java +++ b/src/main/java/com/exasol/sql/expression/Or.java @@ -1,7 +1,7 @@ package com.exasol.sql.expression; /** - * This class represents + * This class represents a logical OR predicate. */ public class Or extends AbstractBooleanExpression { /** diff --git a/src/main/java/com/exasol/sql/expression/rendering/BooleanExpressionRenderer.java b/src/main/java/com/exasol/sql/expression/rendering/BooleanExpressionRenderer.java index e39c4c8f..11c48e4b 100644 --- a/src/main/java/com/exasol/sql/expression/rendering/BooleanExpressionRenderer.java +++ b/src/main/java/com/exasol/sql/expression/rendering/BooleanExpressionRenderer.java @@ -94,4 +94,31 @@ public void leave(final Comparison comparison) { endParenthesis(); } } + + @Override + public void visit(final Like like) { + connect(like); + if (!like.isRoot()) { + startParenthesis(); + } + appendOperand(like.getLeftOperand()); + if (like.hasNot()) { + this.builder.append(" NOT"); + } + this.builder.append(" LIKE "); + appendOperand(like.getRightOperand()); + if (like.hasEscape()) { + this.builder.append(" ESCAPE "); + this.builder.append("'"); + this.builder.append(like.getEscape()); + this.builder.append("'"); + } + } + + @Override + public void leave(final Like like) { + if (!like.isRoot()) { + endParenthesis(); + } + } } \ No newline at end of file diff --git a/src/test/java/com/exasol/sql/dql/select/rendering/TestSelectRendering.java b/src/test/java/com/exasol/sql/dql/select/rendering/TestSelectRendering.java index afd5a3dd..1717b5a8 100644 --- a/src/test/java/com/exasol/sql/dql/select/rendering/TestSelectRendering.java +++ b/src/test/java/com/exasol/sql/dql/select/rendering/TestSelectRendering.java @@ -2,10 +2,11 @@ import static com.exasol.hamcrest.SqlFragmentRenderResultMatcher.rendersTo; import static com.exasol.hamcrest.SqlFragmentRenderResultMatcher.rendersWithConfigTo; -import static com.exasol.sql.expression.BooleanTerm.eq; +import static com.exasol.sql.expression.BooleanTerm.*; +import static com.exasol.sql.expression.ExpressionTerm.stringLiteral; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.containsString; -import static org.junit.Assert.assertThrows; +import static org.junit.jupiter.api.Assertions.assertThrows; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -13,7 +14,8 @@ import com.exasol.sql.StatementFactory; import com.exasol.sql.ValueTable; import com.exasol.sql.dql.select.Select; -import com.exasol.sql.expression.*; +import com.exasol.sql.expression.BooleanExpression; +import com.exasol.sql.expression.ColumnReference; import com.exasol.sql.rendering.StringRendererConfig; class TestSelectRendering { @@ -77,7 +79,7 @@ void testSelectFromMultipleTableAs() { // [utest->dsn~select-statement.out-of-order-clauses~1] @Test void testAddClausesInRandomOrder() { - assertThat(this.select.limit(1).all().where(BooleanTerm.not(true)).from().join("A", "A.aa = B.bb").table("B"), + assertThat(this.select.limit(1).all().where(not(true)).from().join("A", "A.aa = B.bb").table("B"), rendersTo("SELECT * FROM B JOIN A ON A.aa = B.bb WHERE NOT(TRUE) LIMIT 1")); } @@ -102,7 +104,7 @@ void testQuotedIdentifiers() { final StringRendererConfig config = StringRendererConfig.builder().quoteIdentifiers(true).build(); final Select select = this.select.all(); select.from().table("person"); - select.where(eq(ExpressionTerm.stringLiteral("foo"), ColumnReference.of("test"))); + select.where(eq(stringLiteral("foo"), ColumnReference.of("test"))); assertThat(select, rendersWithConfigTo(config, "SELECT * FROM \"person\" WHERE 'foo' = \"test\"")); } @@ -126,4 +128,12 @@ void testSelectFromSubSelectInvalid() { assertThat(exception.getMessage(), containsString("SELECT statement cannot combine sub-select and value table")); } + + @Test + void testSelectWithLikePredicate() { + final BooleanExpression like1 = notLike(stringLiteral("abcd"), stringLiteral("a_d")); + final BooleanExpression like2 = like(stringLiteral("%bcd"), stringLiteral("\\%%d")); + this.select.valueExpression(like1, "res1").valueExpression(like2, "res2"); + assertThat(this.select, rendersTo("SELECT 'abcd' NOT LIKE 'a_d' res1, '%bcd' LIKE '\\%%d' res2")); + } } \ No newline at end of file diff --git a/src/test/java/com/exasol/sql/dql/select/rendering/TestWhereRendering.java b/src/test/java/com/exasol/sql/dql/select/rendering/TestWhereRendering.java index e3d4c643..738c9494 100644 --- a/src/test/java/com/exasol/sql/dql/select/rendering/TestWhereRendering.java +++ b/src/test/java/com/exasol/sql/dql/select/rendering/TestWhereRendering.java @@ -9,6 +9,7 @@ import com.exasol.sql.StatementFactory; import com.exasol.sql.dql.select.Select; +import com.exasol.sql.expression.BooleanTerm; import com.exasol.sql.expression.ExpressionTerm; class TestWhereRendering { @@ -17,12 +18,44 @@ class TestWhereRendering { @BeforeEach void beforeEach() { this.select = StatementFactory.getInstance().select(); - this.select.all().from().table("person"); + this.select.all().from().table("books"); } @Test void testWhere() { assertThat(this.select.where(eq(ExpressionTerm.stringLiteral("foo"), ExpressionTerm.stringLiteral("bar"))), - rendersTo("SELECT * FROM person WHERE 'foo' = 'bar'")); + rendersTo("SELECT * FROM books WHERE 'foo' = 'bar'")); + } + + @Test + void testWhereWithLike() { + assertThat( + this.select + .where(BooleanTerm.like(ExpressionTerm.column("ISBN"), ExpressionTerm.stringLiteral("123%"))), + rendersTo("SELECT * FROM books WHERE ISBN LIKE '123%'")); + } + + @Test + void testWhereWithLikeWithEscape() { + assertThat( + this.select.where( + BooleanTerm.like(ExpressionTerm.column("ISBN"), ExpressionTerm.stringLiteral("123%"), '/')), + rendersTo("SELECT * FROM books WHERE ISBN LIKE '123%' ESCAPE '/'")); + } + + @Test + void testWhereWithNotLike() { + assertThat( + this.select.where( + BooleanTerm.notLike(ExpressionTerm.column("ISBN"), ExpressionTerm.stringLiteral("123%"))), + rendersTo("SELECT * FROM books WHERE ISBN NOT LIKE '123%'")); + } + + @Test + void testWhereWithNotLikeWithEscape() { + assertThat( + this.select.where( + BooleanTerm.notLike(ExpressionTerm.column("ISBN"), ExpressionTerm.stringLiteral("123%"), '/')), + rendersTo("SELECT * FROM books WHERE ISBN NOT LIKE '123%' ESCAPE '/'")); } } \ No newline at end of file diff --git a/src/test/java/com/exasol/sql/expression/rendering/BinaryArithmeticExpressionRenderingTest.java b/src/test/java/com/exasol/sql/expression/rendering/BinaryArithmeticExpressionRenderingTest.java index ed63b39b..e61a0bbc 100644 --- a/src/test/java/com/exasol/sql/expression/rendering/BinaryArithmeticExpressionRenderingTest.java +++ b/src/test/java/com/exasol/sql/expression/rendering/BinaryArithmeticExpressionRenderingTest.java @@ -21,34 +21,34 @@ void beforeEach() { @Test void testPlusRendering() { - this.select.arithmeticExpression(plus(integerLiteral(1000), integerLiteral(234)), "ADD"); + this.select.valueExpression(plus(integerLiteral(1000), integerLiteral(234)), "ADD"); assertThat(this.select, rendersTo("SELECT (1000+234) ADD")); } @Test void testMinusRendering() { - this.select.arithmeticExpression(minus(integerLiteral(1000), integerLiteral(1)), "SUB"); + this.select.valueExpression(minus(integerLiteral(1000), integerLiteral(1)), "SUB"); assertThat(this.select, rendersTo("SELECT (1000-1) SUB")); } @Test void testMultiplyRendering() { - this.select.arithmeticExpression(multiply(integerLiteral(1000), integerLiteral(1)), "MULT"); + this.select.valueExpression(multiply(integerLiteral(1000), integerLiteral(1)), "MULT"); assertThat(this.select, rendersTo("SELECT (1000*1) MULT")); } @Test void testDivideRendering() { - this.select.arithmeticExpression(divide(integerLiteral(1000), integerLiteral(1)), "DIV"); + this.select.valueExpression(divide(integerLiteral(1000), integerLiteral(1)), "DIV"); assertThat(this.select, rendersTo("SELECT (1000/1) DIV")); } @Test void testMultilevelExpressionRendering() { - this.select.arithmeticExpression(divide(plus(integerLiteral(1000), integerLiteral(234)), + this.select.valueExpression(divide(plus(integerLiteral(1000), integerLiteral(234)), multiply(integerLiteral(1000), integerLiteral(100)))); assertThat(this.select, rendersTo("SELECT ((1000+234)/(1000*100))")); } diff --git a/versionsMavenPluginRules.xml b/versionsMavenPluginRules.xml new file mode 100644 index 00000000..c566b427 --- /dev/null +++ b/versionsMavenPluginRules.xml @@ -0,0 +1,17 @@ + + + + + (?i).*Alpha(?:-?\d+)? + (?i).*a(?:-?\d+)? + (?i).*Beta(?:-?\d+)? + (?i).*-B(?:-?\d+)? + (?i).*RC(?:-?\d+)? + (?i).*CR(?:-?\d+)? + (?i).*M(?:-?\d+)? + + + + \ No newline at end of file