diff --git a/.gitignore b/.gitignore index 1c4903b..d76842d 100644 --- a/.gitignore +++ b/.gitignore @@ -148,3 +148,6 @@ docs/phpdoc* .project all_tests build/.phpunit.result.cache +.phpunit.cache +.php-cs-fixer.cache +tools/phpDocumentor diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 0000000..e9c974e --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,524 @@ +in([ + __DIR__ . '/src', + __DIR__ . '/tests', + __DIR__ . '/tools', + ]) + ->exclude([ + 'vendor', + ]); + +return (new Config()) + ->setRiskyAllowed(TRUE) + ->setFinder($finder) + ->setIndent(' ') + ->setRules([ + 'align_multiline_comment' => false, + 'array_indentation' => true, + 'array_push' => true, + 'array_syntax' => ['syntax' => 'short'], + 'assign_null_coalescing_to_coalesce_equal' => true, + 'backtick_to_shell_exec' => true, + 'binary_operator_spaces' => [ + 'default' => 'single_space', + 'operators' => [ + '=' => NULL, + '&' => NULL, + ] + ], + 'blank_line_after_namespace' => true, + 'blank_line_after_opening_tag' => false, + 'blank_line_before_statement' => [ + 'statements' => [ + // 'case', + 'continue', + 'declare', + 'default', + 'do', + 'exit', + 'for', + 'foreach', + 'goto', + 'return', + 'switch', + 'throw', + 'try', + 'while', + 'yield', + 'yield_from', + ], + ], + 'braces' => [ + 'allow_single_line_anonymous_class_with_empty_body' => true, + 'allow_single_line_closure' => true, + 'position_after_anonymous_constructs' => 'same', + 'position_after_control_structures' => 'next', + 'position_after_functions_and_oop_constructs' => 'next', + ], + 'cast_spaces' => ['space' => 'single'], + 'class_attributes_separation' => [ + 'elements' => [ + 'const' => 'none', + 'property' => 'none', + 'method' => 'one', + 'trait_import' => 'none', + ], + ], + 'class_definition' => [ + 'multi_line_extends_each_single_line' => true, + 'single_item_single_line' => true, + 'single_line' => true, + 'space_before_parenthesis' => true, + ], + 'class_reference_name_casing' => true, + 'clean_namespace' => true, + 'combine_consecutive_issets' => true, + 'combine_consecutive_unsets' => true, + 'combine_nested_dirname' => true, + 'comment_to_phpdoc' => [ + 'ignored_tags' => [ + 'todo', + 'codeCoverageIgnore', + 'codeCoverageIgnoreStart', + 'codeCoverageIgnoreEnd', + 'phpstan-ignore-line', + 'phpstan-ignore-next-line', + ], + ], + 'compact_nullable_typehint' => true, + 'concat_space' => ['spacing' => 'one'], + 'constant_case' => ['case' => 'upper'], + 'control_structure_continuation_position' => ['position' => 'next_line'], + 'date_time_immutable' => false, + 'declare_equal_normalize' => ['space' => 'none'], + 'declare_parentheses' => true, + 'declare_strict_types' => true, + 'dir_constant' => true, + 'doctrine_annotation_array_assignment' => false, + 'doctrine_annotation_braces' => false, + 'doctrine_annotation_indentation' => false, + 'doctrine_annotation_spaces' => false, + 'echo_tag_syntax' => [ + 'format' => 'short', + 'long_function' => 'echo', + 'shorten_simple_statements_only' => false, + ], + 'elseif' => true, + 'empty_loop_body' => ['style' => 'braces'], + 'empty_loop_condition' => ['style' => 'while'], + 'encoding' => true, + 'error_suppression' => [ + 'mute_deprecation_error' => true, + 'noise_remaining_usages' => false, + 'noise_remaining_usages_exclude' => [], + ], + 'escape_implicit_backslashes' => [ + 'double_quoted' => false, + 'heredoc_syntax' => false, + 'single_quoted' => false, + ], + 'explicit_indirect_variable' => false, + 'explicit_string_variable' => false, + 'final_class' => false, + 'final_internal_class' => [ + 'annotation_exclude' => ['@no-final'], + 'annotation_include' => ['@internal'], + 'consider_absent_docblock_as_internal_class' => false, + ], + 'final_public_method_for_abstract_class' => false, + 'fopen_flag_order' => true, + 'fopen_flags' => ['b_mode' => true], + 'full_opening_tag' => true, + 'fully_qualified_strict_types' => true, + 'function_declaration' => ['closure_function_spacing' => 'one'], + 'function_to_constant' => [ + 'functions' => [ + 'get_called_class', + 'get_class', + 'get_class_this', + 'php_sapi_name', + 'phpversion', + 'pi', + ], + ], + 'function_typehint_space' => true, + 'general_phpdoc_annotation_remove' => false, + 'general_phpdoc_tag_rename' => false, + 'get_class_to_class_keyword' => false, + 'global_namespace_import' => [ + 'import_constants' => true, + 'import_functions' => true, + 'import_classes' => true, + ], + 'group_import' => true, + 'header_comment' => false, // false by default + // 'heredoc_indentation' => ['indentation' => 'start_plus_one'], + 'heredoc_to_nowdoc' => true, + 'implode_call' => true, + 'include' => true, + 'increment_style' => ['style' => 'post'], + 'indentation_type' => true, + 'integer_literal_case' => true, + 'is_null' => true, + 'lambda_not_used_import' => true, + 'line_ending' => true, + 'linebreak_after_opening_tag' => false, + 'list_syntax' => ['syntax' => 'short'], + 'logical_operators' => true, + 'lowercase_cast' => true, + 'lowercase_keywords' => true, + 'lowercase_static_reference' => true, + 'magic_constant_casing' => true, + 'magic_method_casing' => true, + 'mb_str_functions' => false, + 'method_argument_space' => [ + 'after_heredoc' => false, + 'keep_multiple_spaces_after_comma' => false, + 'on_multiline' => 'ensure_fully_multiline', + ], + 'method_chaining_indentation' => true, + 'modernize_strpos' => false, // requires 8.0+ + 'modernize_types_casting' => true, + 'multiline_comment_opening_closing' => true, + 'multiline_whitespace_before_semicolons' => ['strategy' => 'no_multi_line'], + 'native_constant_invocation' => false, + 'native_function_casing' => true, + 'native_function_invocation' => false, + 'native_function_type_declaration_casing' => true, + 'new_with_braces' => false, + 'no_alias_functions' => ['sets' => ['@all']], + 'no_alias_language_construct_call' => true, + 'no_alternative_syntax' => ['fix_non_monolithic_code' => false], + 'no_binary_string' => true, + 'no_blank_lines_after_class_opening' => true, + 'no_blank_lines_after_phpdoc' => true, + 'no_blank_lines_before_namespace' => false, // conflicts with `single_blank_line_before_namespace` + 'no_break_comment' => ['comment_text' => 'no break'], + 'no_closing_tag' => true, + 'no_empty_comment' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_blank_lines' => ['tokens' => ['extra']], + 'no_homoglyph_names' => true, + 'no_leading_import_slash' => true, + 'no_leading_namespace_whitespace' => true, + 'no_mixed_echo_print' => ['use' => 'echo'], + 'no_multiline_whitespace_around_double_arrow' => true, + 'no_null_property_initialization' => true, + 'no_short_bool_cast' => true, + 'no_singleline_whitespace_before_semicolons' => true, + 'no_space_around_double_colon' => true, + 'no_spaces_after_function_name' => true, + 'no_spaces_around_offset' => ['positions' => ['inside', 'outside']], + 'no_spaces_inside_parenthesis' => true, + 'no_superfluous_elseif' => true, + 'no_superfluous_phpdoc_tags' => [ + 'allow_mixed' => true, + 'allow_unused_params' => true, + 'remove_inheritdoc' => false, + ], + 'no_trailing_comma_in_singleline' => true, + 'no_trailing_whitespace' => true, + 'no_trailing_whitespace_in_comment' => true, + 'no_trailing_whitespace_in_string' => true, + 'no_unneeded_control_parentheses' => [ + 'statements' => [ + 'break', + 'clone', + 'continue', + 'echo_print', + 'return', + 'switch_case', + 'yield', + ], + ], + 'no_unneeded_curly_braces' => ['namespaces' => true], + 'no_unneeded_final_method' => ['private_methods' => true], + 'no_unneeded_import_alias' => true, + 'no_unreachable_default_argument_value' => true, + 'no_unset_cast' => true, + 'no_unset_on_property' => false, + 'no_unused_imports' => true, + 'no_useless_else' => true, + 'no_useless_return' => true, + 'no_useless_sprintf' => true, + 'no_whitespace_before_comma_in_array' => ['after_heredoc' => true], + 'no_whitespace_in_blank_line' => true, + 'non_printable_character' => ['use_escape_sequences_in_strings' => true], + 'normalize_index_brace' => true, + 'not_operator_with_space' => true, + 'not_operator_with_successor_space' => true, + 'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => true], + 'object_operator_without_whitespace' => true, + 'operator_linebreak' => ['only_booleans' => true, 'position' => 'beginning'], + 'ordered_class_elements' => [ + 'order' => [ + 'use_trait', + 'case', + 'constant_public', + 'constant_protected', + 'constant_private', + 'property_public', + 'property_protected', + 'property_private', + 'construct', + 'destruct', + 'magic', + ], + 'sort_algorithm' => 'none', + ], + 'ordered_imports' => [ + 'sort_algorithm' => 'alpha', + 'imports_order' => ['class', 'function', 'const'], + ], + 'ordered_interfaces' => false, + 'ordered_traits' => false, + 'php_unit_construct' => [ + 'assertions' => [ + 'assertSame', + 'assertEquals', + 'assertNotEquals', + 'assertNotSame', + ], + ], + 'php_unit_dedicate_assert' => ['target' => 'newest'], + 'php_unit_dedicate_assert_internal_type' => ['target' => 'newest'], + 'php_unit_expectation' => ['target' => 'newest'], + 'php_unit_fqcn_annotation' => true, + 'php_unit_internal_class' => ['types' => ['final']], + 'php_unit_method_casing' => ['case' => 'camel_case'], + 'php_unit_mock' => ['target' => 'newest'], + 'php_unit_mock_short_will_return' => true, + 'php_unit_namespaced' => ['target' => 'newest'], + 'php_unit_no_expectation_annotation' => [ + 'target' => 'newest', + 'use_class_const' => true, + ], + 'php_unit_set_up_tear_down_visibility' => true, + 'php_unit_size_class' => false, +// 'php_unit_strict' => [ +// 'assertions' => [ +// 'assertAttributeEquals', +// 'assertAttributeNotEquals', +// 'assertEquals', +// 'assertNotEquals', +// ], +// ], + 'php_unit_test_annotation' => ['style' => 'prefix'], + 'php_unit_test_case_static_method_calls' => [ + 'call_type' => 'this', + 'methods' => [], + ], + 'php_unit_test_class_requires_covers' => false, + 'phpdoc_add_missing_param_annotation' => ['only_untyped' => true], + 'phpdoc_align' => [ + 'align' => 'left' + ], + 'phpdoc_annotation_without_dot' => false, + 'phpdoc_indent' => true, + 'phpdoc_inline_tag_normalizer' => [ + 'tags' => [ + 'example', + 'id', + 'internal', + 'inheritdoc', + 'inheritdocs', + 'link', + 'source', + 'toc', + 'tutorial', + ], + ], + 'phpdoc_line_span' => [ + 'const' => 'multi', + 'method' => 'multi', + 'property' => 'multi', + ], + 'phpdoc_no_access' => true, + 'phpdoc_no_empty_return' => false, + 'phpdoc_no_package' => false, + 'phpdoc_no_useless_inheritdoc' => true, + 'phpdoc_order' => true, + 'phpdoc_order_by_value' => [ + 'annotations' => [ + 'author', + 'covers', + 'coversNothing', + 'dataProvider', + 'depends', + 'group', + 'internal', + 'method', + 'property', + 'property-read', + 'property-write', + 'requires', + 'throws', + 'uses', + ], + ], + 'phpdoc_return_self_reference' => [ + 'replacements' => [ + 'this' => '$this', + '@this' => '$this', + '$self' => 'self', + '@self' => 'self', + '$static' => 'static', + '@static' => 'static', + ], + ], + 'phpdoc_scalar' => [ + 'types' => [ + 'boolean', + 'callback', + 'double', + 'integer', + 'real', + 'str', + ], + ], + 'phpdoc_separation' => false, + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_summary' => false, + 'phpdoc_tag_casing' => ['tags' => ['inheritDoc']], + 'phpdoc_tag_type' => ['tags' => ['inheritDoc' => 'inline']], + 'phpdoc_to_comment' => false, + 'phpdoc_to_param_type' => false, + 'phpdoc_to_property_type' => false, + 'phpdoc_to_return_type' => false, + 'phpdoc_trim' => true, + 'phpdoc_trim_consecutive_blank_line_separation' => true, + 'phpdoc_types' => ['groups' => ['simple', 'alias', 'meta']], + 'phpdoc_types_order' => [ + 'null_adjustment' => 'always_last', + 'sort_algorithm' => 'alpha', + ], + 'phpdoc_var_annotation_correct_order' => true, + 'phpdoc_var_without_name' => true, + 'pow_to_exponentiation' => true, + 'protected_to_private' => true, + 'psr_autoloading' => ['dir' => null], + 'random_api_migration' => [ + 'replacements' => [ + 'getrandmax' => 'mt_getrandmax', + 'rand' => 'mt_rand', + 'srand' => 'mt_srand', + ], + ], + 'regular_callable_call' => true, + 'return_assignment' => true, + 'return_type_declaration' => ['space_before' => 'none'], + 'self_accessor' => false, + 'self_static_accessor' => true, + 'semicolon_after_instruction' => false, + 'set_type_to_cast' => true, + 'short_scalar_cast' => true, + 'simple_to_complex_string_variable' => true, + 'simplified_if_return' => true, + 'simplified_null_return' => false, + 'single_blank_line_at_eof' => true, + 'single_blank_line_before_namespace' => true, + 'single_class_element_per_statement' => ['elements' => ['const', 'property']], + 'single_import_per_statement' => false, + 'single_line_after_imports' => true, + 'single_line_comment_style' => ['comment_types' => ['asterisk', 'hash']], + 'single_line_throw' => false, + 'single_quote' => ['strings_containing_single_quote_chars' => false], + 'single_space_after_construct' => [ + 'constructs' => [ + 'abstract', + 'as', + 'attribute', + 'break', + 'case', + 'catch', + 'class', + 'clone', + 'comment', + 'const', + 'const_import', + 'continue', + 'do', + 'echo', + 'else', + 'elseif', + 'extends', + 'final', + 'finally', + 'for', + 'foreach', + 'function', + 'function_import', + 'global', + 'goto', + 'if', + 'implements', + 'include', + 'include_once', + 'instanceof', + 'insteadof', + 'interface', + 'match', + 'named_argument', + 'new', + 'open_tag_with_echo', + 'php_doc', + 'php_open', + 'print', + 'private', + 'protected', + 'public', + 'require', + 'require_once', + 'return', + 'static', + 'throw', + 'trait', + 'try', + 'use', + 'use_lambda', + 'use_trait', + 'var', + 'while', + 'yield', + 'yield_from', + ], + ], + 'single_trait_insert_per_statement' => true, + 'space_after_semicolon' => ['remove_in_empty_for_expressions' => true], + 'standardize_increment' => true, + 'standardize_not_equals' => true, + 'static_lambda' => true, + 'strict_comparison' => true, + 'strict_param' => true, + 'string_length_to_empty' => true, + 'string_line_ending' => true, + 'switch_case_semicolon_to_colon' => true, + 'switch_case_space' => true, + 'switch_continue_to_break' => true, + 'ternary_operator_spaces' => true, + 'ternary_to_elvis_operator' => true, + 'ternary_to_null_coalescing' => true, + 'trailing_comma_in_multiline' => [ + 'after_heredoc' => true, + 'elements' => ['arrays'], + ], + 'trim_array_spaces' => true, + 'types_spaces' => ['space' => 'none'], + 'unary_operator_spaces' => false, + 'use_arrow_functions' => true, + 'visibility_required' => ['elements' => ['const', 'method', 'property']], + 'void_return' => false, // changes method signature + 'whitespace_after_comma_in_array' => true, + 'yoda_style' => [ + 'equal' => false, + 'identical' => null, + 'less_and_greater' => false, + 'always_move_variable' => false, + ], + ]); diff --git a/.scrutinizer.yml b/.scrutinizer.yml deleted file mode 100644 index c8221ee..0000000 --- a/.scrutinizer.yml +++ /dev/null @@ -1,25 +0,0 @@ -imports: - - php - -tools: - external_code_coverage: - timeout: 1000 - # PHP - - # Don't like PSR standards, not going to get messages for them! - php_code_sniffer: false - - php_sim: true - # Can't be used with similarity analyzer - php_cpd: false - - php_mess_detector: true - php_pdepend: true - php_loc: true - php_analyzer: - config: - metrics_lack_of_cohesion_methods: - enabled: true - doc_comment_fixes: - enabled: true - php_hhvm: true \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ae2522c..0000000 --- a/.travis.yml +++ /dev/null @@ -1,43 +0,0 @@ -dist: bionic -os: linux - -arch: - - amd64 - - arm64 - - ppc64le - -language: php - -services: - - mysql - - postgresql - -php: - - nightly -# - '8.0' - - '8.1' - - '8.2' -# - '7.4' -# - '8.0' - - -before_script: - - psql -c 'DROP DATABASE IF EXISTS test;' -U postgres - - psql -c 'create database test;' -U postgres - - mysql -e 'create database IF NOT EXISTS test;' - - composer install --ignore-platform-reqs - -script: - - mkdir -p build/logs - - cd build - - ../vendor/bin/phpunit -c phpunit.xml --coverage-clover build/logs/clover.xml - - cd ../ - -after_script: - - wget https://scrutinizer-ci.com/ocular.phar - - php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml - -jobs: - allow_failures: - - arch: ppc64le - - php: nightly diff --git a/README.md b/README.md index 7e49c4b..ab19d95 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,6 @@ A query builder/database abstraction layer, using prepared statements for security. -[![Code Coverage](https://scrutinizer-ci.com/g/aviat4ion/Query/badges/coverage.png?b=develop)](https://scrutinizer-ci.com/g/aviat4ion/Query/?branch=develop) -[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/aviat4ion/Query/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/aviat4ion/Query/?branch=develop) [![Latest Stable Version](https://poser.pugx.org/aviat/query/v/stable.png)](https://packagist.org/packages/aviat/query) [![Total Downloads](https://poser.pugx.org/aviat/query/downloads.png)](https://packagist.org/packages/aviat/query) [![Latest Unstable Version](https://poser.pugx.org/aviat/query/v/unstable.png)](https://packagist.org/packages/aviat/query) diff --git a/RoboFile.php b/RoboFile.php deleted file mode 100644 index 3427c99..0000000 --- a/RoboFile.php +++ /dev/null @@ -1,305 +0,0 @@ -prepare(); - $this->lint(); - $this->phploc(TRUE); - $this->phpcs(TRUE); - $this->phpmd(TRUE); - $this->phpcpdReport(); - } - - /** - * Run all tests, generate coverage, generate docs, generate code statistics - */ - public function build(): void - { - $this->analyze(); - $this->coverage(); - $this->docs(); - } - - /** - * Cleanup temporary files - */ - public function clean(): void - { - // So the task doesn't complain, - // make any 'missing' dirs to cleanup - array_map(static function ($dir) { - if ( ! is_dir($dir)) - { - `mkdir -p {$dir}`; - } - }, $this->cleanDirs); - - $this->_cleanDir($this->cleanDirs); - $this->_deleteDir($this->cleanDirs); - } - - /** - * Run unit tests and generate coverage reports - */ - public function coverage(): void - { - $this->_run(['phpdbg -qrr -- vendor/bin/phpunit -c build']); - } - - /** - * Generate documentation with phpdox - */ - public function docs(): void - { - $this->_run(['tools/phpdox/vendor/bin/phpdox']); - } - - /** - * Verify that source files are valid - */ - public function lint(): void - { - $files = $this->getAllSourceFiles(); - - $chunks = array_chunk($files, (int)shell_exec('getconf _NPROCESSORS_ONLN')); - - foreach($chunks as $chunk) - { - $this->parallelLint($chunk); - } - } - - /** - * Run the phpcs tool - * - * @param bool $report - if true, generates reports instead of direct output - */ - public function phpcs(bool $report = FALSE): void - { - $dir = __DIR__; - - $report_cmd_parts = [ - 'tools/vendor/bin/phpcs', - "--standard=./build/CodeIgniter", - "--report-checkstyle=./build/logs/phpcs.xml", - ]; - - $normal_cmd_parts = [ - 'tools/vendor/bin/phpcs', - "--standard=./build/CodeIgniter", - ]; - - $cmd_parts = ($report) ? $report_cmd_parts : $normal_cmd_parts; - - $this->_run($cmd_parts); - } - - public function phpmd(bool $report = FALSE): void - { - $report_cmd_parts = [ - 'tools/vendor/bin/phpmd', - './src', - 'xml', - 'cleancode,codesize,controversial,design,naming,unusedcode', - '--exclude ParallelAPIRequest', - '--reportfile ./build/logs/phpmd.xml' - ]; - - $normal_cmd_parts = [ - 'tools/vendor/bin/phpmd', - './src', - 'ansi', - 'cleancode,codesize,controversial,design,naming,unusedcode', - '--exclude ParallelAPIRequest' - ]; - - $cmd_parts = ($report) ? $report_cmd_parts : $normal_cmd_parts; - - $this->_run($cmd_parts); - } - - /** - * Run the phploc tool - * - * @param bool $report - if true, generates reports instead of direct output - */ - public function phploc($report = FALSE): void - { - // Command for generating reports - $report_cmd_parts = [ - 'tools/vendor/bin/phploc', - '--count-tests', - '--log-csv=build/logs/phploc.csv', - '--log-xml=build/logs/phploc.xml', - 'src', - 'tests' - ]; - - // Command for generating direct output - $normal_cmd_parts = [ - 'tools/vendor/bin/phploc', - '--count-tests', - 'src', - 'tests' - ]; - - $cmd_parts = ($report) ? $report_cmd_parts : $normal_cmd_parts; - - $this->_run($cmd_parts); - } - - /** - * Create temporary directories - */ - public function prepare(): void - { - array_map([$this, '_mkdir'], $this->taskDirs); - } - - /** - * Lint php files and run unit tests - */ - public function test(): void - { - $this->lint(); - $this->taskPhpUnit() - ->configFile('build/phpunit.xml') - ->run(); - $this->_run(["php tests/index.php"]); - } - - /** - * Watches for file updates, and automatically runs appropriate actions - */ - public function watch(): void - { - $this->taskWatch() - ->monitor('composer.json', function() { - $this->taskComposerUpdate()->run(); - }) - ->monitor('src', function () { - $this->taskExec('test')->run(); - }) - ->monitor('tests', function () { - $this->taskExec('test')->run(); - }) - ->run(); - } - - /** - * Get the total list of source files, including tests - * - * @return array - */ - protected function getAllSourceFiles(): array - { - $files = array_merge( - glob_recursive('build/*.php'), - glob_recursive('src/*.php'), - glob_recursive('tests/*.php'), - glob('*.php') - ); - - sort($files); - - return $files; - } - - /** - * Run php's linter in one parallel task for the passed chunk - * - * @param array $chunk - */ - protected function parallelLint(array $chunk): void - { - $task = $this->taskParallelExec() - ->timeout(5) - ->printed(FALSE); - - foreach($chunk as $file) - { - $task = $task->process("php -l {$file}"); - } - - $task->run(); - } - - /** - * Generate copy paste detector report - */ - protected function phpcpdReport(): void - { - $cmd_parts = [ - 'tools/vendor/bin/phpcpd', - '--log-pmd build/logs/pmd-cpd.xml', - 'src' - ]; - $this->_run($cmd_parts); - } - - /** - * Shortcut for joining an array of command arguments - * and then running it - * - * @param array $cmd_parts - command arguments - * @param string $join_on - what to join the command arguments with - */ - protected function _run(array $cmd_parts, $join_on = ' '): void - { - $this->taskExec(implode($join_on, $cmd_parts))->run(); - } -} diff --git a/apiDocumentation/classes/Query-ConnectionManager.html b/apiDocumentation/classes/Query-ConnectionManager.html index b8a6c3e..f7e0246 100644 --- a/apiDocumentation/classes/Query-ConnectionManager.html +++ b/apiDocumentation/classes/Query-ConnectionManager.html @@ -115,9 +115,9 @@
Connection manager class to manage connections for the @@ -212,9 +212,9 @@ Query method
Private clone method to prevent cloning
@@ -260,9 +260,9 @@ Query methodPrevent serialization of this object
@@ -308,9 +308,9 @@ Query methodMake sure serialize/deserialize doesn't work
@@ -356,9 +356,9 @@ Query methodParse the passed parameters and return a connection
@@ -375,7 +375,8 @@ Query method : array<string|int, mixed>|objectReturns the connection specified by the name given
@@ -419,7 +420,8 @@ Query method : string = ''Return a connection manager instance
@@ -507,9 +509,9 @@ Query methodParses params into a dsn and option array
@@ -526,7 +528,8 @@ Query method : array<string|int, mixed>|objectBase Database class
@@ -422,9 +422,9 @@ the connection/databaseAllow invoke to work on table object
@@ -455,19 +455,6 @@ the connection/database -
public
- __construct(string $dsn[, string $username = NULL ][, string $password = NULL ][, array<string|int, mixed> $driverOptions = [] ]) : mixed
+ __construct(string $dsn[, string|null $username = NULL ][, string|null $password = NULL ][, array<string|int, mixed> $driverOptions = [] ]) : mixed
Helper method for quote_ident
@@ -576,7 +563,8 @@ the connection/database : mixedReturns number of rows affected by an INSERT, UPDATE, DELETE type query
@@ -635,9 +623,9 @@ the connection/databaseMethod to simplify retrieving db results for meta-data queries
@@ -688,9 +676,9 @@ the connection/databaseRetrieve column information for the current database table
@@ -733,9 +721,9 @@ the connection/databaseReturn list of dbs for the current connection, if possible
@@ -767,9 +755,9 @@ the connection/databaseRetrieve foreign keys for the table
@@ -812,9 +800,9 @@ the connection/databaseReturn list of functions for the current database
@@ -861,9 +849,9 @@ the connection/databaseRetrieve indexes for the table
@@ -906,9 +894,9 @@ the connection/databaseGet the last sql query executed
@@ -940,9 +928,9 @@ the connection/databaseReturn list of stored procedures for the current database
@@ -1023,9 +1011,9 @@ the connection/databaseReturn list of sequences for the current database, if they exist
@@ -1057,9 +1045,9 @@ the connection/databaseGet the SQL class for the current driver
@@ -1091,9 +1079,9 @@ the connection/databaseRetrieves an array of non-user-created tables for @@ -1160,9 +1148,9 @@ the connection/database
Return list of triggers for the current database
@@ -1209,9 +1197,9 @@ the connection/databaseRetrieve list of data types for the database
@@ -1243,9 +1231,9 @@ the connection/databaseGet the Util class for the current driver
@@ -1277,9 +1265,9 @@ the connection/databaseGet the version of the database engine
@@ -1311,9 +1299,9 @@ the connection/databaseReturn list of views for the current database
@@ -1345,9 +1333,9 @@ the connection/databaseCreate sql for batch insert
@@ -1398,9 +1386,9 @@ the connection/databaseReturn the number of rows returned for a SELECT query
@@ -1446,9 +1434,9 @@ the connection/databasePrefixes a table if it is not already prefixed
@@ -1491,9 +1479,9 @@ the connection/databaseCreate and execute a prepared statement with the provided parameters
@@ -1558,9 +1546,9 @@ the connection/databaseSimplifies prepared statements for database queries
@@ -1611,9 +1599,9 @@ the connection/databaseSurrounds the string with the databases identifier escape characters
@@ -1656,9 +1644,9 @@ the connection/databaseQuote database table name, and set prefix
@@ -1701,9 +1689,9 @@ the connection/databaseGenerate the returning clause for the current database
@@ -1754,9 +1742,9 @@ the connection/databaseSet the last query sql
@@ -1799,9 +1787,9 @@ the connection/databaseSet the common table name prefix
@@ -1844,9 +1832,9 @@ the connection/databaseEmpty the passed table
@@ -1889,9 +1877,9 @@ the connection/databaseCreates a batch update, and executes it.
diff --git a/apiDocumentation/classes/Query-Drivers-AbstractSQL.html b/apiDocumentation/classes/Query-Drivers-AbstractSQL.html index a89482f..d9b278e 100644 --- a/apiDocumentation/classes/Query-Drivers-AbstractSQL.html +++ b/apiDocumentation/classes/Query-Drivers-AbstractSQL.html @@ -119,9 +119,9 @@Parent for database-specific syntax subclasses
@@ -185,9 +185,9 @@Limit clause
diff --git a/apiDocumentation/classes/Query-Drivers-AbstractUtil.html b/apiDocumentation/classes/Query-Drivers-AbstractUtil.html index 9a0940a..29a62a3 100644 --- a/apiDocumentation/classes/Query-Drivers-AbstractUtil.html +++ b/apiDocumentation/classes/Query-Drivers-AbstractUtil.html @@ -116,9 +116,9 @@Abstract class defining database / table creation methods
@@ -205,9 +205,9 @@Save a reference to the connection object for later use
@@ -264,19 +264,6 @@ -Return an SQL file with the database table structure
@@ -311,19 +298,6 @@ -Convenience public function to generate sql for creating a db table
@@ -413,9 +387,9 @@Drop the selected table
@@ -458,9 +432,9 @@Get the driver object for the current connection
diff --git a/apiDocumentation/classes/Query-Drivers-DriverInterface.html b/apiDocumentation/classes/Query-Drivers-DriverInterface.html index 68107d6..58d8869 100644 --- a/apiDocumentation/classes/Query-Drivers-DriverInterface.html +++ b/apiDocumentation/classes/Query-Drivers-DriverInterface.html @@ -385,7 +385,7 @@ the connection/database
public
- __construct(string $dsn[, string $username = NULL ][, string $password = NULL ][, array<string|int, mixed> $driverOptions = [] ]) : mixed
+ __construct(string $dsn[, string|null $username = NULL ][, string|null $password = NULL ][, array<string|int, mixed> $driverOptions = [] ]) : mixed
MySQL specific class
@@ -406,9 +406,9 @@ the connection/databaseAllow invoke to work on table object
@@ -439,19 +439,6 @@ the connection/database -
public
- __construct(string $dsn[, string $username = NULL ][, string $password = NULL ][, array<string|int, mixed> $options = [] ]) : mixed
+ __construct(string $dsn[, string|null $username = NULL ][, string|null $password = NULL ][, array<string|int, mixed> $options = [] ]) : mixed
Helper method for quote_ident
@@ -573,7 +547,8 @@ the connection/database : mixedReturns number of rows affected by an INSERT, UPDATE, DELETE type query
@@ -632,9 +607,9 @@ the connection/databaseMethod to simplify retrieving db results for meta-data queries
@@ -685,9 +660,9 @@ the connection/databaseRetrieve column information for the current database table
@@ -730,9 +705,9 @@ the connection/databaseReturn list of dbs for the current connection, if possible
@@ -764,9 +739,9 @@ the connection/databaseRetrieve foreign keys for the table
@@ -809,9 +784,9 @@ the connection/databaseReturn list of functions for the current database
@@ -858,9 +833,9 @@ the connection/databaseRetrieve indexes for the table
@@ -903,9 +878,9 @@ the connection/databaseGet the last sql query executed
@@ -937,9 +912,9 @@ the connection/databaseReturn list of stored procedures for the current database
@@ -1020,9 +995,9 @@ the connection/databaseReturn list of sequences for the current database, if they exist
@@ -1054,9 +1029,9 @@ the connection/databaseGet the SQL class for the current driver
@@ -1088,9 +1063,9 @@ the connection/databaseRetrieves an array of non-user-created tables for @@ -1157,9 +1132,9 @@ the connection/database
Return list of triggers for the current database
@@ -1206,9 +1181,9 @@ the connection/databaseRetrieve list of data types for the database
@@ -1240,9 +1215,9 @@ the connection/databaseGet the Util class for the current driver
@@ -1274,9 +1249,9 @@ the connection/databaseGet the version of the database engine
@@ -1308,9 +1283,9 @@ the connection/databaseReturn list of views for the current database
@@ -1342,9 +1317,9 @@ the connection/databaseCreate sql for batch insert
@@ -1395,9 +1370,9 @@ the connection/databaseReturn the number of rows returned for a SELECT query
@@ -1443,9 +1418,9 @@ the connection/databasePrefixes a table if it is not already prefixed
@@ -1488,9 +1463,9 @@ the connection/databaseCreate and execute a prepared statement with the provided parameters
@@ -1555,9 +1530,9 @@ the connection/databaseSimplifies prepared statements for database queries
@@ -1608,9 +1583,9 @@ the connection/databaseSurrounds the string with the databases identifier escape characters
@@ -1653,9 +1628,9 @@ the connection/databaseQuote database table name, and set prefix
@@ -1698,9 +1673,9 @@ the connection/databaseGenerate the returning clause for the current database
@@ -1751,9 +1726,9 @@ the connection/databaseSet the last query sql
@@ -1796,9 +1771,9 @@ the connection/databaseSet the common table name prefix
@@ -1841,9 +1816,9 @@ the connection/databaseEmpty the passed table
@@ -1886,9 +1861,9 @@ the connection/databaseCreates a batch update, and executes it.
diff --git a/apiDocumentation/classes/Query-Drivers-Mysql-SQL.html b/apiDocumentation/classes/Query-Drivers-Mysql-SQL.html index d63cc0e..dca8729 100644 --- a/apiDocumentation/classes/Query-Drivers-Mysql-SQL.html +++ b/apiDocumentation/classes/Query-Drivers-Mysql-SQL.html @@ -120,9 +120,9 @@MySQL specific SQL
@@ -273,9 +273,9 @@ tableSQL to show information about columns in a table
@@ -318,9 +318,9 @@ tableReturns sql to list other databases
@@ -352,9 +352,9 @@ tableGet the query plan for the sql query
@@ -397,9 +397,9 @@ tableGet the list of foreign keys for the current @@ -443,9 +443,9 @@ table
Return sql to list functions
@@ -457,19 +457,6 @@ table -Get the list of indexes for the current table
@@ -535,9 +522,9 @@ tableLimit clause
@@ -596,9 +583,9 @@ tableReturn sql to list stored procedures
@@ -610,19 +597,6 @@ table -Random ordering keyword
@@ -677,9 +651,9 @@ tableReturn sql to list sequences
@@ -711,9 +685,9 @@ tableOverridden in MySQL class
@@ -745,9 +719,9 @@ tableReturns sql to list tables
@@ -790,9 +764,9 @@ tableReturns sql to list triggers
@@ -804,19 +778,6 @@ table -SQL to show list of field types
@@ -871,9 +832,9 @@ tableReturns sql to list views
diff --git a/apiDocumentation/classes/Query-Drivers-Mysql-Util.html b/apiDocumentation/classes/Query-Drivers-Mysql-Util.html index f8bb428..8f1c6be 100644 --- a/apiDocumentation/classes/Query-Drivers-Mysql-Util.html +++ b/apiDocumentation/classes/Query-Drivers-Mysql-Util.html @@ -120,9 +120,9 @@MySQL-specific backup, import and creation methods
@@ -209,9 +209,9 @@Save a reference to the connection object for later use
@@ -299,9 +299,9 @@Create an SQL backup file for the current database's structure
@@ -333,9 +333,9 @@Convenience public function to generate sql for creating a db table
@@ -402,9 +402,9 @@Drop the selected table
@@ -447,9 +447,9 @@Get the driver object for the current connection
diff --git a/apiDocumentation/classes/Query-Drivers-Pgsql-Driver.html b/apiDocumentation/classes/Query-Drivers-Pgsql-Driver.html index 8d6daa7..b7f1c6d 100644 --- a/apiDocumentation/classes/Query-Drivers-Pgsql-Driver.html +++ b/apiDocumentation/classes/Query-Drivers-Pgsql-Driver.html @@ -120,9 +120,9 @@PostgreSQL specific class
@@ -406,9 +406,9 @@ the connection/databaseAllow invoke to work on table object
@@ -439,19 +439,6 @@ the connection/database -
public
- __construct(string $dsn[, string $username = NULL ][, string $password = NULL ][, array<string|int, mixed> $options = [] ]) : mixed
+ __construct(string $dsn[, string|null $username = NULL ][, string|null $password = NULL ][, array<string|int, mixed> $options = [] ]) : mixed
Helper method for quote_ident
@@ -573,7 +547,8 @@ the connection/database : mixedReturns number of rows affected by an INSERT, UPDATE, DELETE type query
@@ -632,9 +607,9 @@ the connection/databaseMethod to simplify retrieving db results for meta-data queries
@@ -685,9 +660,9 @@ the connection/databaseRetrieve column information for the current database table
@@ -730,9 +705,9 @@ the connection/databaseReturn list of dbs for the current connection, if possible
@@ -764,9 +739,9 @@ the connection/databaseRetrieve foreign keys for the table
@@ -809,9 +784,9 @@ the connection/databaseReturn list of functions for the current database
@@ -858,9 +833,9 @@ the connection/databaseRetrieve indexes for the table
@@ -903,9 +878,9 @@ the connection/databaseGet the last sql query executed
@@ -937,9 +912,9 @@ the connection/databaseReturn list of stored procedures for the current database
@@ -986,9 +961,9 @@ the connection/databaseGet a list of schemas for the current connection
@@ -1020,9 +995,9 @@ the connection/databaseReturn list of sequences for the current database, if they exist
@@ -1054,9 +1029,9 @@ the connection/databaseGet the SQL class for the current driver
@@ -1088,9 +1063,9 @@ the connection/databaseRetrieves an array of non-user-created tables for @@ -1157,9 +1132,9 @@ the connection/database
Return list of triggers for the current database
@@ -1206,9 +1181,9 @@ the connection/databaseRetrieve list of data types for the database
@@ -1240,9 +1215,9 @@ the connection/databaseGet the Util class for the current driver
@@ -1274,9 +1249,9 @@ the connection/databaseGet the version of the database engine
@@ -1308,9 +1283,9 @@ the connection/databaseReturn list of views for the current database
@@ -1342,9 +1317,9 @@ the connection/databaseCreate sql for batch insert
@@ -1395,9 +1370,9 @@ the connection/databaseReturn the number of rows returned for a SELECT query
@@ -1443,9 +1418,9 @@ the connection/databasePrefixes a table if it is not already prefixed
@@ -1488,9 +1463,9 @@ the connection/databaseCreate and execute a prepared statement with the provided parameters
@@ -1555,9 +1530,9 @@ the connection/databaseSimplifies prepared statements for database queries
@@ -1608,9 +1583,9 @@ the connection/databaseSurrounds the string with the databases identifier escape characters
@@ -1653,9 +1628,9 @@ the connection/databaseQuote database table name, and set prefix
@@ -1698,9 +1673,9 @@ the connection/databaseGenerate the returning clause for the current database
@@ -1751,9 +1726,9 @@ the connection/databaseSet the last query sql
@@ -1796,9 +1771,9 @@ the connection/databaseSet the common table name prefix
@@ -1841,9 +1816,9 @@ the connection/databaseEmpty the passed table
@@ -1886,9 +1861,9 @@ the connection/databaseCreates a batch update, and executes it.
diff --git a/apiDocumentation/classes/Query-Drivers-Pgsql-SQL.html b/apiDocumentation/classes/Query-Drivers-Pgsql-SQL.html index 04ac021..d6a41c3 100644 --- a/apiDocumentation/classes/Query-Drivers-Pgsql-SQL.html +++ b/apiDocumentation/classes/Query-Drivers-Pgsql-SQL.html @@ -120,9 +120,9 @@PostgreSQL specific SQL
@@ -273,9 +273,9 @@ tableReturn sql to list columns of the specified table
@@ -318,9 +318,9 @@ tableReturns sql to list other databases
@@ -352,9 +352,9 @@ tableGet the query plan for the sql query
@@ -397,9 +397,9 @@ tableGet the list of foreign keys for the current @@ -443,9 +443,9 @@ table
Return sql to list functions
@@ -477,9 +477,9 @@ tableGet the list of indexes for the current table
@@ -522,9 +522,9 @@ tableLimit clause
@@ -583,9 +583,9 @@ tableReturn sql to list stored procedures
@@ -617,9 +617,9 @@ tableRandom ordering keyword
@@ -651,9 +651,9 @@ tableReturn sql to list sequences
@@ -685,9 +685,9 @@ tableReturns sql to list system tables
@@ -719,9 +719,9 @@ tableReturns sql to list tables
@@ -753,9 +753,9 @@ tableReturns sql to list triggers
@@ -787,9 +787,9 @@ tableSQL to show list of field types
@@ -821,9 +821,9 @@ tableReturns sql to list views
diff --git a/apiDocumentation/classes/Query-Drivers-Pgsql-Util.html b/apiDocumentation/classes/Query-Drivers-Pgsql-Util.html index 7d0922f..e7c32a6 100644 --- a/apiDocumentation/classes/Query-Drivers-Pgsql-Util.html +++ b/apiDocumentation/classes/Query-Drivers-Pgsql-Util.html @@ -120,9 +120,9 @@Postgres-specific backup, import and creation methods
@@ -209,9 +209,9 @@Save a reference to the connection object for later use
@@ -254,9 +254,9 @@Create an SQL backup file for the current database's data
@@ -299,9 +299,9 @@Create an SQL backup file for the current database's structure
@@ -333,9 +333,9 @@Convenience public function to generate sql for creating a db table
@@ -402,9 +402,9 @@Drop the selected table
@@ -447,9 +447,9 @@Get the driver object for the current connection
diff --git a/apiDocumentation/classes/Query-Drivers-SQLInterface.html b/apiDocumentation/classes/Query-Drivers-SQLInterface.html index fb5094b..7b360d9 100644 --- a/apiDocumentation/classes/Query-Drivers-SQLInterface.html +++ b/apiDocumentation/classes/Query-Drivers-SQLInterface.html @@ -112,9 +112,9 @@Interface for database-specific syntax subclasses
@@ -264,9 +264,9 @@ tableGet information about the columns in the @@ -310,9 +310,9 @@ specified table
Returns sql to list other databases
@@ -344,9 +344,9 @@ specified tableModify the query to get the query plan
@@ -389,9 +389,9 @@ specified tableGet the list of foreign keys for the current @@ -435,9 +435,9 @@ table
Return sql to list functions
@@ -469,9 +469,9 @@ tableGet the list of indexes for the current table
@@ -514,9 +514,9 @@ tableGet database specific sql for limit clause
@@ -575,9 +575,9 @@ tableReturn sql to list stored procedures
@@ -609,9 +609,9 @@ tableGet the sql for random ordering
@@ -643,9 +643,9 @@ tableReturn sql to list sequences
@@ -677,9 +677,9 @@ tableReturns sql to list system tables
@@ -711,9 +711,9 @@ tableReturns sql to list tables
@@ -745,9 +745,9 @@ tableReturns sql to list triggers
@@ -779,9 +779,9 @@ tableReturn sql to list database field types
@@ -813,9 +813,9 @@ tableReturns sql to list views
diff --git a/apiDocumentation/classes/Query-Drivers-Sqlite-Driver.html b/apiDocumentation/classes/Query-Drivers-Sqlite-Driver.html index bb1bd5b..490a66e 100644 --- a/apiDocumentation/classes/Query-Drivers-Sqlite-Driver.html +++ b/apiDocumentation/classes/Query-Drivers-Sqlite-Driver.html @@ -120,9 +120,9 @@SQLite specific class
@@ -299,7 +299,7 @@ the connection/databaseAllow invoke to work on table object
@@ -439,19 +439,6 @@ the connection/database -Open SQLite Database
public
- __construct(string $dsn[, string $user = NULL ][, string $pass = NULL ][, array<string|int, mixed> $driverOptions = [] ]) : mixed
+ __construct(string $dsn[, string|null $user = NULL ][, string|null $pass = NULL ][, array<string|int, mixed> $driverOptions = [] ]) : mixed
Helper method for quote_ident
@@ -560,7 +547,8 @@ the connection/database : mixedReturns number of rows affected by an INSERT, UPDATE, DELETE type query
@@ -619,9 +607,9 @@ the connection/databaseMethod to simplify retrieving db results for meta-data queries
@@ -672,9 +660,9 @@ the connection/databaseRetrieve column information for the current database table
@@ -717,9 +705,9 @@ the connection/databaseReturn list of dbs for the current connection, if possible. Meaningless for SQLite.
@@ -751,9 +739,9 @@ the connection/databaseRetrieve foreign keys for the table
@@ -796,9 +784,9 @@ the connection/databaseReturn list of functions for the current database
@@ -845,9 +833,9 @@ the connection/databaseRetrieve indexes for the table
@@ -890,9 +878,9 @@ the connection/databaseGet the last sql query executed
@@ -924,9 +912,9 @@ the connection/databaseReturn list of stored procedures for the current database
@@ -1007,9 +995,9 @@ the connection/databaseReturn list of sequences for the current database, if they exist
@@ -1041,9 +1029,9 @@ the connection/databaseGet the SQL class for the current driver
@@ -1075,9 +1063,9 @@ the connection/databaseRetrieves an array of non-user-created tables for @@ -1110,9 +1098,9 @@ the connection/database
List tables for the current database
@@ -1144,9 +1132,9 @@ the connection/databaseReturn list of triggers for the current database
@@ -1193,9 +1181,9 @@ the connection/databaseRetrieve list of data types for the database
@@ -1227,9 +1215,9 @@ the connection/databaseGet the Util class for the current driver
@@ -1261,9 +1249,9 @@ the connection/databaseGet the version of the database engine
@@ -1295,9 +1283,9 @@ the connection/databaseReturn list of views for the current database
@@ -1329,16 +1317,16 @@ the connection/databaseCreate sql for batch insert
public
- insertBatch(string $table[, array<string|int, mixed> $data = [] ]) : array<string|int, array<string|int, mixed>>|array<string|int, string>|array<string|int, null>
+ insertBatch(string $table[, array<string|int, mixed> $data = [] ]) : array<string|int, array<string|int, mixed>>|array<string|int, null>|array<string|int, string>
Return the number of rows returned for a SELECT query
@@ -1443,9 +1418,9 @@ the connection/databasePrefixes a table if it is not already prefixed
@@ -1488,9 +1463,9 @@ the connection/databaseCreate and execute a prepared statement with the provided parameters
@@ -1555,9 +1530,9 @@ the connection/databaseSimplifies prepared statements for database queries
@@ -1608,9 +1583,9 @@ the connection/databaseSurrounds the string with the databases identifier escape characters
@@ -1653,9 +1628,9 @@ the connection/databaseQuote database table name, and set prefix
@@ -1698,9 +1673,9 @@ the connection/databaseGenerate the returning clause for the current database
@@ -1751,9 +1726,9 @@ the connection/databaseSet the last query sql
@@ -1796,9 +1771,9 @@ the connection/databaseSet the common table name prefix
@@ -1841,9 +1816,9 @@ the connection/databaseEmpty the passed table
@@ -1886,9 +1861,9 @@ the connection/databaseCreates a batch update, and executes it.
diff --git a/apiDocumentation/classes/Query-Drivers-Sqlite-SQL.html b/apiDocumentation/classes/Query-Drivers-Sqlite-SQL.html index fccbaf0..859b836 100644 --- a/apiDocumentation/classes/Query-Drivers-Sqlite-SQL.html +++ b/apiDocumentation/classes/Query-Drivers-Sqlite-SQL.html @@ -120,9 +120,9 @@SQLite Specific SQL
@@ -274,9 +274,9 @@ tableSQL to show information about columns in a table
@@ -319,9 +319,9 @@ tableReturns sql to list other databases. Meaningless for SQLite, as this @@ -354,9 +354,9 @@ just returns the database(s) that we are currently connected to.
Get the query plan for the sql query
@@ -399,9 +399,9 @@ just returns the database(s) that we are currently connected to.Get the list of foreign keys for the current @@ -445,9 +445,9 @@ table
Return sql to list functions
@@ -538,9 +538,9 @@ tableLimit clause
@@ -599,9 +599,9 @@ tableReturn sql to list stored procedures
@@ -647,9 +647,9 @@ tableRandom ordering keyword
@@ -681,9 +681,9 @@ tableReturn sql to list sequences
@@ -715,9 +715,9 @@ tableList the system tables
@@ -749,9 +749,9 @@ tableReturns sql to list tables
@@ -783,9 +783,9 @@ tableReturns sql to list triggers
@@ -817,9 +817,9 @@ tableSQL to show list of field types
@@ -851,9 +851,9 @@ tableReturns sql to list views
diff --git a/apiDocumentation/classes/Query-Drivers-Sqlite-Util.html b/apiDocumentation/classes/Query-Drivers-Sqlite-Util.html index d11406c..6ae2494 100644 --- a/apiDocumentation/classes/Query-Drivers-Sqlite-Util.html +++ b/apiDocumentation/classes/Query-Drivers-Sqlite-Util.html @@ -120,9 +120,9 @@SQLite-specific backup, import and creation methods
@@ -209,9 +209,9 @@Save a reference to the connection object for later use
@@ -254,9 +254,9 @@Create an SQL backup file for the current database's data
@@ -299,9 +299,9 @@Create an SQL backup file for the current database's structure
@@ -333,9 +333,9 @@Convenience public function to generate sql for creating a db table
@@ -402,9 +402,9 @@Drop the selected table
@@ -447,9 +447,9 @@Get the driver object for the current connection
diff --git a/apiDocumentation/classes/Query-Exception-BadDBDriverException.html b/apiDocumentation/classes/Query-Exception-BadDBDriverException.html index 9014db7..36825b6 100644 --- a/apiDocumentation/classes/Query-Exception-BadDBDriverException.html +++ b/apiDocumentation/classes/Query-Exception-BadDBDriverException.html @@ -119,9 +119,9 @@Generic exception for bad drivers
diff --git a/apiDocumentation/classes/Query-Exception-NonExistentConnectionException.html b/apiDocumentation/classes/Query-Exception-NonExistentConnectionException.html index 7f99b0b..b00d55e 100644 --- a/apiDocumentation/classes/Query-Exception-NonExistentConnectionException.html +++ b/apiDocumentation/classes/Query-Exception-NonExistentConnectionException.html @@ -119,9 +119,9 @@Exception for missing database connection
diff --git a/apiDocumentation/classes/Query-Exception-NotImplementedException.html b/apiDocumentation/classes/Query-Exception-NotImplementedException.html index f985182..65081b3 100644 --- a/apiDocumentation/classes/Query-Exception-NotImplementedException.html +++ b/apiDocumentation/classes/Query-Exception-NotImplementedException.html @@ -119,9 +119,9 @@Exception for non-implemented method
diff --git a/apiDocumentation/classes/Query-JoinType.html b/apiDocumentation/classes/Query-JoinType.html index 6ea9cc9..e207820 100644 --- a/apiDocumentation/classes/Query-JoinType.html +++ b/apiDocumentation/classes/Query-JoinType.html @@ -117,9 +117,9 @@Enum of join types
@@ -202,56 +202,6 @@ - - - - - - - - -'Enum' of join types
@@ -188,9 +188,9 @@Enum of query map types
@@ -153,56 +153,6 @@Convenience class for creating sql queries
@@ -180,14 +180,14 @@ : mixed -Convenience property for connection management
@@ -805,9 +805,9 @@ passed array with key / value pairsList of queries executed
@@ -844,9 +844,9 @@ passed array with key / value pairsCalls a function further down the inheritance chain.
@@ -918,13 +918,13 @@ passed array with key / value pairs -Constructor
- +
public
__construct(DriverInterface|null $driver, QueryParser $parser) : mixed
-
+
+
Destructor
- +
public
__destruct() : mixed
+
+
-
- Retrieve the number of rows in the selected table
@@ -1163,9 +1150,9 @@ passed array with key / value pairsRetrieve the number of results for the generated query - used @@ -1247,7 +1234,8 @@ in place of the get() method
: mixed = ''Adds the 'distinct' keyword to a query
@@ -1422,9 +1410,9 @@ in place of the get() methodTell the database to give you the query plan instead of result set
@@ -1456,9 +1444,9 @@ in place of the get() methodSpecify the database table to select from
@@ -1501,9 +1489,9 @@ in place of the get() methodSelect and retrieve all records from the current table, and/or @@ -2307,9 +2295,9 @@ execute current compiled query
Convenience method for get() with a where clause
@@ -2375,9 +2363,9 @@ execute current compiled queryGroup the results by the selected field(s)
@@ -2394,7 +2382,8 @@ execute current compiled query : mixedEnds a query group
@@ -2453,9 +2442,9 @@ execute current compiled queryAdds a paren to the current query for query grouping
@@ -2487,9 +2476,9 @@ execute current compiled queryGenerates a 'Having' clause
@@ -2506,14 +2495,16 @@ execute current compiled query : mixedCreates an insert clause, and executes it
@@ -2565,7 +2556,8 @@ execute current compiled query : mixed = []Creates and executes a batch insertion query
@@ -2677,9 +2669,9 @@ execute current compiled queryCreates a join phrase in a compiled query
@@ -2784,9 +2776,9 @@ execute current compiled queryCreates a Like clause in the sql statement
@@ -2811,7 +2803,8 @@ execute current compiled query : mixedSet a limit on the current sql statement
@@ -2897,9 +2890,9 @@ execute current compiled queryAdds a paren to the current query for query grouping, @@ -2932,9 +2925,9 @@ prefixed with 'NOT'
Generates a NOT LIKE clause
@@ -2959,7 +2952,8 @@ prefixed with 'NOT' : mixedOrder the results by the selected field(s)
@@ -3080,9 +3074,9 @@ prefixed with 'NOT'Adds a paren to the current query for query grouping, @@ -3115,9 +3109,9 @@ prefixed with 'OR'
Generates a 'Having' clause prefixed with 'OR'
@@ -3134,14 +3128,16 @@ prefixed with 'OR' : mixedGenerates an OR Like clause
@@ -3193,7 +3189,8 @@ prefixed with 'OR' : mixedAdds a paren to the current query for query grouping, @@ -3261,9 +3258,9 @@ prefixed with 'OR NOT'
Generates a OR NOT LIKE clause
@@ -3288,7 +3285,8 @@ prefixed with 'OR NOT' : mixedWhere clause prefixed with "OR"
@@ -3347,7 +3345,8 @@ prefixed with 'OR NOT' : mixed = []Where in statement prefixed with "or"
@@ -3391,7 +3390,8 @@ prefixed with 'OR NOT' : stringOR WHERE NOT IN (FOO) clause
@@ -3443,7 +3443,8 @@ prefixed with 'OR NOT' : stringClear out the class variables, so the next query can be run
@@ -3772,9 +3773,9 @@ prefixed with 'OR NOT'Add a 'returning' clause to an insert,update, or delete query
@@ -3852,9 +3853,9 @@ prefixed with 'OR NOT'Specifies rows to select in a query
@@ -3897,16 +3898,16 @@ prefixed with 'OR NOT'Selects the average value of a field from a query
public
- selectAvg(string $field[, string|bool $as = FALSE ]) : self
+ selectAvg(string $field[, bool|string $as = FALSE ]) : self
public
- selectMax(string $field[, string|bool $as = FALSE ]) : self
+ selectMax(string $field[, bool|string $as = FALSE ]) : self
Selects the minimum value of a field from a query
public
- selectMin(string $field[, string|bool $as = FALSE ]) : self
+ selectMin(string $field[, bool|string $as = FALSE ]) : self
Selects the sum of a field from a query
public
- selectSum(string $field[, string|bool $as = FALSE ]) : self
+ selectSum(string $field[, bool|string $as = FALSE ]) : self
Sets values for inserts / updates / deletes
@@ -4124,7 +4129,8 @@ prefixed with 'OR NOT' : mixedSpecify the database table to select from
@@ -4278,7 +4284,8 @@ prefixed with 'OR NOT' : stringCreates an update clause, and executes it
@@ -4376,7 +4383,8 @@ prefixed with 'OR NOT' : mixed = []Creates a batch update, and executes it.
@@ -4467,9 +4475,9 @@ prefixed with 'OR NOT'Specify condition(s) in the where clause of a query @@ -4488,14 +4496,16 @@ passed array with key / value pairs
: mixedWhere clause with 'IN' statement
@@ -4539,7 +4549,8 @@ passed array with key / value pairs : stringWHERE NOT IN (FOO) clause
@@ -4591,7 +4602,8 @@ passed array with key / value pairs : stringConvenience property for connection management
@@ -464,9 +464,9 @@List of queries executed
@@ -503,9 +503,9 @@Calls a function further down the inheritance chain.
@@ -577,13 +577,13 @@ -Constructor
- +
public
__construct(DriverInterface|null $driver, QueryParser $parser) : mixed
-
+
+
Destructor
- +
public
__destruct() : mixed
+
+
-
- Clear out the class variables, so the next query can be run
diff --git a/apiDocumentation/classes/Query-QueryBuilderInterface.html b/apiDocumentation/classes/Query-QueryBuilderInterface.html index 2d1e981..0cd11f0 100644 --- a/apiDocumentation/classes/Query-QueryBuilderInterface.html +++ b/apiDocumentation/classes/Query-QueryBuilderInterface.html @@ -111,9 +111,9 @@Interface defining the Query Builder class
@@ -478,9 +478,9 @@ passed array with key / value pairsRetrieve the number of rows in the selected table
@@ -523,9 +523,9 @@ passed array with key / value pairsRetrieve the number of results for the generated query - used @@ -580,9 +580,9 @@ in place of the get() method
Deletes data from a table
@@ -607,7 +607,8 @@ in place of the get() method : mixed = ''Adds the 'distinct' keyword to a query
@@ -666,9 +667,9 @@ in place of the get() methodShows the query plan for the query
@@ -700,9 +701,9 @@ in place of the get() methodSpecify the database table to select from
@@ -745,9 +746,9 @@ in place of the get() methodSelect and retrieve all records from the current table, and/or @@ -807,9 +808,9 @@ execute current compiled query
Returns the generated 'delete' sql query
@@ -860,9 +861,9 @@ execute current compiled queryReturns the generated 'insert' sql query
@@ -913,9 +914,9 @@ execute current compiled queryReturns the generated 'select' sql query
@@ -966,9 +967,9 @@ execute current compiled queryReturns the generated 'update' sql query
@@ -1019,9 +1020,9 @@ execute current compiled queryConvenience method for get() with a where clause
@@ -1046,7 +1047,8 @@ execute current compiled query : array<string|int, mixed> = []Group the results by the selected field(s)
@@ -1106,7 +1108,8 @@ execute current compiled query : mixedEnds a query group
@@ -1165,9 +1168,9 @@ execute current compiled queryAdds a paren to the current query for query grouping
@@ -1199,9 +1202,9 @@ execute current compiled queryGenerates a 'Having' clause
@@ -1218,14 +1221,16 @@ execute current compiled query : mixedCreates an insert clause, and executes it
@@ -1277,7 +1282,8 @@ execute current compiled query : mixed = []Creates and executes a batch insertion query
@@ -1354,9 +1360,9 @@ execute current compiled queryCreates a join phrase in a compiled query
@@ -1415,9 +1421,9 @@ execute current compiled queryCreates a Like clause in the sql statement
@@ -1442,7 +1448,8 @@ execute current compiled query : mixedSet a limit on the current sql statement
@@ -1528,9 +1535,9 @@ execute current compiled queryAdds a paren to the current query for query grouping, @@ -1563,9 +1570,9 @@ prefixed with 'NOT'
Generates a NOT LIKE clause
@@ -1590,7 +1597,8 @@ prefixed with 'NOT' : mixedOrder the results by the selected field(s)
@@ -1676,9 +1684,9 @@ prefixed with 'NOT'Adds a paren to the current query for query grouping, @@ -1711,9 +1719,9 @@ prefixed with 'OR'
Generates a 'Having' clause prefixed with 'OR'
@@ -1730,14 +1738,16 @@ prefixed with 'OR' : mixedGenerates an OR Like clause
@@ -1789,7 +1799,8 @@ prefixed with 'OR' : mixedAdds a paren to the current query for query grouping, @@ -1857,9 +1868,9 @@ prefixed with 'OR NOT'
Generates a OR NOT LIKE clause
@@ -1884,7 +1895,8 @@ prefixed with 'OR NOT' : mixedWhere clause prefixed with "OR"
@@ -1943,7 +1955,8 @@ prefixed with 'OR NOT' : mixed = []Where in statement prefixed with "or"
@@ -1987,14 +2000,16 @@ prefixed with 'OR NOT' : stringOR WHERE NOT IN (FOO) clause
@@ -2038,14 +2053,16 @@ prefixed with 'OR NOT' : stringClear out the class variables, so the next query can be run
@@ -2104,9 +2121,9 @@ prefixed with 'OR NOT'Specifies rows to select in a query
@@ -2149,16 +2166,16 @@ prefixed with 'OR NOT'Selects the average value of a field from a query
public
- selectAvg(string $field[, string|bool $as = FALSE ]) : self
+ selectAvg(string $field[, bool|string $as = FALSE ]) : self
Selects the maximum value of a field from a query
public
- selectMax(string $field[, string|bool $as = FALSE ]) : self
+ selectMax(string $field[, bool|string $as = FALSE ]) : self
Selects the minimum value of a field from a query
public
- selectMin(string $field[, string|bool $as = FALSE ]) : self
+ selectMin(string $field[, bool|string $as = FALSE ]) : self
Selects the sum of a field from a query
public
- selectSum(string $field[, string|bool $as = FALSE ]) : self
+ selectSum(string $field[, bool|string $as = FALSE ]) : self
Sets values for inserts / updates / deletes
@@ -2376,14 +2397,16 @@ prefixed with 'OR NOT' : mixedSpecify the database table to select from
@@ -2429,7 +2452,8 @@ prefixed with 'OR NOT' : stringCreates an update clause, and executes it
@@ -2481,7 +2505,8 @@ prefixed with 'OR NOT' : mixed = []Creates a batch update, and executes it.
@@ -2572,9 +2597,9 @@ prefixed with 'OR NOT'Specify condition(s) in the where clause of a query @@ -2593,14 +2618,16 @@ passed array with key / value pairs
: mixedWhere clause with 'IN' statement
@@ -2644,14 +2671,16 @@ passed array with key / value pairs : stringWHERE NOT IN (FOO) clause
@@ -2695,14 +2724,16 @@ passed array with key / value pairs : stringUtility Class to parse sql clauses for properly escaping identifiers
@@ -192,9 +192,9 @@Regex matches
@@ -231,9 +231,9 @@Constructor/entry point into parser
@@ -276,9 +276,9 @@Compiles a join condition after parsing
@@ -321,9 +321,9 @@Parser method for setting the parse string
diff --git a/apiDocumentation/classes/Query-QueryType.html b/apiDocumentation/classes/Query-QueryType.html index 6cf7bd9..c61a9a2 100644 --- a/apiDocumentation/classes/Query-QueryType.html +++ b/apiDocumentation/classes/Query-QueryType.html @@ -117,9 +117,9 @@Enum of query types
@@ -153,56 +153,6 @@Query builder state
@@ -386,9 +386,9 @@Add an additional set of mapping pairs to a internal map
@@ -590,9 +590,9 @@Multibyte-safe trim function
@@ -261,9 +261,9 @@ passedFilter out db rows into one array
@@ -309,9 +309,9 @@ passedZip a set of arrays together on common keys
@@ -352,9 +352,9 @@ array.Determine whether a value in the passed array matches the pattern @@ -401,9 +401,9 @@ passed
Connection function
diff --git a/apiDocumentation/files/src/ConnectionManager.php.txt b/apiDocumentation/files/src/ConnectionManager.php.txt index 6b6ffac..f538d5d 100644 --- a/apiDocumentation/files/src/ConnectionManager.php.txt +++ b/apiDocumentation/files/src/ConnectionManager.php.txt @@ -13,17 +13,20 @@ * @link https://git.timshomepage.net/aviat/Query * @version 4.0.0 */ + namespace Query; use DomainException; +use PHPUnit\Framework\Attributes\CodeCoverageIgnore; +use Query\Exception\{BadDBDriverException, NonExistentConnectionException}; use stdClass; /** * Connection manager class to manage connections for the * Query method */ -final class ConnectionManager { - +final class ConnectionManager +{ /** * Map of named database connections */ @@ -36,8 +39,8 @@ final class ConnectionManager { /** * Private constructor to prevent multiple instances - * @codeCoverageIgnore */ + #[CodeCoverageIgnore] private function __construct() { } @@ -91,7 +94,6 @@ final class ConnectionManager { /** * Returns the connection specified by the name given * - * @param string $name * @throws Exception\NonExistentConnectionException */ public function getConnection(string $name = ''): QueryBuilderInterface @@ -108,20 +110,17 @@ final class ConnectionManager { } // You should actually connect before trying to get a connection... - throw new Exception\NonExistentConnectionException('The specified connection does not exist'); + throw new NonExistentConnectionException('The specified connection does not exist'); } /** * Parse the passed parameters and return a connection - * - * @param array|object $params - * @return QueryBuilderInterface */ public function connect(array|object $params): QueryBuilderInterface { [$dsn, $dbType, $params, $options] = $this->parseParams($params); - $dbType = ucfirst($dbType); + $dbType = ucfirst((string) $dbType); $driver = "\\Query\\Drivers\\{$dbType}\\Driver"; // Create the database connection @@ -138,7 +137,6 @@ final class ConnectionManager { // Create Query Builder object $conn = new QueryBuilder($db, new QueryParser($db)); - // Save it for later if (isset($params->alias)) { @@ -155,21 +153,19 @@ final class ConnectionManager { /** * Parses params into a dsn and option array * - * @param array|object $rawParams * @throws Exception\BadDBDriverException - * @return array */ public function parseParams(array|object $rawParams): array { $params = (object) $rawParams; - $params->type = strtolower($params->type); + $params->type = strtolower((string) $params->type); $dbType = ($params->type === 'postgresql') ? 'pgsql' : $params->type; $dbType = ucfirst($dbType); // Make sure the class exists if ( ! class_exists("\\Query\\Drivers\\{$dbType}\\Driver")) { - throw new Exception\BadDBDriverException('Database driver does not exist, or is not supported'); + throw new BadDBDriverException('Database driver does not exist, or is not supported'); } // Set additional PDO options @@ -183,15 +179,13 @@ final class ConnectionManager { // Create the dsn for the database to connect to $dsn = strtolower($dbType) === 'sqlite' ? $params->file : $this->createDsn($dbType, $params); - return [$dsn, $dbType, $params, $options]; } /** * Create the dsn from the db type and params - * - * @codeCoverageIgnore */ + #[CodeCoverageIgnore] private function createDsn(string $dbType, stdClass $params): string { $pairs = []; @@ -209,12 +203,12 @@ final class ConnectionManager { 'prefix' => 'prefix', 'options' => 'options', 'database' => 'database', - 'alias' => 'alias' + 'alias' => 'alias', ]; - foreach($params as $key => $val) + foreach ($params as $key => $val) { - if (( ! array_key_exists($key, $skip)) && ! empty($val)) + if (( ! array_key_exists($key, $skip)) && ! empty($val)) { $pairs[] = implode('=', [$key, $val]); } @@ -222,4 +216,4 @@ final class ConnectionManager { return strtolower($dbType) . ':' . implode(';', $pairs); } -} \ No newline at end of file +} diff --git a/apiDocumentation/files/src/Drivers/AbstractDriver.php.txt b/apiDocumentation/files/src/Drivers/AbstractDriver.php.txt index e4274ef..e1e5986 100644 --- a/apiDocumentation/files/src/Drivers/AbstractDriver.php.txt +++ b/apiDocumentation/files/src/Drivers/AbstractDriver.php.txt @@ -13,11 +13,13 @@ * @link https://git.timshomepage.net/aviat/Query * @version 4.0.0 */ + namespace Query\Drivers; use InvalidArgumentException; use PDO; use PDOStatement; +use PHPUnit\Framework\Attributes\CodeCoverageIgnore; use function call_user_func_array; use function dbFilter; @@ -29,10 +31,8 @@ use function is_string; * * Extends PDO to simplify cross-database issues */ -abstract class AbstractDriver - extends PDO - implements DriverInterface { - +abstract class AbstractDriver extends PDO implements DriverInterface +{ /** * Reference to the last executed query */ @@ -76,7 +76,7 @@ abstract class AbstractDriver /** * PDO constructor wrapper */ - public function __construct(string $dsn, string $username=NULL, string $password=NULL, array $driverOptions=[]) + public function __construct(string $dsn, ?string $username=NULL, ?string $password=NULL, array $driverOptions=[]) { // Set PDO to display errors as exceptions, and apply driver options $driverOptions[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION; @@ -85,14 +85,33 @@ abstract class AbstractDriver $this->_loadSubClasses(); } + /** + * Allow invoke to work on table object + * + * @return mixed + */ + #[CodeCoverageIgnore] + public function __call(string $name, array $args = []) + { + if ( + isset($this->$name) + && is_object($this->$name) + && method_exists($this->$name, '__invoke') + ) { + return call_user_func_array([$this->$name, '__invoke'], $args); + } + + return NULL; + } + /** * Loads the subclasses for the driver */ protected function _loadSubClasses(): void { // Load the sql and util class for the driver - $thisClass = $this::class; - $nsArray = explode("\\", $thisClass); + $thisClass = static::class; + $nsArray = explode('\\', $thisClass); array_pop($nsArray); $driver = array_pop($nsArray); $sqlClass = __NAMESPACE__ . "\\{$driver}\\SQL"; @@ -102,26 +121,6 @@ abstract class AbstractDriver $this->util = new $utilClass($this); } - /** - * Allow invoke to work on table object - * - * @codeCoverageIgnore - * @return mixed - */ - public function __call(string $name, array $args = []) - { - if ( - isset($this->$name) - && is_object($this->$name) - && method_exists($this->$name, '__invoke') - ) - { - return call_user_func_array([$this->$name, '__invoke'], $args); - } - - return NULL; - } - // -------------------------------------------------------------------------- // ! Accessors / Mutators // -------------------------------------------------------------------------- @@ -177,11 +176,11 @@ abstract class AbstractDriver $this->statement = $this->prepare($sql); // Bind the parameters - foreach($data as $k => $value) + foreach ($data as $k => $value) { // Parameters are 1-based, the data is 0-based // So, if the key is numeric, add 1 - if(is_numeric($k)) + if (is_numeric($k)) { $k++; } @@ -258,7 +257,7 @@ abstract class AbstractDriver { if (is_array($identifier)) { - return array_map([$this, __METHOD__], $identifier); + return array_map(__METHOD__, $identifier); } // Make all the string-handling methods happy @@ -268,7 +267,7 @@ abstract class AbstractDriver if (str_contains($identifier, ',')) { $parts = array_map('mb_trim', explode(',', $identifier)); - $parts = array_map([$this, __METHOD__], $parts); + $parts = array_map(__METHOD__, $parts); $identifier = implode(',', $parts); } @@ -277,12 +276,13 @@ abstract class AbstractDriver $hiers = array_map('mb_trim', $hiers); // Re-compile the string - $raw = implode('.', array_map([$this, '_quote'], $hiers)); + $raw = implode('.', array_map($this->_quote(...), $hiers)); // Fix functions $funcs = []; preg_match_all("#{$this->escapeCharOpen}([a-zA-Z0-9_]+(\((.*?)\))){$this->escapeCharClose}#iu", $raw, $funcs, PREG_SET_ORDER); - foreach($funcs as $f) + + foreach ($funcs as $f) { // Unquote the function // Quote the inside identifiers @@ -308,6 +308,7 @@ abstract class AbstractDriver { $tables = $this->driverQuery('tableList'); natsort($tables); + return $tables; } @@ -326,6 +327,7 @@ abstract class AbstractDriver { $views = $this->driverQuery('viewList'); sort($views); + return $views; } @@ -456,6 +458,7 @@ abstract class AbstractDriver if (preg_match($regex, $this->lastQuery, $output) > 0) { $stmt = $this->query("SELECT COUNT(*) FROM {$output[1]}"); + return (int) $stmt->fetchColumn(); } @@ -472,7 +475,8 @@ abstract class AbstractDriver // Values for insertion $vals = []; - foreach($data as $group) + + foreach ($data as $group) { $vals = [...$vals, ...array_values($group)]; } @@ -533,6 +537,7 @@ abstract class AbstractDriver $line = $this->quoteIdent($field) . " = CASE\n"; $cases = []; + foreach ($data as $case) { if (array_key_exists($field, $case)) @@ -553,6 +558,7 @@ abstract class AbstractDriver $sql .= implode(",\n", $fieldLines) . "\n"; $whereValues = array_column($data, $where); + foreach ($whereValues as $value) { $insertData[] = $value; @@ -579,6 +585,7 @@ abstract class AbstractDriver $sql .= $this->quoteTable($table); $this->statement = $this->query($sql); + return $this->statement; } @@ -592,9 +599,6 @@ abstract class AbstractDriver /** * Helper method for quote_ident - * - * @param mixed $str - * @return mixed */ public function _quote(mixed $str): mixed { @@ -608,7 +612,6 @@ abstract class AbstractDriver ) ? "{$this->escapeCharOpen}{$str}{$this->escapeCharClose}" : $str; - } /** diff --git a/apiDocumentation/files/src/Drivers/AbstractSQL.php.txt b/apiDocumentation/files/src/Drivers/AbstractSQL.php.txt index 3dcfd89..aeefa8d 100644 --- a/apiDocumentation/files/src/Drivers/AbstractSQL.php.txt +++ b/apiDocumentation/files/src/Drivers/AbstractSQL.php.txt @@ -13,13 +13,14 @@ * @link https://git.timshomepage.net/aviat/Query * @version 4.0.0 */ + namespace Query\Drivers; /** * Parent for database-specific syntax subclasses */ -abstract class AbstractSQL implements SQLInterface { - +abstract class AbstractSQL implements SQLInterface +{ /** * Limit clause */ diff --git a/apiDocumentation/files/src/Drivers/AbstractUtil.php.txt b/apiDocumentation/files/src/Drivers/AbstractUtil.php.txt index b3bc5ea..fc5034b 100644 --- a/apiDocumentation/files/src/Drivers/AbstractUtil.php.txt +++ b/apiDocumentation/files/src/Drivers/AbstractUtil.php.txt @@ -13,13 +13,16 @@ * @link https://git.timshomepage.net/aviat/Query * @version 4.0.0 */ + namespace Query\Drivers; +use function arrayZipper; + /** * Abstract class defining database / table creation methods */ -abstract class AbstractUtil { - +abstract class AbstractUtil +{ /** * Save a reference to the connection object for later use */ @@ -48,14 +51,15 @@ abstract class AbstractUtil { // 'constraint' => ..., // 'index' => ..., // ] - $columnArray = \arrayZipper([ + $columnArray = arrayZipper([ 'type' => $fields, - 'constraint' => $constraints + 'constraint' => $constraints, ]); // Join column definitions together $columns = []; - foreach($columnArray as $n => $props) + + foreach ($columnArray as $n => $props) { $str = $this->getDriver()->quoteIdent($n); $str .= isset($props['type']) ? " {$props['type']}" : ''; @@ -65,7 +69,7 @@ abstract class AbstractUtil { } // Generate the sql for the creation of the table - $sql = 'CREATE TABLE'.$existsStr.$this->getDriver()->quoteTable($name).' ('; + $sql = 'CREATE TABLE' . $existsStr . $this->getDriver()->quoteTable($name) . ' ('; $sql .= implode(', ', $columns); $sql .= ')'; @@ -77,7 +81,7 @@ abstract class AbstractUtil { */ public function deleteTable(string $name): string { - return 'DROP TABLE IF EXISTS '.$this->getDriver()->quoteTable($name); + return 'DROP TABLE IF EXISTS ' . $this->getDriver()->quoteTable($name); } // -------------------------------------------------------------------------- @@ -85,16 +89,11 @@ abstract class AbstractUtil { // -------------------------------------------------------------------------- /** * Return an SQL file with the database table structure - * - * @abstract */ abstract public function backupStructure(): string; /** * Return an SQL file with the database data as insert statements - * - * @abstract */ abstract public function backupData(): string; - -} \ No newline at end of file +} diff --git a/apiDocumentation/files/src/Drivers/DriverInterface.php.txt b/apiDocumentation/files/src/Drivers/DriverInterface.php.txt index d3073fd..baaa142 100644 --- a/apiDocumentation/files/src/Drivers/DriverInterface.php.txt +++ b/apiDocumentation/files/src/Drivers/DriverInterface.php.txt @@ -13,9 +13,9 @@ * @link https://git.timshomepage.net/aviat/Query * @version 4.0.0 */ + namespace Query\Drivers; -use InvalidArgumentException; use PDO; use PDOStatement; @@ -36,12 +36,12 @@ use PDOStatement; * @method rollback(): bool * @method setAttribute(int $attribute, $value): bool */ -interface DriverInterface /* extends the interface of PDO */ { - +interface DriverInterface // extends the interface of PDO +{ /** * Constructor/Connection method */ - public function __construct(string $dsn, string $username=NULL, string $password=NULL, array $driverOptions = []); + public function __construct(string $dsn, ?string $username=NULL, ?string $password=NULL, array $driverOptions = []); /** * Simplifies prepared statements for database queries diff --git a/apiDocumentation/files/src/Drivers/Mysql/Driver.php.txt b/apiDocumentation/files/src/Drivers/Mysql/Driver.php.txt index c03fc32..f4e6936 100644 --- a/apiDocumentation/files/src/Drivers/Mysql/Driver.php.txt +++ b/apiDocumentation/files/src/Drivers/Mysql/Driver.php.txt @@ -13,17 +13,19 @@ * @link https://git.timshomepage.net/aviat/Query * @version 4.0.0 */ + namespace Query\Drivers\Mysql; use PDO; +use PHPUnit\Framework\Attributes\CodeCoverageIgnore; use Query\Drivers\AbstractDriver; use function defined; /** * MySQL specific class */ -class Driver extends AbstractDriver { - +class Driver extends AbstractDriver +{ /** * Set the backtick as the MySQL escape character */ @@ -36,10 +38,9 @@ class Driver extends AbstractDriver { /** * Connect to MySQL Database - * - * @codeCoverageIgnore */ - public function __construct(string $dsn, string $username=NULL, string $password=NULL, array $options=[]) + #[CodeCoverageIgnore] + public function __construct(string $dsn, ?string $username=NULL, ?string $password=NULL, array $options=[]) { // Set the charset to UTF-8 if (defined('\\PDO::MYSQL_ATTR_INIT_COMMAND')) @@ -51,7 +52,7 @@ class Driver extends AbstractDriver { if ( ! str_contains($dsn, 'mysql')) { - $dsn = 'mysql:'.$dsn; + $dsn = 'mysql:' . $dsn; } parent::__construct($dsn, $username, $password, $options); @@ -67,7 +68,7 @@ class Driver extends AbstractDriver { if ( stripos($query, 'insert') !== FALSE && version_compare($this->getVersion(), '10.5.0', '>=') - ){ + ) { return parent::returning($query, $select); } @@ -75,11 +76,11 @@ class Driver extends AbstractDriver { if ( stripos($query, 'delete') !== FALSE && version_compare($this->getVersion(), '10.0.5', '>=') - ){ + ) { return parent::returning($query, $select); } // Just return the same SQL if the returning clause is not supported return $query; } -} \ No newline at end of file +} diff --git a/apiDocumentation/files/src/Drivers/Mysql/SQL.php.txt b/apiDocumentation/files/src/Drivers/Mysql/SQL.php.txt index e0e8a59..e4da5fb 100644 --- a/apiDocumentation/files/src/Drivers/Mysql/SQL.php.txt +++ b/apiDocumentation/files/src/Drivers/Mysql/SQL.php.txt @@ -13,15 +13,17 @@ * @link https://git.timshomepage.net/aviat/Query * @version 4.0.0 */ + namespace Query\Drivers\Mysql; +use PHPUnit\Framework\Attributes\CodeCoverageIgnore; use Query\Drivers\AbstractSQL; /** * MySQL specific SQL */ -class SQL extends AbstractSQL { - +class SQL extends AbstractSQL +{ /** * Limit clause */ @@ -29,10 +31,10 @@ class SQL extends AbstractSQL { { if ( ! is_numeric($offset)) { - return $sql." LIMIT {$limit}"; + return $sql . " LIMIT {$limit}"; } - return $sql." LIMIT {$offset}, {$limit}"; + return $sql . " LIMIT {$offset}, {$limit}"; } /** @@ -56,10 +58,9 @@ class SQL extends AbstractSQL { */ public function dbList(): string { - return <<