From: Kevin Day Date: Tue, 12 Feb 2019 02:02:58 +0000 (-0600) Subject: Progress: continue development on database abstraction X-Git-Url: https://git.kevux.org/?a=commitdiff_plain;h=refs%2Fheads%2Fdevelopment;p=koopa Progress: continue development on database abstraction --- diff --git a/common/database/classes/database_alter_aggregate.php b/common/database/classes/database_alter_aggregate.php index e86ec95..9b38eff 100644 --- a/common/database/classes/database_alter_aggregate.php +++ b/common/database/classes/database_alter_aggregate.php @@ -36,7 +36,6 @@ class c_database_alter_aggregate extends c_database_query { protected $aggregate_signatures; protected $order_by_signatures; - /** * Class constructor. */ @@ -89,7 +88,7 @@ class c_database_alter_aggregate extends c_database_query { } /** - * Set the aggregate signatures. + * Assign the settings. * * @param c_database_argument_aggregate_signature|null $aggregate_signature * The aggregate signatures to use. @@ -120,7 +119,7 @@ class c_database_alter_aggregate extends c_database_query { } /** - * Set the order by aggregate signatures. + * Assign the settings. * * @param c_database_argument_aggregate_signature_base|null $order_by_signature * The order by aggregate signature to use. @@ -277,7 +276,7 @@ class c_database_alter_aggregate extends c_database_query { if (isset($aggregate_signatures)) { $aggregate_signatures = ' (' . $aggregate_signatures; if (isset($order_by_signatures)) { - $aggregate_signatures = ' ' . c_database_string::ORDER_BY . ' ' . $order_by_signatures . ''; + $aggregate_signatures = ' ' . c_database_string::ORDER . ' ' . c_database_string::BY . ' ' . $order_by_signatures . ''; } $aggregate_signatures .= ')'; } diff --git a/common/database/classes/database_alter_coalation.php b/common/database/classes/database_alter_coalation.php index b47acea..1f78114 100644 --- a/common/database/classes/database_alter_coalation.php +++ b/common/database/classes/database_alter_coalation.php @@ -79,7 +79,7 @@ class c_database_alter_coalation extends c_database_query { } /** - * Set the refresh version. + * Assign the settings. * * @param bool|null $refresh_version * Whether or not to use REFRESH VERSION in the query. @@ -135,7 +135,7 @@ class c_database_alter_coalation extends c_database_query { $value = $this->p_do_build_name(); if (is_bool($this->refresh_version)) { if ($this->refresh_version) { - $value .= c_database_string::REFRESH_VERSION; + $value .= c_database_string::REFRESH . ' ' . c_database_string::VERSION; } } else if (isset($this->rename_to)) { diff --git a/common/database/classes/database_alter_conversion.php b/common/database/classes/database_alter_conversion.php index f4616d4..c1cd7c2 100644 --- a/common/database/classes/database_alter_conversion.php +++ b/common/database/classes/database_alter_conversion.php @@ -28,7 +28,6 @@ class c_database_alter_conversion extends c_database_query { protected const p_QUERY_COMMAND = 'alter conversion'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_database.php b/common/database/classes/database_alter_database.php index 8d0520b..cf4da6b 100644 --- a/common/database/classes/database_alter_database.php +++ b/common/database/classes/database_alter_database.php @@ -93,7 +93,7 @@ class c_database_alter_database extends c_database_query { } /** - * Set the option. + * Assign the settings. * * @param c_database_argument_database_option|null $option * The database options to use. diff --git a/common/database/classes/database_alter_domain.php b/common/database/classes/database_alter_domain.php index 28e8f64..f86a96a 100644 --- a/common/database/classes/database_alter_domain.php +++ b/common/database/classes/database_alter_domain.php @@ -41,7 +41,7 @@ class c_database_alter_domain extends c_database_query { */ public function __construct() { parent::__construct(); -; + $this->action = NULL; $this->name = NULL; $this->owner_to = NULL; @@ -249,14 +249,14 @@ class c_database_alter_domain extends c_database_query { $value .= ' ' . $this->constraint['name']; if ($this->property === e_database_property::NOT_VALID) { - $value .= ' ' . c_database_string::NOT_VALID; + $value .= ' ' . c_database_string::NOT . ' ' . c_database_string::VALID; } break; case e_database_action_deprecated::DROP: $value .= c_database_string::DROP; if ($this->property === e_database_property::NOT_NULL) { - $value .= ' ' . c_database_string::NOT_NULL; + $value .= ' ' . c_database_string::NOT . ' ' . c_database_string::NULL; } break; @@ -266,9 +266,9 @@ class c_database_alter_domain extends c_database_query { return new c_base_return_false(); } - $value .= c_database_string::DROP_CONSTRAINT; + $value .= c_database_string::DROP . ' ' . c_database_string::CONSTRAINT; if ($this->property === e_database_property::IF_EXISTS) { - $value .= ' ' . c_database_string::IF_EXISTS; + $value .= ' ' . c_database_string::IF . ' ' . c_database_string::EXISTS; } $value .= ' ' . $this->constraint['name']; @@ -282,7 +282,7 @@ class c_database_alter_domain extends c_database_query { break; case e_database_action_deprecated::DROP_DEFAULT: - $value .= c_database_string::DROP_DEFAULT; + $value .= c_database_string::DROP . ' ' . c_database_string::DEFAULT; break; case e_database_action_deprecated::OWNER_TO: @@ -300,7 +300,7 @@ class c_database_alter_domain extends c_database_query { return new c_base_return_false(); } - $value .= c_database_string::RENAME_CONSTRAINT . ' ' . $this->constraint['name'] . ' ' . c_database_string::TO . ' ' . $this->constraint['name_new']; + $value .= c_database_string::RENAME . ' ' . c_database_string::CONSTRAINT . ' ' . $this->constraint['name'] . ' ' . c_database_string::TO . ' ' . $this->constraint['name_new']; break; case e_database_action_deprecated::RENAME_TO: @@ -325,7 +325,7 @@ class c_database_alter_domain extends c_database_query { return new c_base_return_false(); } - $value .= c_database_string::SET_DEFAULT . ' ' . $this->expression; + $value .= c_database_string::SET . ' ' . c_database_string::DEFAULT . ' ' . $this->expression; break; case e_database_action_deprecated::SET_SCHEMA: @@ -343,7 +343,7 @@ class c_database_alter_domain extends c_database_query { return new c_base_return_false(); } - $value .= c_database_string::VALIDATE_CONSTRAINT . ' ' . $this->constraint['name']; + $value .= c_database_string::VALIDATE . ' ' . c_database_string::CONSTRAINT . ' ' . $this->constraint['name']; break; default: diff --git a/common/database/classes/database_alter_event_trigger.php b/common/database/classes/database_alter_event_trigger.php index 98f4f38..41d8c14 100644 --- a/common/database/classes/database_alter_event_trigger.php +++ b/common/database/classes/database_alter_event_trigger.php @@ -29,7 +29,6 @@ class c_database_alter_coalation extends c_database_query { protected const p_QUERY_COMMAND = 'alter event trigger'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_extension.php b/common/database/classes/database_alter_extension.php index 248c499..e9d19b3 100644 --- a/common/database/classes/database_alter_extension.php +++ b/common/database/classes/database_alter_extension.php @@ -29,7 +29,6 @@ class c_database_alter_extension extends c_database_query { protected $member_object; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_foreign_data_wrapper.php b/common/database/classes/database_alter_foreign_data_wrapper.php index b6cd718..de3fc4d 100644 --- a/common/database/classes/database_alter_foreign_data_wrapper.php +++ b/common/database/classes/database_alter_foreign_data_wrapper.php @@ -32,7 +32,6 @@ class c_database_alter_foreign_data_wrapper extends c_database_query { protected const p_QUERY_COMMAND = 'alter foreign data wrapper'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_foreign_table.php b/common/database/classes/database_alter_foreign_table.php index 8387576..662482f 100644 --- a/common/database/classes/database_alter_foreign_table.php +++ b/common/database/classes/database_alter_foreign_table.php @@ -60,7 +60,6 @@ class c_database_alter_foreign_table extends c_database_query { protected const p_QUERY_COMMAND = 'alter foreign table'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_group.php b/common/database/classes/database_alter_group.php index a3adb00..e09cb2e 100644 --- a/common/database/classes/database_alter_group.php +++ b/common/database/classes/database_alter_group.php @@ -28,7 +28,6 @@ class c_database_alter_group extends c_database_query { protected const p_QUERY_COMMAND = 'alter group'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_index.php b/common/database/classes/database_alter_index.php index a35930e..ff3a0be 100644 --- a/common/database/classes/database_alter_index.php +++ b/common/database/classes/database_alter_index.php @@ -39,7 +39,6 @@ class c_database_alter_index extends c_database_query { protected const p_QUERY_COMMAND = 'alter index'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_language.php b/common/database/classes/database_alter_language.php index addd716..983d63c 100644 --- a/common/database/classes/database_alter_language.php +++ b/common/database/classes/database_alter_language.php @@ -29,7 +29,6 @@ class c_database_alter_language extends c_database_query { protected const p_QUERY_COMMAND = 'alter language'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_large_object.php b/common/database/classes/database_alter_large_object.php index 65a8a28..d5e44d1 100644 --- a/common/database/classes/database_alter_large_object.php +++ b/common/database/classes/database_alter_large_object.php @@ -24,7 +24,6 @@ class c_database_alter_large_object extends c_database_query { protected const p_QUERY_COMMAND = 'alter large object'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_materialized_view.php b/common/database/classes/database_alter_materialized_view.php index 52b91f8..a65e12e 100644 --- a/common/database/classes/database_alter_materialized_view.php +++ b/common/database/classes/database_alter_materialized_view.php @@ -57,7 +57,6 @@ class c_database_alter_materialized_view extends c_database_query { protected const p_QUERY_COMMAND = 'alter materialized view'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_operator.php b/common/database/classes/database_alter_operator.php index 04245b0..56f722f 100644 --- a/common/database/classes/database_alter_operator.php +++ b/common/database/classes/database_alter_operator.php @@ -33,7 +33,6 @@ class c_database_alter_operator extends c_database_query { protected const p_QUERY_COMMAND = 'alter operator'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_operator_class.php b/common/database/classes/database_alter_operator_class.php index b94a2df..f219a5d 100644 --- a/common/database/classes/database_alter_operator_class.php +++ b/common/database/classes/database_alter_operator_class.php @@ -31,7 +31,6 @@ class c_database_alter_operator_class extends c_database_query { protected const p_QUERY_COMMAND = 'alter operator class'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_operator_family.php b/common/database/classes/database_alter_operator_family.php index 34e965c..6e8d54e 100644 --- a/common/database/classes/database_alter_operator_family.php +++ b/common/database/classes/database_alter_operator_family.php @@ -33,7 +33,6 @@ class c_database_alter_operator_family extends c_database_query { protected const p_QUERY_COMMAND = 'alter operator family'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_policy.php b/common/database/classes/database_alter_policy.php index 4977ed5..54ec8a8 100644 --- a/common/database/classes/database_alter_policy.php +++ b/common/database/classes/database_alter_policy.php @@ -33,7 +33,6 @@ class c_database_alter_policy extends c_database_query { protected const p_QUERY_COMMAND = 'alter policy'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_publication.php b/common/database/classes/database_alter_publication.php index 8ae5ba9..af44dd6 100644 --- a/common/database/classes/database_alter_publication.php +++ b/common/database/classes/database_alter_publication.php @@ -33,7 +33,6 @@ class c_database_alter_publication extends c_database_query { protected const p_QUERY_COMMAND = 'alter publication'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_role.php b/common/database/classes/database_alter_role.php index ab8430a..3a62f8c 100644 --- a/common/database/classes/database_alter_role.php +++ b/common/database/classes/database_alter_role.php @@ -35,7 +35,6 @@ class c_database_alter_role extends c_database_query { protected const p_QUERY_COMMAND = 'alter role'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_rule.php b/common/database/classes/database_alter_rule.php index be9d92b..cc6c4b8 100644 --- a/common/database/classes/database_alter_rule.php +++ b/common/database/classes/database_alter_rule.php @@ -27,7 +27,6 @@ class c_database_alter_rule extends c_database_query { protected const p_QUERY_COMMAND = 'alter rule'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_schema.php b/common/database/classes/database_alter_schema.php index 12cd8f4..23c2fb0 100644 --- a/common/database/classes/database_alter_schema.php +++ b/common/database/classes/database_alter_schema.php @@ -27,7 +27,6 @@ class c_database_alter_schema extends c_database_query { protected const p_QUERY_COMMAND = 'alter schema'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_sequence.php b/common/database/classes/database_alter_sequence.php index d521828..d9c25a0 100644 --- a/common/database/classes/database_alter_sequence.php +++ b/common/database/classes/database_alter_sequence.php @@ -49,7 +49,6 @@ class c_database_alter_sequence extends c_database_query { protected const p_QUERY_COMMAND = 'alter sequence'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_server.php b/common/database/classes/database_alter_server.php index 8a015cc..2bb304a 100644 --- a/common/database/classes/database_alter_server.php +++ b/common/database/classes/database_alter_server.php @@ -31,7 +31,6 @@ class c_database_alter_coalation extends c_database_query { protected const p_QUERY_COMMAND = 'alter server'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_statistics.php b/common/database/classes/database_alter_statistics.php index 66bf971..9e0d445 100644 --- a/common/database/classes/database_alter_statistics.php +++ b/common/database/classes/database_alter_statistics.php @@ -27,7 +27,6 @@ class c_database_alter_coalation extends c_database_query { protected const p_QUERY_COMMAND = 'alter statistics'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_subscription.php b/common/database/classes/database_alter_subscription.php index 37f9cef..06e56e9 100644 --- a/common/database/classes/database_alter_subscription.php +++ b/common/database/classes/database_alter_subscription.php @@ -45,7 +45,6 @@ class c_database_alter_subscription extends c_database_query { protected const p_QUERY_COMMAND = 'alter subsciption'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_system.php b/common/database/classes/database_alter_system.php index 7258d80..df10f44 100644 --- a/common/database/classes/database_alter_system.php +++ b/common/database/classes/database_alter_system.php @@ -25,7 +25,6 @@ class c_database_alter_system extends c_database_query { protected const p_QUERY_COMMAND = 'alter system'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_table.php b/common/database/classes/database_alter_table.php index 9161458..aae5c13 100644 --- a/common/database/classes/database_alter_table.php +++ b/common/database/classes/database_alter_table.php @@ -90,7 +90,6 @@ class c_database_alter_table extends c_database_query { protected const p_QUERY_COMMAND = 'alter table'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_tablespace.php b/common/database/classes/database_alter_tablespace.php index 240bf35..32a65bd 100644 --- a/common/database/classes/database_alter_tablespace.php +++ b/common/database/classes/database_alter_tablespace.php @@ -31,7 +31,6 @@ class c_database_alter_coalation extends c_database_query { protected const p_QUERY_COMMAND = 'alter tablespace'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_text_search_configuration.php b/common/database/classes/database_alter_text_search_configuration.php index d08a896..1effb8a 100644 --- a/common/database/classes/database_alter_text_search_configuration.php +++ b/common/database/classes/database_alter_text_search_configuration.php @@ -35,7 +35,6 @@ class c_database_alter_text_search_configuration extends c_database_query { protected const p_QUERY_COMMAND = 'alter text search configuration'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_text_search_dictionary.php b/common/database/classes/database_alter_text_search_dictionary.php index cf37e69..94325cb 100644 --- a/common/database/classes/database_alter_text_search_dictionary.php +++ b/common/database/classes/database_alter_text_search_dictionary.php @@ -31,7 +31,6 @@ class c_database_alter_text_search_dictionary extends c_database_query { protected const p_QUERY_COMMAND = 'alter text search dictionary'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_text_search_parser.php b/common/database/classes/database_alter_text_search_parser.php index a639363..bee0143 100644 --- a/common/database/classes/database_alter_text_search_parser.php +++ b/common/database/classes/database_alter_text_search_parser.php @@ -26,7 +26,6 @@ class c_database_alter_text_search_parser extends c_database_query { protected const p_QUERY_COMMAND = 'alter text search parser'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_text_search_template.php b/common/database/classes/database_alter_text_search_template.php index 91fc618..7f97010 100644 --- a/common/database/classes/database_alter_text_search_template.php +++ b/common/database/classes/database_alter_text_search_template.php @@ -27,7 +27,6 @@ class c_database_alter_text_search_template extends c_database_query { protected const p_QUERY_COMMAND = 'alter text search template'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_trigger.php b/common/database/classes/database_alter_trigger.php index b087072..ae97fd9 100644 --- a/common/database/classes/database_alter_trigger.php +++ b/common/database/classes/database_alter_trigger.php @@ -27,7 +27,6 @@ class c_database_alter_trigger extends c_database_query { protected const p_QUERY_COMMAND = 'alter trigger'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_type.php b/common/database/classes/database_alter_type.php index 32fe198..cc2ad0b 100644 --- a/common/database/classes/database_alter_type.php +++ b/common/database/classes/database_alter_type.php @@ -36,7 +36,6 @@ class c_database_alter_type extends c_database_query { protected const p_QUERY_COMMAND = 'alter type'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_user.php b/common/database/classes/database_alter_user.php index 17359db..9b980e0 100644 --- a/common/database/classes/database_alter_user.php +++ b/common/database/classes/database_alter_user.php @@ -34,7 +34,6 @@ class c_database_alter_user extends c_database_query { protected const p_QUERY_COMMAND = 'alter user'; - /** * Class constructor. */ diff --git a/common/database/classes/database_alter_view.php b/common/database/classes/database_alter_view.php index bf3857e..e22992a 100644 --- a/common/database/classes/database_alter_view.php +++ b/common/database/classes/database_alter_view.php @@ -10,27 +10,61 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); +require_once('common/database/traits/database_alter_column.php'); +require_once('common/database/traits/database_if_exists.php'); +require_once('common/database/traits/database_name.php'); +require_once('common/database/traits/database_owner_to.php'); +require_once('common/database/traits/database_rename_to.php'); +require_once('common/database/traits/database_reset_view_option.php'); +require_once('common/database/traits/database_set_schema.php'); +require_once('common/database/traits/database_set_view_option.php'); /** - * The class for building and returning a Postgresql ALTER COALATION query string. + * The class for building and returning a Postgresql ALTER VIEW query string. * - * @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html + * @see: https://www.postgresql.org/docs/current/static/sql-alterview.html */ -class c_database_alter_coalation extends c_database_query { - protected const p_QUERY_COMMAND = 'alter coalation'; +class c_database_alter_view extends c_database_query { + use t_database_alter_column; + use t_database_if_exists; + use t_database_name; + use t_database_owner_to; + use t_database_rename_to; + use t_database_reset_view_option; + use t_database_set_schema; + use t_database_set_view_option; + protected const p_QUERY_COMMAND = 'alter view'; /** * Class constructor. */ public function __construct() { parent::__construct(); + + $this->alter_column = NULL; + $this->if_exists = NULL; + $this->name = NULL; + $this->owner_to = NULL; + $this->rename_to = NULL; + $this->reset_view_option = NULL; + $this->set_schema = NULL; + $this->set_view_option = NULL; } /** * Class destructor. */ public function __destruct() { + unset($this->alter_column); + unset($this->if_exists); + unset($this->name); + unset($this->owner_to); + unset($this->rename_to); + unset($this->reset_view_option); + unset($this->set_schema); + unset($this->set_view_option); + parent::__destruct(); } @@ -65,6 +99,33 @@ class c_database_alter_coalation extends c_database_query { $value = $this->p_do_build_name(); + if (isset($this->if_exists)) { + $value = $this->p_do_build_if_exists() . ' ' . $value; + } + + if (isset($this->alter_column)) { + $value .= ' ' . $this->p_do_build_alter_column(); + } + else if (isset($this->owner_to)) { + $value .= ' ' . $this->p_do_build_owner_to(); + } + else if (isset($this->rename_to)) { + $value .= ' ' . $this->p_do_build_rename_to(); + } + else if (isset($this->set_schema)) { + $value .= ' ' . $this->p_do_build_set_schema(); + } + else if (isset($this->set_view_option)) { + $value .= ' ' . $this->p_do_build_set_view_option(); + } + else if (isset($this->reset_view_option)) { + $value .= ' ' . $this->p_do_build_reset_view_option(); + } + else { + unset($value); + return new c_base_return_false(); + } + $this->value = static::p_QUERY_COMMAND; $this->value .= ' ' . $value; unset($value); diff --git a/common/database/classes/database_analyze.php b/common/database/classes/database_analyze.php index bf3857e..30b9450 100644 --- a/common/database/classes/database_analyze.php +++ b/common/database/classes/database_analyze.php @@ -1,7 +1,7 @@ analyze_options); + unset($this->column_names); + unset($this->table_name); } /** * Class destructor. */ public function __destruct() { + $this->analyze_options = NULL; + $this->column_names = NULL; + $this->table_name = NULL; + parent::__destruct(); } @@ -59,11 +73,19 @@ class c_database_alter_coalation extends c_database_query { * Implements do_build(). */ public function do_build() { - if (is_null($this->name)) { + if (is_null($this->table_name)) { return new c_base_return_false(); } - $value = $this->p_do_build_name(); + $value = $this->p_do_build_table_name(); + + if (!is_null($this->analyze_options)) { + $value = '(' . $this->p_do_build_analyze_options() . ') ' . $value; + } + + if (!is_null($this->column_names)) { + $value .= ' (' . $this->p_do_build_column_names() . ')'; + } $this->value = static::p_QUERY_COMMAND; $this->value .= ' ' . $value; diff --git a/common/database/classes/database_begin.php b/common/database/classes/database_begin.php index bf3857e..f449b85 100644 --- a/common/database/classes/database_begin.php +++ b/common/database/classes/database_begin.php @@ -10,27 +10,37 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); +require_once('common/database/traits/database_transaction_action.php'); +require_once('common/database/traits/database_transaction_mode.php'); /** - * The class for building and returning a Postgresql ALTER COALATION query string. + * The class for building and returning a Postgresql BEGIN query string. * - * @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html + * @see: https://www.postgresql.org/docs/current/static/sql-begin.html */ -class c_database_alter_coalation extends c_database_query { - protected const p_QUERY_COMMAND = 'alter coalation'; +class c_database_begin extends c_database_query { + use t_database_transaction_action; + use t_database_transaction_mode; + protected const p_QUERY_COMMAND = 'begin'; /** * Class constructor. */ public function __construct() { parent::__construct(); + + $this->transaction_action = NULL; + $this->transaction_mode = NULL; } /** * Class destructor. */ public function __destruct() { + unset($this->transaction_action); + unset($this->transaction_mode); + parent::__destruct(); } @@ -59,11 +69,20 @@ class c_database_alter_coalation extends c_database_query { * Implements do_build(). */ public function do_build() { - if (is_null($this->name)) { - return new c_base_return_false(); + $value = NULL; + + if (isset($this->transaction_action)) { + $value = $this->p_do_build_transaction_action(); } - $value = $this->p_do_build_name(); + if (isset($this->transaction_mode)) { + if (is_null($value)) { + $value = $this->p_do_build_transaction_mode(); + } + else { + $value = ' ' . $this->p_do_build_transaction_mode(); + } + } $this->value = static::p_QUERY_COMMAND; $this->value .= ' ' . $value; diff --git a/common/database/classes/database_member_object.php b/common/database/classes/database_member_object.php index b045f8b..333d713 100644 --- a/common/database/classes/database_member_object.php +++ b/common/database/classes/database_member_object.php @@ -82,7 +82,7 @@ class c_database_member_object extends c_database_query { $value = NULL; switch($this->action) { case e_database_method_object::ACCESS_METHOD: - $value = c_database_string::ACCESS_METHOD . ' ' . $this->p_do_build_name(); + $value = c_database_string::ACCESS . ' ' . c_database_string::METHOD . ' ' . $this->p_do_build_name(); break; case e_database_method_object::AGGREGATE: $value = c_database_string::AGGREGATE . ' ' . $this->p_do_build_name(); @@ -116,13 +116,13 @@ class c_database_member_object extends c_database_query { $value = c_database_string::DOMAIN . ' ' . $this->p_do_build_name(); break; case e_database_method_object::EVENT_TRIGGER: - $value = c_database_string::EVENT_TRIGGER . ' ' . $this->p_do_build_name(); + $value = c_database_string::EVENT . ' ' . c_database_string::TRIGGER . ' ' . $this->p_do_build_name(); break; case e_database_method_object::FOREIGN_DATA_WRAPPER: - $value = c_database_string::FOREIGN_DATA_WRAPPER . ' ' . $this->p_do_build_name(); + $value = c_database_string::FOREIGN . ' ' . c_database_string::DATA . ' ' . c_database_string::WRAPPER . ' ' . $this->p_do_build_name(); break; case e_database_method_object::FOREIGN_TABLE: - $value = c_database_string::FOREIGN_TABLE . ' ' . $this->p_do_build_name(); + $value = c_database_string::FOREIGN . ' ' . c_database_string::TABLE . ' ' . $this->p_do_build_name(); break; case e_database_method_object::FUNCTION: $value = c_database_string::FUNCTION . ' ' . $this->p_do_build_name(); @@ -137,7 +137,7 @@ class c_database_member_object extends c_database_query { }*/ break; case e_database_method_object::MATERIALIZED_VIEW: - $value = c_database_string::MATERIALIZED_VIEW . ' ' . $this->p_do_build_name(); + $value = c_database_string::MATERIALIZED . ' ' . c_database_string::VIEW . ' ' . $this->p_do_build_name(); break; case e_database_method_object::OPERATOR: $value = c_database_string::OPERATOR . ' ' . $this->p_do_build_name(); @@ -150,7 +150,7 @@ class c_database_member_object extends c_database_query { } break; case e_database_method_object::OPERATOR_CLASS: - $value = c_database_string::OPERATOR_CLASS . ' ' . $this->p_do_build_name(); + $value = c_database_string::OPERATOR . ' ' . c_database_string::CLASS_ . ' ' . $this->p_do_build_name(); if (is_string($this->action_parameter)) { $value .= ' ' . c_database_string::USING . ' ' . $this->action_parameter; } @@ -160,7 +160,7 @@ class c_database_member_object extends c_database_query { } break; case e_database_method_object::OPERATOR_FAMILY: - $value = c_database_string::OPERATOR_FAMILY . ' ' . $this->p_do_build_name(); + $value = c_database_string::OPERATOR . ' ' . c_database_string::FAMILY . ' ' . $this->p_do_build_name(); if (is_string($this->action_parameter)) { $value .= ' ' . c_database_string::USING . ' ' . $this->action_parameter; } @@ -188,19 +188,19 @@ class c_database_member_object extends c_database_query { $value = c_database_string::TABLE . ' ' . $this->p_do_build_name(); break; case e_database_method_object::TEXT_SEARCH_CONFIGURATION: - $value = c_database_string::TEXT_SEARCH_CONFIGURATION . ' ' . $this->p_do_build_name(); + $value = c_database_string::TEXT . ' ' . c_database_string::SEARCH . ' ' . c_database_string::CONFIGURATION . ' ' . $this->p_do_build_name(); break; case e_database_method_object::TEXT_SEARCH_DICTIONARY: - $value = c_database_string::TEXT_SEARCH_DICTIONARY . ' ' . $this->p_do_build_name(); + $value = c_database_string::TEXT . ' ' . c_database_string::SEARCH . ' ' . c_database_string::DICTIONARY . ' ' . $this->p_do_build_name(); break; case e_database_method_object::TEXT_SEARCH_PARSER: - $value = c_database_string::TEXT_SEARCH_PARSER . ' ' . $this->p_do_build_name(); + $value = c_database_string::TEXT . ' ' . c_database_string::SEARCH . ' ' . c_database_string::PARSER . ' ' . $this->p_do_build_name(); break; case e_database_method_object::TEXT_SEARCH_TEMPLATE: - $value = c_database_string::TEXT_SEARCH_TEMPLATE . ' ' . $this->p_do_build_name(); + $value = c_database_string::TEXT . ' ' . c_database_string::SEARCH . ' ' . c_database_string::TEMPLATE . ' ' . $this->p_do_build_name(); break; case e_database_method_object::TRANSFORM_FOR: - $value = c_database_string::TRANSFORM_FOR . ' ' . $this->p_do_build_name(); + $value = c_database_string::TRANSFORM . ' ' . c_database_string::FOR . ' ' . $this->p_do_build_name(); if (is_string($this->action_parameter)) { $value .= ' ' . c_database_string::LANGUAGE . ' ' . $this->action_parameter; } diff --git a/common/database/classes/database_query.php b/common/database/classes/database_query.php index ddc7c96..32995d6 100644 --- a/common/database/classes/database_query.php +++ b/common/database/classes/database_query.php @@ -368,7 +368,7 @@ class c_database_argument_query extends c_base_return_string implements i_databa } /** - * Set the SQL query. + * Assign the settings. * * @param c_database_query|null $query * A fully configured query. @@ -500,7 +500,7 @@ class c_database_argument_expression extends c_base_return_string implements i_d } /** - * Set the SQL expression. + * Assign the settings. * * Expression are usually fields but also be other expressions. * Expressions may even be SQL queries. @@ -529,7 +529,7 @@ class c_database_argument_expression extends c_base_return_string implements i_d } /** - * Set the SQL expression alias. + * Assign the settings. * * @param string|null $alias * An optional alias to assign. @@ -671,7 +671,7 @@ class c_database_argument_expression_column extends c_database_argument_expressi } /** - * Set the SQL expression column. + * Assign the settings. * * @param string|null $column * Set to NULL to remove the assigned expression column. @@ -814,7 +814,7 @@ class c_database_argument_aggregate_signature_base extends c_base_return_string } /** - * Set the SQL argument mode. + * Assign the settings. * * @param int|null $argument_mode * The argument mode to assign. @@ -840,7 +840,7 @@ class c_database_argument_aggregate_signature_base extends c_base_return_string } /** - * Set the SQL argument name. + * Assign the settings. * * @param string|null $argument_name * The argument name to assign. @@ -866,7 +866,7 @@ class c_database_argument_aggregate_signature_base extends c_base_return_string } /** - * Set the SQL argument type. + * Assign the settings. * * @param string|null $argument_type * The argument type to assign. @@ -1040,7 +1040,7 @@ class c_database_argument_aggregate_signature extends c_database_argument_aggreg } /** - * Set the SQL argument all. + * Assign the settings. * * This represents whether or not a wildcard is used to represent all fields. * @@ -1186,7 +1186,7 @@ class c_database_argument_database_option extends c_base_return_string implement } /** - * Set the SQL argument allow connection. + * Assign the settings. * * @param bool|null $allow_connection * Set to TRUE to enable allow connection. @@ -1213,7 +1213,7 @@ class c_database_argument_database_option extends c_base_return_string implement } /** - * Set the SQL argument connection limit. + * Assign the settings. * * @param int|null $connection_limit * A connection limit integer. @@ -1240,7 +1240,7 @@ class c_database_argument_database_option extends c_base_return_string implement } /** - * Set the SQL argument is template. + * Assign the settings. * * @param bool|null $is_template * Set to TRUE to enable is template. @@ -1435,7 +1435,7 @@ class c_database_argument_role_name extends c_base_return_string implements i_da } /** - * Set the SQL argument mode. + * Assign the settings. * * @param int|null $argument_mode * The argument mode to assign. @@ -1461,7 +1461,7 @@ class c_database_argument_role_name extends c_base_return_string implements i_da } /** - * Set the SQL argument name. + * Assign the settings. * * @param string|null $argument_name * The argument name to assign. diff --git a/common/database/classes/database_string.php b/common/database/classes/database_string.php index 2cd652d..b56fb0a 100644 --- a/common/database/classes/database_string.php +++ b/common/database/classes/database_string.php @@ -11,22 +11,18 @@ namespace n_koopa; * A collection of strings used for generating SQL. */ class c_database_string { - public const ACCESS_METHOD = 'access method'; + public const ACCESS = 'access'; public const ADD = 'add'; - public const ADD_ATTRIBUTE = 'add attribute'; - public const ADD_COLUMN = 'add column'; - public const ADD_TABLE = 'add table'; - public const ADD_VALUE = 'add value'; public const AFTER = 'after'; public const AGGREGATE = 'aggregate'; public const ALL = 'all'; - public const ALLOW_CONNECTIONS = 'allow_connections'; + public const ALLOW = 'allow'; public const ALTER = 'alter'; - public const ALTER_ATTRIBUTE = 'alter attribute'; - public const ALTER_CONSTRAINT = 'alter constraint'; + public const ALWAYS = 'always'; public const AS = 'as'; public const ASCEND = 'asc'; - public const ATTACH_PARTITION = 'attach partition'; + public const ATTACH = 'attach'; + public const ATTRIBUTE = 'attribute'; public const AUTOSUMMARIZE = 'autosummarize'; public const AUTOVACUUM_ANALYZE_SCALE_FACTOR = 'autovacuum_analyze_scale_factor'; public const AUTOVACUUM_ANALYZE_THRESHOLD = 'autovacuum_analyze_threshold'; @@ -41,19 +37,28 @@ class c_database_string { public const AUTOVACUUM_SCALE_FACTOR = 'autovacuum_scale_factor'; public const AUTOVACUUM_VACUUM_THRESHOLD = 'autovacuum_vacuum_threshold'; public const BEFORE = 'before'; + public const BEGIN = 'begin'; public const BUFFERING = 'buffering'; + public const BY = 'by'; public const BYPASSRLS = 'bypassrls'; public const CACHE = 'cache'; - public const CALLED_ON_NULL_INPUT = 'called on null input'; + public const CALLED = 'called'; public const CASCADE = 'cascade'; public const CAST = 'cast'; - public const CLUSTER_ON = 'cluster on'; + public const CHECK = 'check'; + public const CHECK_OPTION = 'check_option'; + public const CLASS_ = 'class'; + public const CLUSTER = 'cluster'; public const COLLATE = 'collate'; public const COLLATION = 'collation'; public const COLUMN = 'column'; + public const COMMIT = 'commit'; + public const COMMITTED = 'committed'; + public const CONFIGURATION = 'configuration'; public const CONNECT = 'connect'; public const CONNECTION = 'connection'; - public const CONNECTION_LIMIT = 'connection limit'; + public const CONNECTIONS = 'connections'; + public const CONSTRAINT = 'constraint'; public const CONVERSION = 'conversion'; public const COPY_DATA = 'copy_data'; public const COST = 'cost'; @@ -61,76 +66,70 @@ class c_database_string { public const CREATEDB = 'createdb'; public const CREATEROLE = 'createrole'; public const CREATE_SLOT = 'create_slot'; - public const CURRENT_USER = 'current user'; + public const CURRENT = 'current'; public const CYCLE = 'cycle'; + public const DATA = 'data'; + public const DATABASE = 'database'; public const DEFAULT = 'default'; public const DEFERRABLE = 'deferrable'; + public const DEFERRED = 'deferred'; + public const DEFINER = 'definer'; public const DELETE = 'delete'; - public const DEPENDS_ON_EXTENSION = 'depends on extension'; + public const DEPENDS = 'depends'; public const DESCEND = 'desc'; + public const DICTIONARY = 'dictionary'; public const DISABLE = 'disable'; - public const DISABLE_RULE = 'disable rule'; - public const DISABLE_TRIGGER = 'disable trigger'; public const DOMAIN = 'domain'; public const DROP = 'drop'; - public const DROP_ATTRIBUTE = 'drop attribute'; - public const DROP_CONSTRAINT = 'drop constraint'; - public const DROP_DEFAULT = 'drop default'; - public const DROP_MAPPING = 'drop mapping'; - public const DROP_TABLE = 'drop table'; public const ENABLE = 'enable'; public const ENABLED = 'enabled'; - public const ENABLE_ALWAYS_RULE = 'enable always rule'; - public const ENABLE_ALWAYS_TRIGGER = 'enable always trigger'; - public const ENABLE_REPLICA_RULE = 'enable replica rule'; - public const ENABLE_REPLICA_TRIGGER = 'enable replica trigger'; - public const ENABLE_RULE = 'enable rule'; - public const ENABLE_TRIGGER = 'enable trigger'; - public const EVENT_TRIGGER = 'event trigger'; + public const ENCRYPTED = 'encypted'; + public const EVENT = 'event'; public const EXECUTE = 'execute'; + public const EXISTS = 'exists'; public const EXTENDED = 'extended'; + public const EXTENSION = 'extension'; public const EXTERNAL = 'external'; public const FALSE = 'false'; + public const FAMILY = 'family'; public const FASTUPDATE = 'fastupdate'; public const FILLFACTOR = 'fillfactor'; public const FOR = 'for'; - public const FOREIGN_DATA_WRAPPER = 'foreign data wrapper'; - public const FOREIGN_TABLE = 'foreign table'; - public const FOR_ORDER_BY = 'for order by'; - public const FOR_ROLE = 'for role'; - public const FOR_SEARCH = 'for search'; - public const FOR_VALUES = 'for values'; - public const FROM_CURRENT = 'from current'; + public const FOREIGN = 'foreign'; + public const FROM = 'from'; public const FULL = 'full'; public const FUNCTION = 'function'; + public const FUNCTIONS = 'functons'; public const GRANT = 'grant'; - public const GRANT_OPTION_FOR = 'grant option for'; public const GROUP = 'group'; - public const GROUP_BY = 'group by'; public const GIN_PENDING_LIST_LIMIT = 'gin_pending_list_limit'; public const HANDLER = 'handler'; - public const IF_EXISTS = 'if exists'; - public const IF_NOT_EXISTS = 'if not exists'; + public const IDENTITY = 'identity'; + public const IF = 'if'; + public const IMMEDIATE = 'immediate'; public const IMMUTABLE = 'immutable'; public const IN = 'in'; - public const IN_DATABASE = 'in database'; + public const INDEX = 'index'; public const INOUT = 'inout'; - public const IN_SCHEMA = 'in schema'; + public const INPUT = 'input'; + public const INVOKER = 'invoker'; public const INHERIT = 'inherit'; - public const INITIALLY_DEFERRED = 'initially deferred'; - public const INITIALLY_IMMEDIATE = 'initially immediate'; + public const INITIALLY = 'initially'; public const INSERT = 'insert'; + public const ISOLATION = 'isolation'; public const IS_TEMPLATE = 'is_template'; public const LANGUAGE = 'language'; public const LEAKPROOF = 'leakproof'; + public const LEVEL = 'level'; + public const LIMIT = 'limit'; + public const LOGGED = 'logged'; public const LOGIN = 'login'; public const LOG_AUTOVACUUM_MIN_DURATION = 'log_autovacuum_min_duration'; public const MAIN = 'main'; public const MAPPING = 'mapping'; - public const MAPPING_FOR = 'mapping for'; - public const MAPPING_REPLACE = 'mapping replace'; - public const MATERIALIZED_VIEW = 'materialized view'; + public const MATERIALIZED = 'materialized'; public const MAXVALUE = 'maxvalue'; + public const METHOD = 'method'; public const MINVALUE = 'minvalue'; public const N_DISTINCT = 'n_distinct'; public const N_DISTINCT_INHERITED = 'n_distinct_inherited'; @@ -143,101 +142,88 @@ class c_database_string { public const NOREPLICATION = 'noreplication'; public const NOSUPERUSER = 'nosuperuser'; public const NOTHING = 'nothing'; - public const NOWAIT = 'nowait'; - public const NO_HANDLER = 'no handler'; - public const NO_INHERIT = 'no inherit'; - public const NO_VALIDATOR = 'no validator'; - public const NOT_DEFERRABLE = 'not deferrable'; - public const NOT_LEAKPROOF = 'not leakproof'; - public const NOT_OF = 'not of'; - public const NOT_NULL = 'not null'; - public const NOT_VALID = 'not valid'; - public const ON_FUNCTIONS = 'on functons'; - public const ON_SCHEMAS = 'on schemas'; - public const ON_SEQUENCES = 'on sequences'; - public const ON_TABLES_TO = 'on tables to'; - public const ON_TYPES = 'on types'; + public const NOWAIT = 'nowait'; + public const NOT = 'not'; + public const NULL = 'null'; + public const OF = 'of'; + public const OIDS = 'oids'; + public const ON = 'on'; public const ONLY = 'only'; public const OPERATOR = 'operator'; - public const OPERATOR_CLASS = 'operator class'; - public const OPERATOR_FAMILY = 'operator family'; + public const OPTION = 'option'; public const OPTIONS = 'options'; - public const ORDER_BY = 'order by'; + public const ORDER = 'order'; public const OUT = 'out'; - public const OWNED_BY = 'owned by'; - public const OWNER_TO = 'owner to'; + public const OWNED = 'owned'; public const PAGES_PER_RANGE = 'pages_per_range'; public const PARALLEL = 'parallel'; public const PARALLEL_WORKERS = 'parallel_workers'; + public const PARSER = 'parser'; + public const PARTITION = 'partition'; public const PASSWORD = 'password'; - public const PASSWORD_ENCRYPTED = 'encypted password'; public const PLAIN = 'plain'; public const PROCEDURAL = 'procedural'; public const PUBLIC = 'public'; + public const PUBLICATION = 'publication'; public const PUBLISH = 'publish'; + public const READ = 'read'; public const REFERENCES = 'references'; public const REFRESH = 'refresh'; - public const REFRESH_PUBLICATION = 'refresh publication'; - public const REFRESH_VERSION = 'refresh version'; - public const RENAME_ATTRIBUTE = 'rename attribute'; - public const RENAME_COLUMN = 'rename column'; - public const RENAME_CONSTRAINT = 'rename constraint'; - public const RENAME_TO = 'rename to'; - public const REPLICA_IDENTITY = 'replica identity'; + public const RENAME = 'rename'; + public const REPEATABLE = 'repeatable'; + public const REPLACE = 'replace'; + public const REPLICA = 'replica'; public const REPLICATION = 'replication'; public const RESET = 'reset'; - public const RESET_ALL = 'reset all'; - public const RESET_PUBLICATION = 'reset publication'; - public const RESTART_WITH = 'restart with'; + public const RESTART = 'restart'; public const RESTRICT = 'restrict'; public const RESTRICTED = 'restricted'; - public const RETURNS_NULL_ON_NULL_INPUT = 'returns null on null input'; + public const RETURNS = 'returns'; public const REVOKE = 'revoke'; public const ROLE = 'role'; + public const ROLLBACK = 'rollback'; + public const ROW = 'row'; public const ROWS = 'rows'; - public const ROW_LEVEL_SECURITY = 'row level security'; + public const RULE = 'rule'; public const SAFE = 'safe'; public const SCHEMA = 'schema'; - public const SECURITY_DEFINER = 'security definer'; - public const SECURITY_INVOKER = 'security invoker'; + public const SCHEMAS = 'schemas'; + public const SEARCH = 'search'; + public const SECURITY = 'security'; + public const SECURITY_BARRIER = 'security_barrier'; public const SELECT = 'select'; public const SEQUENCE = 'sequence'; + public const SEQUENCES = 'sequences'; + public const SERIALIZABLE = 'serializable'; public const SERVER = 'server'; - public const SESSION_USER = 'session user'; + public const SESSION = 'session'; public const SET = 'set'; - public const SET_DATA = 'set data'; - public const SET_DATA_TYPE = 'set data type'; - public const SET_DEFAULT = 'set default'; - public const SET_LOGGED = 'set logged'; - public const SET_PUBLICATION = 'set publication'; - public const SET_SCHEMA = 'set schema'; - public const SET_STATISTICS = 'set statistics'; - public const SET_STORAGE = 'set storage'; - public const SET_TABLE = 'set table'; - public const SET_TABLESPACE = 'set tablespace'; - public const SET_UNLOGGED = 'set unlogged'; - public const SET_WITH_OIDS = 'set with oids'; - public const SET_WITHOUT_CLUSTER = 'set without cluster'; - public const SET_WITHOUT_OIDS = 'set without oids'; public const SLOT_NAME = 'slot_name'; + public const SNAPSHOT = 'snapshot'; public const STABLE = 'stable'; - public const START_WITH = 'start with'; + public const START = 'start'; + public const STATISTICS = 'statistics'; + public const STORAGE = 'storage'; public const STRICT = 'strict'; public const SUPERUSER = 'superuser'; public const SYNCHRONOUS_COMMIT = 'synchronous_commit'; public const TABLE = 'table'; - public const TEXT_SEARCH_CONFIGURATION = 'text search configuration'; - public const TEXT_SEARCH_DICTIONARY = 'text search dictionary'; - public const TEXT_SEARCH_PARSER = 'text search parser'; - public const TEXT_SEARCH_TEMPLATE = 'text search template'; - public const TRANSFORM_FOR = 'transform for'; + public const TABLES = 'tables'; + public const TABLESPACE = 'tablespace'; + public const TEMPLATE = 'template'; + public const TEXT = 'text'; + public const TRANSACTION = 'transaction'; + public const TRANSFORM = 'transform'; public const TRIGGER = 'trigger'; public const TRUE = 'true'; public const TRUNCATE = 'truncate'; public const TYPE = 'type'; + public const TYPES = 'types'; public const TO = 'to'; - public const TO_DEFAULT = 'to default'; + public const UNCOMMITTED = 'uncommitted'; + public const UNLOGGED = 'unlogged'; public const UNSAFE = 'unsafe'; + public const UNTIL = 'until'; public const UPDATE = 'update'; public const USAGE = 'usage'; public const USER = 'user'; @@ -245,17 +231,17 @@ class c_database_string { public const USER_CURRENT = 'current_user'; public const USER_SESSION = 'session_user'; public const USING = 'using'; - public const USING_INDEX = 'using index'; + public const VALID = 'valid'; + public const VALIDATE = 'validate'; public const VALIDATOR = 'validator'; - public const VALIDATE_CONSTRAINT = 'validate constraint'; - public const VALID_UNTIL = 'valid until'; + public const VALUE = 'value'; + public const VALUES = 'values'; public const VARIADIC = 'variadic'; public const VERSION = 'version'; public const VOLATILE = 'volatile'; public const VIEW = 'view'; + public const WRAPPER = 'wrapper'; public const WITH = 'with'; - public const WITH_DICTIONARY = 'with dictionary'; - public const WITHOUT_CLUSTER = 'without cluster'; - public const WITH_CHECK = 'with check'; - public const WITH_GRANT_OPTION = 'with grant option'; + public const WITHOUT = 'without'; + public const WRITE = 'write'; } diff --git a/common/database/enumerations/database_anaylze_option.php b/common/database/enumerations/database_anaylze_option.php new file mode 100644 index 0000000..1ef834b --- /dev/null +++ b/common/database/enumerations/database_anaylze_option.php @@ -0,0 +1,16 @@ +action_add_column['column_name'] . ' ' . $this->action_add_column['data_type']; + $value = c_database_string::ADD . ' ' . c_database_string::COLUMN . ' ' . $this->action_add_column['column_name'] . ' ' . $this->action_add_column['data_type']; if (!is_null($this->action_add_column['collate'])) { $value .= ' ' . $this->action_add_column['collate']; } diff --git a/common/database/traits/database_action_alter_column.php b/common/database/traits/database_action_alter_column.php index 19aa2ac..62a87da 100644 --- a/common/database/traits/database_action_alter_column.php +++ b/common/database/traits/database_action_alter_column.php @@ -19,7 +19,7 @@ trait t_database_action_alter_column { protected $action_alter_column; /** - * Set the action ALTER COLUMN settings. + * Assign the settings. * * @param string|null $column_name * The column name to use. @@ -172,29 +172,29 @@ trait t_database_action_alter_column { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_action_alter_column() { - $value = c_database_string::ALTER_COLUMN . ' ' . $this->action_alter_column['column_name']; + $value = c_database_string::ALTER . ' ' . c_database_string::COLUMN . ' ' . $this->action_alter_column['column_name']; switch ($this->action_alter_column['type']) { case e_database_alter_column::DROP: $value .= ' ' . c_database_string::DROP; if ($this->action_alter_column['value']) { - $value .= ' ' . c_database_string::NOT_NULL; + $value .= ' ' . c_database_string::NOT . ' ' . c_database_string::NULL; } break; case e_database_alter_column::SET: $value .= ' ' . c_database_string::SET; if ($this->action_alter_column['value']) { - $value .= ' ' . c_database_string::NOT_NULL; + $value .= ' ' . c_database_string::NOT . ' ' . c_database_string::NULL; } break; case e_database_alter_column::DROP_DEFAULT: - $value .= ' ' . c_database_string::DROP_DEFAULT; + $value .= ' ' . c_database_string::DROP . ' ' . c_database_string::DEFAULT; break; case e_database_alter_column::SET_DATA: - $value .= ' ' . c_database_string::SET_DATA; + $value .= ' ' . c_database_string::SET . ' ' . c_database_string::DATA; $value .= ' ' . c_database_string::TYPE; $value .= ' ' . strval($this->action_alter_column['value']); if (isset($this->action_alter_column['value2'])) { @@ -204,7 +204,7 @@ trait t_database_action_alter_column { break; case e_database_alter_column::SET_DEFAULT: - $value .= ' ' . c_database_string::SET_DEFAULT; + $value .= ' ' . c_database_string::SET . ' ' . c_database_string::DEFAULT; $value .= ' ' . strval($this->action_alter_column['value']); break; @@ -214,7 +214,7 @@ trait t_database_action_alter_column { break; case e_database_alter_column::SET_STORAGE: - $value .= ' ' . c_database_string::SET_STORAGE; + $value .= ' ' . c_database_string::SET . ' ' . c_database_string::STORAGE; if ($this->action_alter_column['value'] === e_database_set_storage::EXTENDED) { $value .= ' ' . c_database_string::EXTENDED; } diff --git a/common/database/traits/database_action_alter_column_options.php b/common/database/traits/database_action_alter_column_options.php index 600398d..1f71449 100644 --- a/common/database/traits/database_action_alter_column_options.php +++ b/common/database/traits/database_action_alter_column_options.php @@ -21,7 +21,7 @@ trait t_database_action_alter_column_options { protected $action_alter_column_options; /** - * Set the OPTIONS settings. + * Assign the settings. * * @param string|null $column_name * The column name to use. @@ -133,7 +133,7 @@ trait t_database_action_alter_column_options { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_action_alter_column_options() { - $value = c_database_string::ALTER_COLUMN . ' ' . $this->action_alter_column_options['column_name'] . ' ' . c_database_string::OPTIONS; + $value = c_database_string::ALTER . ' ' . c_database_string::COLUMN . ' ' . $this->action_alter_column_options['column_name'] . ' ' . c_database_string::OPTIONS; $values = []; foreach ($this->action_alter_column_options['values'] as $set) { diff --git a/common/database/traits/database_action_alter_column_reset.php b/common/database/traits/database_action_alter_column_reset.php index 48fb46a..311d1a5 100644 --- a/common/database/traits/database_action_alter_column_reset.php +++ b/common/database/traits/database_action_alter_column_reset.php @@ -19,7 +19,7 @@ trait t_database_action_alter_column_reset { protected $action_alter_column_reset; /** - * Set the RESET attribute option settings. + * Assign the settings. * * @param string|null $column_name * The column name to use. @@ -100,7 +100,7 @@ trait t_database_action_alter_column_reset { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_action_alter_column_reset() { - $value = c_database_string::ALTER_COLUMN . ' ' . $this->action_alter_column_reset['column_name'] . ' ' . c_database_string::RESET; + $value = c_database_string::ALTER . ' ' . c_database_string::COLUMN . ' ' . $this->action_alter_column_reset['column_name'] . ' ' . c_database_string::RESET; $values = []; foreach ($this->action_alter_column_reset['values'] as $reset) { diff --git a/common/database/traits/database_action_alter_column_set.php b/common/database/traits/database_action_alter_column_set.php index 40725c8..8cfbdd2 100644 --- a/common/database/traits/database_action_alter_column_set.php +++ b/common/database/traits/database_action_alter_column_set.php @@ -19,7 +19,7 @@ trait t_database_action_alter_column_set { protected $action_alter_column_set; /** - * Set the SET attribute option settings. + * Assign the settings. * * @param string|null $column_name * The column name to use. @@ -117,7 +117,7 @@ trait t_database_action_alter_column_set { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_action_alter_column_set() { - $value = c_database_string::ALTER_COLUMN . ' ' . $this->action_alter_column_set['column_name'] . ' ' . c_database_string::SET; + $value = c_database_string::ALTER . ' ' . c_database_string::COLUMN . ' ' . $this->action_alter_column_set['column_name'] . ' ' . c_database_string::SET; $values = []; foreach ($this->action_alter_column_set['values'] as $set) { diff --git a/common/database/traits/database_action_cluster_on.php b/common/database/traits/database_action_cluster_on.php index 3082f25..c3127d0 100644 --- a/common/database/traits/database_action_cluster_on.php +++ b/common/database/traits/database_action_cluster_on.php @@ -19,7 +19,7 @@ trait t_database_action_cluster_on { protected $action_cluster_on; /** - * Set the action CLUSTER ON settings. + * Assign the settings. * * @param string|null $name * The index name to use. @@ -82,6 +82,6 @@ trait t_database_action_cluster_on { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_action_cluster_on() { - return c_database_string::CLUSTER_ON . ' ' . $this->action_cluster_on; + return c_database_string::CLUSTER . ' ' . c_database_string::ON . ' ' . $this->action_cluster_on; } } diff --git a/common/database/traits/database_action_constraint.php b/common/database/traits/database_action_constraint.php index 501181e..30ae2ff 100644 --- a/common/database/traits/database_action_constraint.php +++ b/common/database/traits/database_action_constraint.php @@ -23,7 +23,7 @@ trait t_database_action_constraint { protected $action_constraint; /** - * Set the ADD/ALTER/VALIDATE/DROP action CONSTRAINT settings. + * Assign the settings. * * @param string|null $action_constraint_name * The name to use. @@ -161,33 +161,33 @@ trait t_database_action_constraint { $value = c_database_string::ADD . ' ' . $this->action_constraint['name']; if ($this->action_constraint['value']) { - $value .= ' ' . c_database_string::NOT_VALID; + $value .= ' ' . c_database_string::NOT . ' ' . c_database_string::VALID; } } else if ($this->action_constraint['type'] === e_database_constraint::ALTER) { - $value = c_database_string::ALTER_CONSTRAINT . ' ' . $this->action_constraint['name']; + $value = c_database_string::ALTER . ' ' . c_database_string::CONSTRAINT . ' ' . $this->action_constraint['name']; if ($this->action_constraint['value'] === e_database_constraint_mode::DEFERRABLE) { $value .= ' ' . c_database_string::DEFERRABLE; } else if ($this->action_constraint['value'] === e_database_constraint_mode::INITIALLY_DEFERRED) { - $value .= ' ' . c_database_string::INITIALLY_DEFERRED; + $value .= ' ' . c_database_string::INITIALLY . ' ' . c_database_string::DEFERRED; } else if ($this->action_constraint['value'] === e_database_constraint_mode::INITIALLY_IMMEDIATE) { - $value .= ' ' . c_database_string::INITIALLY_IMMEDIATE; + $value .= ' ' . c_database_string::INITIALLY . ' ' . c_database_string::IMMEDIATE; } else if ($this->action_constraint['value'] === e_database_constraint_mode::NOT_DEFERRABLE) { - $value .= ' ' . c_database_string::NOT_DEFERRABLE; + $value .= ' ' . c_database_string::NOT . ' ' . c_database_string::DEFERRABLE; } } else if ($this->action_constraint['type'] === e_database_constraint::DROP) { - $value = c_database_string::DROP_CONSTRAINT . ' ' . $this->action_constraint['name']; + $value = c_database_string::DROP . ' ' . c_database_string::CONSTRAINT . ' ' . $this->action_constraint['name']; } else if ($this->action_constraint['type'] === e_database_constraint::VALIDATE) { $value = c_database_string::VALIDATE_CONSTAINT; if ($this->action_constraint['value']) { - $value .= ' ' . c_database_string::NOT_VALID; + $value .= ' ' . c_database_string::NOT . ' ' . c_database_string::VALID; } $value .=' ' . $this->action_constraint['name']; diff --git a/common/database/traits/database_action_disable_rule.php b/common/database/traits/database_action_disable_rule.php index 7dedad2..f97a5d5 100644 --- a/common/database/traits/database_action_disable_rule.php +++ b/common/database/traits/database_action_disable_rule.php @@ -21,7 +21,7 @@ trait t_database_action_disable_rule { protected $action_disable_rule; /** - * Set the action DISABLE RULE value. + * Assign the settings. * * @param string|null $name * A string representing the rule name. @@ -84,6 +84,6 @@ trait t_database_action_disable_rule { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_action_disable_rule() { - return c_database_string::DISABLE_RULE . ' ' . $this->action_disable_rule; + return c_database_string::DISABLE . ' ' . c_database_string::RULE . ' ' . $this->action_disable_rule; } } diff --git a/common/database/traits/database_action_disable_trigger.php b/common/database/traits/database_action_disable_trigger.php index 6e91e0e..402455c 100644 --- a/common/database/traits/database_action_disable_trigger.php +++ b/common/database/traits/database_action_disable_trigger.php @@ -21,7 +21,7 @@ trait t_database_action_disable_trigger { protected $action_disable_trigger; /** - * Set the action DISABLE TRIGGER value. + * Assign the settings. * * @param int|null $type * An integer representing the type of the trigger. @@ -109,7 +109,7 @@ trait t_database_action_disable_trigger { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_action_disable_trigger() { - $value = c_database_string::DISABLE_TRIGGER; + $value = c_database_string::DISABLE . ' ' . c_database_string::TRIGGER; if ($this->action_disable_trigger['type'] === e_database_trigger::NAME) { if (is_string($this->action_disable_trigger['name'])) { diff --git a/common/database/traits/database_action_drop_column.php b/common/database/traits/database_action_drop_column.php index 195d717..8d06353 100644 --- a/common/database/traits/database_action_drop_column.php +++ b/common/database/traits/database_action_drop_column.php @@ -19,7 +19,7 @@ trait t_database_action_drop_column { protected $action_drop_column; /** - * Set the action DROP COLUMN settings. + * Assign the settings. * * @param string|null $column_name * The column name to use. diff --git a/common/database/traits/database_action_enable_rule.php b/common/database/traits/database_action_enable_rule.php index ee9f121..d5f1c43 100644 --- a/common/database/traits/database_action_enable_rule.php +++ b/common/database/traits/database_action_enable_rule.php @@ -21,7 +21,7 @@ trait t_database_action_enable_rule { protected $action_enable_rule; /** - * Set the action ENABLE RULE value. + * Assign the settings. * * @param int|null $type * An integer representing the type of the rule. @@ -114,23 +114,23 @@ trait t_database_action_enable_rule { if ($this->action_enable_rule['type'] === e_database_rule::ALWAYS || $this->action_enable_rule['type'] === e_database_rule::REPLICA) { if (is_string($this->action_enable_rule['name'])) { if ($this->action_enable_rule['type'] === e_database_rule::ALWAYS) { - $value = c_database_string::ENABLE_ALWAYS_RULE . ' ' . $this->action_enable_rule['name']; + $value = c_database_string::ENABLE . ' ' . c_database_string::ALWAYS . ' ' . c_database_string::RULE . ' ' . $this->action_enable_rule['name']; } else if ($this->action_enable_rule['type'] === e_database_rule::REPLICA) { - $value = c_database_string::ENABLE_REPLICA_RULE . ' ' . $this->action_enable_rule['name']; + $value = c_database_string::ENABLE . ' ' . c_database_string::REPLICA . ' ' . c_database_string::RULE . ' ' . $this->action_enable_rule['name']; } } } else if ($this->action_enable_rule['type'] === e_database_rule::NAME) { if (is_string($this->action_enable_rule['name'])) { - $value = c_database_string::ENABLE_RULE . ' ' . $this->action_enable_rule['name']; + $value = c_database_string::ENABLE . ' ' . c_database_string::RULE . ' ' . $this->action_enable_rule['name']; } } else if ($this->action_enable_rule['type'] === e_database_rule::ALL) { - $value = c_database_string::ENABLE_RULE . ' ' . c_database_string::ALL; + $value = c_database_string::ENABLE . ' ' . c_database_string::RULE . ' ' . c_database_string::ALL; } else if ($this->action_enable_rule['type'] === e_database_rule::USER) { - $value = c_database_string::ENABLE_RULE . ' ' . c_database_string::USER; + $value = c_database_string::ENABLE . ' ' . c_database_string::RULE . ' ' . c_database_string::USER; } return $value; diff --git a/common/database/traits/database_action_enable_trigger.php b/common/database/traits/database_action_enable_trigger.php index f779ea7..711019d 100644 --- a/common/database/traits/database_action_enable_trigger.php +++ b/common/database/traits/database_action_enable_trigger.php @@ -21,7 +21,7 @@ trait t_database_action_enable_trigger { protected $action_enable_trigger; /** - * Set the action ENABLE TRIGGER value. + * Assign the settings. * * @param int|null $type * An integer representing the type of the trigger. @@ -114,23 +114,23 @@ trait t_database_action_enable_trigger { if ($this->action_enable_trigger['type'] === e_database_trigger::ALWAYS || $this->action_enable_trigger['type'] === e_database_trigger::REPLICA) { if (is_string($this->action_enable_trigger['name'])) { if ($this->action_enable_trigger['type'] === e_database_trigger::ALWAYS) { - $value = c_database_string::ENABLE_ALWAYS_TRIGGER . ' ' . $this->action_enable_trigger['name']; + $value = c_database_string::ENABLE . ' ' . c_database_string::ALWAYS . ' ' . c_database_string::TRIGGER . ' ' . $this->action_enable_trigger['name']; } else if ($this->action_enable_trigger['type'] === e_database_trigger::REPLICA) { - $value = c_database_string::ENABLE_REPLICA_TRIGGER . ' ' . $this->action_enable_trigger['name']; + $value = c_database_string::ENABLE . ' ' . c_database_string::REPLICA . ' ' . c_database_string::TRIGGER . ' ' . $this->action_enable_trigger['name']; } } } else if ($this->action_enable_trigger['type'] === e_database_trigger::NAME) { if (is_string($this->action_enable_trigger['name'])) { - $value = c_database_string::ENABLE_TRIGGER . ' ' . $this->action_enable_trigger['name']; + $value = c_database_string::ENABLE . ' ' . c_database_string::TRIGGER . ' ' . $this->action_enable_trigger['name']; } } else if ($this->action_enable_trigger['type'] === e_database_trigger::ALL) { - $value = c_database_string::ENABLE_TRIGGER . ' ' . c_database_string::ALL; + $value = c_database_string::ENABLE . ' ' . c_database_string::TRIGGER . ' ' . c_database_string::ALL; } else if ($this->action_enable_trigger['type'] === e_database_trigger::USER) { - $value = c_database_string::ENABLE_TRIGGER . ' ' . c_database_string::USER; + $value = c_database_string::ENABLE . ' ' . c_database_string::TRIGGER . ' ' . c_database_string::USER; } return $value; diff --git a/common/database/traits/database_action_mapping_for.php b/common/database/traits/database_action_mapping_for.php index a8384bc..46ed7c3 100644 --- a/common/database/traits/database_action_mapping_for.php +++ b/common/database/traits/database_action_mapping_for.php @@ -21,7 +21,7 @@ trait t_database_mapping_for { protected $mapping_for; /** - * Set the MAPPING FOR settings. + * Assign the settings. * * Set all parameters to NULL to reset data to NULL. * @@ -125,16 +125,16 @@ trait t_database_mapping_for { $value = NULL; if ($this->mapping_for['type'] === e_database_mapping_for::ADD) { - $value = c_database_string::ADD . ' ' . c_database_string::MAPPING_FOR; + $value = c_database_string::ADD . ' ' . c_database_string::MAPPING . ' ' . c_database_string::FOR; } else if ($this->mapping_for['type'] === e_database_mapping_for::ALTER) { - $value = c_database_string::ALTER . ' ' . c_database_string::MAPPING_FOR; + $value = c_database_string::ALTER . ' ' . c_database_string::MAPPING . ' ' . c_database_string::FOR; } else if ($this->mapping_for['type'] === e_database_mapping_for::DROP) { - $value = c_database_string::DROP_MAPPING; + $value = c_database_string::DROP . ' ' . c_database_string::MAPPING; if ($this->mapping_for['if_exists']) { - $value .= ' ' . c_database_string::IF_EXISTS; + $value .= ' ' . c_database_string::IF . ' ' . c_database_string::EXISTS; } $value .= ' ' . c_database_string::FOR; diff --git a/common/database/traits/database_action_not_of.php b/common/database/traits/database_action_not_of.php index 1fa489b..f6f2875 100644 --- a/common/database/traits/database_action_not_of.php +++ b/common/database/traits/database_action_not_of.php @@ -19,7 +19,7 @@ trait t_database_action_not_of { protected $action_not_of; /** - * Set the action NOT OF settings. + * Assign the settings. * * @param bool|null $not_of * Set to TRUE to enable. @@ -76,6 +76,6 @@ trait t_database_action_not_of { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_action_not_of() { - return $this->action_not_of ? c_database_string::NOT_OF : NULL; + return $this->action_not_of ? c_database_string::NOT . ' ' . c_database_string::OF : NULL; } } diff --git a/common/database/traits/database_action_of.php b/common/database/traits/database_action_of.php index 9270153..52a2885 100644 --- a/common/database/traits/database_action_of.php +++ b/common/database/traits/database_action_of.php @@ -19,7 +19,7 @@ trait t_database_action_of { protected $action_of; /** - * Set the action OF settings. + * Assign the settings. * * @param string|null $type_name * The of type name to set to. diff --git a/common/database/traits/database_action_options.php b/common/database/traits/database_action_options.php index 953fc0d..9c96a3e 100644 --- a/common/database/traits/database_action_options.php +++ b/common/database/traits/database_action_options.php @@ -19,7 +19,7 @@ trait t_database_action_options { protected $action_options; /** - * Set the in action_options. + * Assign the settings. * * @param string|null $type * The option type to use. diff --git a/common/database/traits/database_action_replica_identity.php b/common/database/traits/database_action_replica_identity.php index bf9db22..50d125e 100644 --- a/common/database/traits/database_action_replica_identity.php +++ b/common/database/traits/database_action_replica_identity.php @@ -21,7 +21,7 @@ trait t_database_action_replica_identity { protected $action_replica_identity; /** - * Set the REPLICA IDENTITY attribute option settings. + * Assign the settings. * * @param int|null $type * An integer of e_database_replica_identity to use. @@ -104,7 +104,7 @@ trait t_database_action_replica_identity { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_action_replica_identity() { - $value = c_database_string::REPLICA_IDENTITY; + $value = c_database_string::REPLICA . ' ' . c_database_string::IDENTITY; if ($this->action_replica_identity['type'] === e_database_replica_identity::DEFAULT) { $value .= ' ' . c_database_string::DEFAULT; @@ -116,7 +116,7 @@ trait t_database_action_replica_identity { $value .= ' ' . c_database_string::NOTHING; } else if ($this->action_replica_identity['type'] === e_database_replica_identity::USING_INDEX) { - $value .= ' ' . c_database_string::USING_INDEX; + $value .= ' ' . c_database_string::USING . ' ' . c_database_string::INDEX; $value .= ' ' . $this->action_replica_identity['name']; } diff --git a/common/database/traits/database_action_row_level_security.php b/common/database/traits/database_action_row_level_security.php index eeaa348..674d921 100644 --- a/common/database/traits/database_action_row_level_security.php +++ b/common/database/traits/database_action_row_level_security.php @@ -21,7 +21,7 @@ trait t_database_action_row_level_security { protected $action_row_level_security; /** - * Set the ROW LEVEL SECURITY attribute option settings. + * Assign the settings. * * @param int|null $type * An integer of e_database_row_level_security to use. @@ -90,7 +90,7 @@ trait t_database_action_row_level_security { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_action_row_level_security() { - $value = c_database_string::REPLICA_IDENTITY; + $value = c_database_string::REPLICA . ' ' . c_database_string::IDENTITY; if ($this->action_row_level_security['type'] === e_database_row_level_security::DISABLE) { $value .= ' ' . c_database_string::DISABLE; @@ -105,7 +105,7 @@ trait t_database_action_row_level_security { $value .= ' ' . c_database_string::NO_FORCE; } - $value .= ' ' . c_database_string::ROW_LEVEL_SECURITY; + $value .= ' ' . c_database_string::ROW . ' ' . c_database_string::LEVEL . ' ' . c_database_string::SECURITY; return $value; } } diff --git a/common/database/traits/database_action_set_logged.php b/common/database/traits/database_action_set_logged.php index 4cc6956..e51233a 100644 --- a/common/database/traits/database_action_set_logged.php +++ b/common/database/traits/database_action_set_logged.php @@ -17,7 +17,7 @@ trait t_database_action_set_logged { protected $action_set_logged; /** - * Set the action SET LOGGED / SET UNLOGGED settings. + * Assign the settings. * * @param bool|null $logged * Set to TRUE for logged. @@ -75,9 +75,9 @@ trait t_database_action_set_logged { */ protected function p_do_build_action_set_logged() { if ($this->action_set_logged) { - return c_database_string::SET_LOGGED; + return c_database_string::SET . ' ' . c_database_string::LOGGED; } - return c_database_string::SET_UNLOGGED; + return c_database_string::SET . ' ' . c_database_string::UNLOGGED; } } diff --git a/common/database/traits/database_action_set_tablespace.php b/common/database/traits/database_action_set_tablespace.php index cbb425b..d56fec4 100644 --- a/common/database/traits/database_action_set_tablespace.php +++ b/common/database/traits/database_action_set_tablespace.php @@ -19,7 +19,7 @@ trait t_database_action_set_tablespace { protected $action_set_tablespace; /** - * Set the action SET TABLESPACE settings. + * Assign the settings. * * @param string|null $name * The tablespace name to set to. @@ -82,6 +82,6 @@ trait t_database_action_set_tablespace { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_action_set_tablespace() { - return c_database_string::SET_TABLESPACE . ' ' . $this->action_set_tablespace; + return c_database_string::SET . ' ' . c_database_string::TABLESPACE . ' ' . $this->action_set_tablespace; } } diff --git a/common/database/traits/database_action_without_cluster.php b/common/database/traits/database_action_without_cluster.php index 590fa47..b6d81c1 100644 --- a/common/database/traits/database_action_without_cluster.php +++ b/common/database/traits/database_action_without_cluster.php @@ -19,7 +19,7 @@ trait t_database_action_without_cluster { protected $action_without_cluster; /** - * Set the WITHOUT CLUSTER value. + * Assign the settings. * * @param bool|null $without_cluster * Set to TRUE for WITHOUT CLUSTER. @@ -76,6 +76,6 @@ trait t_database_action_without_cluster { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_action_without_cluster() { - return $this->action_without_cluster ? c_database_string::WITHOUT_CLUSTER : NULL; + return $this->action_without_cluster ? c_database_string::WITHOUT . ' ' . c_database_string::CLUSTER : NULL; } } diff --git a/common/database/traits/database_add_operator_family.php b/common/database/traits/database_add_operator_family.php index f73ca78..59c2010 100644 --- a/common/database/traits/database_add_operator_family.php +++ b/common/database/traits/database_add_operator_family.php @@ -22,7 +22,7 @@ trait t_database_add_operator_family { protected $add_operator_family; /** - * Set the add user or drop user. + * Assign the settings. * * @param bool|null $add * Set to TRUE for ADD OPERATOR. @@ -248,13 +248,13 @@ trait t_database_add_operator_family { if ($add_operator_family['add'] && $add_operator_family['type'] === e_database_operator_family::OPERATOR) { if ($add_operator_family['for_type'] === e_database_operator_for::FOR_ORDER_BY) { - $value .= ' ' . c_database_string::FOR_ORDER_BY; + $value .= ' ' . c_database_string::FOR . ' ' . c_database_string::ORDER . ' ' . c_database_string::BY; if (isset($add_operator_family['sort_family_name'])) { $value .= ' ' . $add_operator_family['sort_family_name']; } } else if ($add_operator_family['for_type'] === e_database_operator_for::FOR_SEARCH) { - $value .= ' ' . c_database_string::FOR_SEARCH; + $value .= ' ' . c_database_string::FOR . ' ' . c_database_string::SEARCH; } } diff --git a/common/database/traits/database_add_table.php b/common/database/traits/database_add_table.php index 2574a7b..e6458a8 100644 --- a/common/database/traits/database_add_table.php +++ b/common/database/traits/database_add_table.php @@ -19,7 +19,7 @@ trait t_database_add_table { protected $add_table; /** - * Set the ADD TABLE settings. + * Assign the settings. * * @param string|null $name * The table name. @@ -106,7 +106,7 @@ trait t_database_add_table { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_add_table() { - $value = c_database_string::ADD_TABLE; + $value = c_database_string::ADD . ' ' . c_database_string::TABLE; if ($this->add_table['only']) { $value .= ' ' . c_database_string::ONLY; diff --git a/common/database/traits/database_add_user.php b/common/database/traits/database_add_user.php index c92d243..2e5c9eb 100644 --- a/common/database/traits/database_add_user.php +++ b/common/database/traits/database_add_user.php @@ -21,7 +21,7 @@ trait t_database_add_user { protected $add_user; /** - * Set the add user or drop user. + * Assign the settings. * * @param string|int|bool|null $name * The user name (role name) to use. diff --git a/common/database/traits/database_add_value.php b/common/database/traits/database_add_value.php index fd4ed3a..76f42ea 100644 --- a/common/database/traits/database_add_value.php +++ b/common/database/traits/database_add_value.php @@ -21,7 +21,7 @@ trait t_database_add_value { protected $add_value; /** - * Set the SET WITH OIDS value. + * Assign the settings. * * @param string|null $new_enum_value * The enum value to use. @@ -130,12 +130,12 @@ trait t_database_add_value { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_add_value() { - $value = c_database_string::ADD_VALUE; + $value = c_database_string::ADD . ' ' . c_database_string::VALUE; // @todo: confirm/deny whether or not the placeholder will be auto-quoted by PDO. $value .= ' \'' . $this->add_value['new_enum_value'] . '\''; if ($this->add_value['if_not_exists']) { - $value .= ' ' . c_database_string::IF_NOT_EXISTS; + $value .= ' ' . c_database_string::IF . ' ' . c_database_string::NOT . ' ' . c_database_string::EXISTS; } if (is_int($this->add_value['position'])) { diff --git a/common/database/traits/database_alter_column.php b/common/database/traits/database_alter_column.php new file mode 100644 index 0000000..ae41c86 --- /dev/null +++ b/common/database/traits/database_alter_column.php @@ -0,0 +1,134 @@ +alter_column = NULL; + return new c_base_return_true(); + } + + if (!is_string($name)) { + $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'name', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + switch ($type) { + case e_database_set_column_default::DROP: + $placeholder_expression = NULL; + break; + + case e_database_set_column_default::SET: + if (!is_string($expression)) { + $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'expression', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $placeholder_expression = $this->add_placeholder($expression); + if ($placeholder_expression->has_error()) { + return c_base_return_error::s_false($placeholder_expression->get_error()); + } + + break; + + default: + $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'type', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $placeholder_name = $this->add_placeholder($name); + if ($placeholder_name->has_error()) { + unset($placeholder_expression); + return c_base_return_error::s_false($placeholder_name->get_error()); + } + + $this->alter_column = [ + 'name' => $placeholder_name, + 'type' => $type, + 'expression' => $placeholder_expression, + ]; + unset($placeholder_name); + unset($placeholder_expression); + + return new c_base_return_true(); + } + + /** + * Get the currently assigned tablespace name to set to. + * + * @return c_base_return_array|c_base_return_null + * An array of settings. + * NULL is returned if not set. + * NULL with the error bit set is returned on error. + */ + public function get_alter_column() { + if (is_null($this->alter_column)) { + return new c_base_return_null(); + } + + if (is_array($this->alter_column)) { + return c_base_return_array::s_new($this->alter_column); + } + + $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'alter_column', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE); + return c_base_return_error::s_null($error); + } + + /** + * Perform the common build process for this trait. + * + * As an internal trait method, the caller is expected to perform any appropriate validation. + * + * @return string|null + * A string is returned. + * NULL is returned if there is nothing to process or there is an error. + */ + protected function p_do_build_alter_column() { + $value = c_database_string::ALTER . ' ' . c_database_string::COLUMN . ' ' . $this->alter_column['name']; + + if ($this->alter_column['type'] === e_database_set_column_default::DROP) { + $value .= ' ' . c_database_string::DROP . ' ' . c_database_string::DEFAULT; + } + else if ($this->alter_column['type'] === e_database_set_column_default::SET) { + $value .= ' ' . c_database_string::SET_DEFAULT; + $value .= ' ' . $this->alter_column['expression']; + } + + return $value; + } +} diff --git a/common/database/traits/database_analyze_options.php b/common/database/traits/database_analyze_options.php new file mode 100644 index 0000000..4830a36 --- /dev/null +++ b/common/database/traits/database_analyze_options.php @@ -0,0 +1,100 @@ +analyze_options = NULL; + return new c_base_return_true(); + } + + switch ($option) { + case e_database_analyze_option::VERBOSE: + break; + case NULL: + break; + default: + $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'option', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + if (!is_array($this->analyze_options)) { + $this->analyze_options = []; + } + + $this->analyze_options[] = $option; + return new c_base_return_true(); + } + + /** + * Get the currently assigned settings. + * + * @return c_base_return_array|c_base_return_null + * An array of codes representing the argument_type on success. + * NULL is returned if not set. + * NULL with the error bit set is returned on error. + */ + public function get_analyze_options() { + if (is_null($this->analyze_options)) { + return new c_base_return_null(); + } + + if (is_array($this->analyze_options)) { + return c_base_return_array::s_new($this->analyze_options); + } + + $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'analyze_options', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE); + return c_base_return_error::s_null($error); + } + + /** + * Perform the common build process for this trait. + * + * As an internal trait method, the caller is expected to perform any appropriate validation. + * + * @return string|null + * A string is returned. + * NULL is returned if there is nothing to process or there is an error. + */ + protected function p_do_build_analyze_options() { + $values = []; + foreach ($this->analyze_options as $analyze_option) { + if ($analyze_option === e_database_attribute_option::VERBOSE) { + $values[] = c_database_string::VERBOSE; + } + } + unset($analyze_option); + + return implode(', ', $values); + } +} diff --git a/common/database/traits/database_argument_type.php b/common/database/traits/database_argument_type.php index 6444d6d..b771efa 100644 --- a/common/database/traits/database_argument_type.php +++ b/common/database/traits/database_argument_type.php @@ -21,7 +21,7 @@ trait t_database_argument_type { protected $argument_type; /** - * Set the argument type settings. + * Assign the settings. * * @param string|null $argument_type * The argument type to assign. diff --git a/common/database/traits/database_as_data_type.php b/common/database/traits/database_as_data_type.php index c418da1..5d95d1c 100644 --- a/common/database/traits/database_as_data_type.php +++ b/common/database/traits/database_as_data_type.php @@ -17,7 +17,7 @@ trait t_database_as_data_type { protected $as_data_type; /** - * Set the AS data type settings. + * Assign the settings. * * @param string|null $type * The data type to use. diff --git a/common/database/traits/database_attach_partition.php b/common/database/traits/database_attach_partition.php index b4645bc..0f01811 100644 --- a/common/database/traits/database_attach_partition.php +++ b/common/database/traits/database_attach_partition.php @@ -17,7 +17,7 @@ trait t_database_attach_partition { protected $attach_partition; /** - * Set the ATTACH PARTITION settings. + * Assign the settings. * * @param string|null $name * The partition name to use. @@ -99,6 +99,6 @@ trait t_database_attach_partition { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_attach_partition() { - return c_database_string::ATTACH_PARTITION . ' ' . $this->attach_partition['name'] . ' ' . c_database_string::FOR_VALUES . ' ' . $this->attach_partition['bound_spec']; + return c_database_string::ATTACH . ' ' . c_database_string::PARTITION . ' ' . $this->attach_partition['name'] . ' ' . c_database_string::FOR . ' ' . c_database_string::VALUES . ' ' . $this->attach_partition['bound_spec']; } } diff --git a/common/database/traits/database_begin.php b/common/database/traits/database_begin.php new file mode 100644 index 0000000..c9fe7a5 --- /dev/null +++ b/common/database/traits/database_begin.php @@ -0,0 +1,95 @@ +begin = NULL; + return new c_base_return_true(); + } + + switch ($begin) { + case e_database_transaction_action::TRANSACTION: + case e_database_transaction_action::WORK: + break; + + default: + $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'begin', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->begin = $begin; + return new c_base_return_true(); + } + + /** + * Get the currently assigned settings. + * + * @return c_base_return_int|c_base_return_null + * A e_database_transaction_action on success. + * NULL is returned if not set (begin is not to be used). + * NULL with the error bit set is returned on error. + */ + public function get_begin() { + if (is_null($this->begin)) { + return new c_base_return_null(); + } + + if (is_int($this->begin)) { + return c_base_return_int::s_new($this->begin); + } + + $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'begin', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE); + return c_base_return_error::s_null($error); + } + + /** + * Perform the common build process for this trait. + * + * As an internal trait method, the caller is expected to perform any appropriate validation. + * + * @return string|null + * A string is returned. + * NULL is returned if there is nothing to process or there is an error. + */ + protected function p_do_build_begin() { + $value = NULL; + if ($this->begin === e_database_transaction_action::TRANSACTION) { + $value = c_database_string::TRANSACTION; + } + else if ($this->begin === e_database_transaction_action::WORK) { + $value = c_database_string::WORK; + } + + return $value; + } +} diff --git a/common/database/traits/database_cache.php b/common/database/traits/database_cache.php index c2d8a7c..08178bb 100644 --- a/common/database/traits/database_cache.php +++ b/common/database/traits/database_cache.php @@ -17,7 +17,7 @@ trait t_database_cache { protected $cache; /** - * Set the CACHE settings. + * Assign the settings. * * @param int|null $sequence * The cache sequence number to use. diff --git a/common/database/traits/database_cascade.php b/common/database/traits/database_cascade.php index cb49b55..e972ac5 100644 --- a/common/database/traits/database_cascade.php +++ b/common/database/traits/database_cascade.php @@ -19,7 +19,7 @@ trait t_database_cascade { protected $cascade; /** - * Set the HANDLER settings. + * Assign the settings. * * @param int|null $cascade * The integer representing cascade/no-cascade. diff --git a/common/database/traits/database_cluster_on.php b/common/database/traits/database_cluster_on.php index 190d95d..264b963 100644 --- a/common/database/traits/database_cluster_on.php +++ b/common/database/traits/database_cluster_on.php @@ -17,7 +17,7 @@ trait t_database_cluster_on { protected $cluster_on; /** - * Set the CLUSTER ON settings. + * Assign the settings. * * @param string|null $index_name * The index name to use. @@ -80,6 +80,6 @@ trait t_database_cluster_on { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_cluster_on() { - return c_database_string::CLUSTER_ON . ' ' . strval($this->cluster_on); + return c_database_string::CLUSTER . ' ' . c_database_string::ON . ' ' . $this->cluster_on; } } diff --git a/common/database/traits/database_column_names.php b/common/database/traits/database_column_names.php new file mode 100644 index 0000000..f9e724f --- /dev/null +++ b/common/database/traits/database_column_names.php @@ -0,0 +1,92 @@ +column_names = NULL; + return new c_base_return_true(); + } + + if (!is_string($name)) { + $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'name', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + if (!is_array($this->column_names)) { + $this->column_names = []; + } + + $placeholder = $this->add_placeholder($name); + if ($placeholder->has_error()) { + return c_base_return_error::s_false($placeholder->get_error()); + } + + $this->column_names[] = $placeholder; + unset($placeholder); + + return new c_base_return_true(); + } + + /** + * Get the currently assigned settings. + * + * @return c_base_return_array|c_base_return_null + * An array of group by values or NULL if not defined. + * NULL with the error bit set is returned on error. + */ + public function get_column_names() { + if (is_null($this->column_names)) { + return new c_base_return_null(); + } + + if (is_array($this->column_names)) { + return c_base_return_array::s_new($this->column_names); + } + + $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'column_names', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE); + return c_base_return_error::s_null($error); + } + + /** + * Perform the common build process for this trait. + * + * As an internal trait method, the caller is expected to perform any appropriate validation. + * + * @return string|null + * A string is returned. + * NULL is returned if there is nothing to process or there is an error. + */ + protected function p_do_build_column_names() { + return implode(', ', $this->column_names); + } +} diff --git a/common/database/traits/database_column_reset.php b/common/database/traits/database_column_reset.php index 2167fd3..6ca0abd 100644 --- a/common/database/traits/database_column_reset.php +++ b/common/database/traits/database_column_reset.php @@ -21,7 +21,7 @@ trait t_database_column_reset { protected $column_reset; /** - * Set the COLUMN_RESET (attribute_option ...) settings. + * Assign the settings. * * @param int|null $attribute_option * The attribute option code to assign. @@ -83,7 +83,7 @@ trait t_database_column_reset { } /** - * Get the currently assigned COLUMN_RESET attribute option. + * Get the currently assigned settings. * * @return c_base_return_array|c_base_return_null * An array of codes representing the argument_type on success. diff --git a/common/database/traits/database_column_set.php b/common/database/traits/database_column_set.php index 915d1bc..093ab90 100644 --- a/common/database/traits/database_column_set.php +++ b/common/database/traits/database_column_set.php @@ -21,7 +21,7 @@ trait t_database_column_set { protected $column_set; /** - * Set the SET index (attribute_option ...) settings. + * Assign the settings. * * @param int|null $attribute_option * The attribute option code to assign. @@ -92,7 +92,7 @@ trait t_database_column_set { } /** - * Get the currently assigned COLUMN .. SET index attribute option. + * Get the currently assigned settings. * * @return c_base_return_array|c_base_return_null * An array containing the set index attribute option settings. diff --git a/common/database/traits/database_column_set_statistics.php b/common/database/traits/database_column_set_statistics.php index 870fa57..8ce830b 100644 --- a/common/database/traits/database_column_set_statistics.php +++ b/common/database/traits/database_column_set_statistics.php @@ -19,7 +19,7 @@ trait t_database_column_set_statistics { protected $column_set_statistics; /** - * Set the COLUMN .. SET STATISTICS settings. + * Assign the settings. * * @param string|null $name * The column name. @@ -93,6 +93,6 @@ trait t_database_column_set_statistics { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_column_set_statistics() { - return c_database_string::COLUMN . ' ' . $this->column_set_statistics['name'] . ' ' . c_database_string::SET_STATISTICS . ' ' . $this->column_set_statistics['value']; + return c_database_string::COLUMN . ' ' . $this->column_set_statistics['name'] . ' ' . c_database_string::SET . ' ' . c_database_string::STATISTICS . ' ' . $this->column_set_statistics['value']; } } diff --git a/common/database/traits/database_column_set_storage.php b/common/database/traits/database_column_set_storage.php index 3c4e3ea..f388f61 100644 --- a/common/database/traits/database_column_set_storage.php +++ b/common/database/traits/database_column_set_storage.php @@ -19,7 +19,7 @@ trait t_database_column_set_storage { protected $column_set_storage; /** - * Set the COLUMN .. SET STORAGE settings. + * Assign the settings. * * @param string|null $name * The column name. diff --git a/common/database/traits/database_connection.php b/common/database/traits/database_connection.php index 06c44de..ae3c769 100644 --- a/common/database/traits/database_connection.php +++ b/common/database/traits/database_connection.php @@ -17,7 +17,7 @@ trait t_database_connection { protected $connection; /** - * Set the CONNECTION settings. + * Assign the settings. * * @param string|null $value * The connection information to use. diff --git a/common/database/traits/database_constraint.php b/common/database/traits/database_constraint.php index 911d545..fb8e7fd 100644 --- a/common/database/traits/database_constraint.php +++ b/common/database/traits/database_constraint.php @@ -22,7 +22,7 @@ trait t_database_constraint { protected $constraint; /** - * Set the ADD/VALIDATE/DROP CONSTRAINT settings. + * Assign the settings. * * @param string|null $constraint_name * The name to use. @@ -143,17 +143,17 @@ trait t_database_constraint { $value = c_database_string::ADD . ' ' . $this->constraint['name']->get_name(); if ($this->constraint['exists_or_invalid']) { - $value .= ' ' . c_database_string::NOT_VALID; + $value .= ' ' . c_database_string::NOT . ' ' . c_database_string::VALID; } } else if ($this->constraint['type'] === e_database_constraint::DROP) { - $value = c_database_string::DROP_CONSTRAINT . ' ' . $this->constraint['name']; + $value = c_database_string::DROP . ' ' . c_database_string::CONSTRAINT . ' ' . $this->constraint['name']; } else if ($this->constraint['type'] === e_database_constraint::VALIDATE) { $value = c_database_string::VALIDATE_CONSTAINT; if ($this->constraint['exists_or_invalid']) { - $value .= ' ' . c_database_string::NOT_VALID; + $value .= ' ' . c_database_string::NOT . ' ' . c_database_string::VALID; } $value .=' ' . $this->constraint['name']; diff --git a/common/database/traits/database_cycle.php b/common/database/traits/database_cycle.php index ccb7921..3bfc7d9 100644 --- a/common/database/traits/database_cycle.php +++ b/common/database/traits/database_cycle.php @@ -17,7 +17,7 @@ trait t_database_cycle { protected $cycle; /** - * Set the CYCLE settings. + * Assign the settings. * * @param bool|null $cycle * Set to TRUE for CYCLE. diff --git a/common/database/traits/database_depends_on_extension.php b/common/database/traits/database_depends_on_extension.php index ffc7d38..32e71ae 100644 --- a/common/database/traits/database_depends_on_extension.php +++ b/common/database/traits/database_depends_on_extension.php @@ -19,7 +19,7 @@ trait t_database_depends_on_extension { protected $depends_on_extension; /** - * Set the RENAME TO settings. + * Assign the settings. * * @param string|null $depends_on_extension * The name to rename to. @@ -75,6 +75,6 @@ trait t_database_depends_on_extension { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_depends_on_extension() { - return c_database_string::DEPENDS_ON_EXTENSION . ' ' . $this->depends_on_extension; + return c_database_string::DEPENDS . ' ' . c_database_string::ON . ' ' . c_database_string::EXTENSION . ' ' . $this->depends_on_extension; } } diff --git a/common/database/traits/database_detach_partition.php b/common/database/traits/database_detach_partition.php index 13572a0..753fa71 100644 --- a/common/database/traits/database_detach_partition.php +++ b/common/database/traits/database_detach_partition.php @@ -17,7 +17,7 @@ trait t_database_detach_partition { protected $detach_partition; /** - * Set the ATTACH PARTITION settings. + * Assign the settings. * * @param string|null $name * The partition name to use. @@ -99,6 +99,6 @@ trait t_database_detach_partition { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_detach_partition() { - return c_database_string::ATTACH_PARTITION . ' ' . $this->detach_partition['name'] . ' ' . c_database_string::FOR_VALUES . ' ' . $this->detach_partition['bound_spec']; + return c_database_string::ATTACH . ' ' . c_database_string::PARTITION . ' ' . $this->detach_partition['name'] . ' ' . c_database_string::FOR . ' ' . c_database_string::VALUES . ' ' . $this->detach_partition['bound_spec']; } } diff --git a/common/database/traits/database_disable.php b/common/database/traits/database_disable.php index 2297286..6890d66 100644 --- a/common/database/traits/database_disable.php +++ b/common/database/traits/database_disable.php @@ -17,7 +17,7 @@ trait t_database_disable { protected $disable; /** - * Set the DISABLE settings. + * Assign the settings. * * @param bool|null $disable * Set to TRUE for DISABLE. diff --git a/common/database/traits/database_disable_trigger.php b/common/database/traits/database_disable_trigger.php index 8c35bf4..74e39d4 100644 --- a/common/database/traits/database_disable_trigger.php +++ b/common/database/traits/database_disable_trigger.php @@ -21,7 +21,7 @@ trait t_database_disable_trigger { protected $disable_trigger; /** - * Set the DISABLE TRIGGER value. + * Assign the settings. * * @param int|null $type * An integer representing the type of the trigger. @@ -109,7 +109,7 @@ trait t_database_disable_trigger { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_disable_trigger() { - $value = c_database_string::DISABLE_TRIGGER; + $value = c_database_string::DISABLE . ' ' . c_database_string::TRIGGER; if ($this->disable_trigger['type'] === e_database_trigger::NAME) { if (is_string($this->disable_trigger['name'])) { diff --git a/common/database/traits/database_drop_table.php b/common/database/traits/database_drop_table.php index d79d380..2164331 100644 --- a/common/database/traits/database_drop_table.php +++ b/common/database/traits/database_drop_table.php @@ -19,7 +19,7 @@ trait t_database_drop_value { protected $drop_value; /** - * Set the DROP TABLE settings. + * Assign the settings. * * @param string|null $name * The table name. @@ -106,7 +106,7 @@ trait t_database_drop_value { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_drop_value() { - $value = c_database_string::DROP_TABLE; + $value = c_database_string::DROP . ' ' . c_database_string::TABLE; if ($this->drop_value['only']) { $value .= ' ' . c_database_string::ONLY; diff --git a/common/database/traits/database_enable.php b/common/database/traits/database_enable.php index 131b2a5..d3d3b4b 100644 --- a/common/database/traits/database_enable.php +++ b/common/database/traits/database_enable.php @@ -17,7 +17,7 @@ trait t_database_enable { protected $enable; /** - * Set the ENABLE settings. + * Assign the settings. * * @param bool|null $enable * Set to TRUE for ENABLE. diff --git a/common/database/traits/database_enable_trigger.php b/common/database/traits/database_enable_trigger.php index 90e838f..5a20f11 100644 --- a/common/database/traits/database_enable_trigger.php +++ b/common/database/traits/database_enable_trigger.php @@ -21,7 +21,7 @@ trait t_database_enable_trigger { protected $enable_trigger; /** - * Set the ENABLE TRIGGER value. + * Assign the settings. * * @param int|null $type * An integer representing the type of the trigger. @@ -114,23 +114,23 @@ trait t_database_enable_trigger { if ($this->enable_trigger['type'] === e_database_trigger::ALWAYS || $this->enable_trigger['type'] === e_database_trigger::REPLICA) { if (is_string($this->enable_trigger['name'])) { if ($this->enable_trigger['type'] === e_database_trigger::ALWAYS) { - $value = c_database_string::ENABLE_ALWAYS_TRIGGER . ' ' . $this->enable_trigger['name']; + $value = c_database_string::ENABLE . ' ' . c_database_string::ALWAYS . ' ' . c_database_string::TRIGGER . ' ' . $this->enable_trigger['name']; } else if ($this->enable_trigger['type'] === e_database_trigger::REPLICA) { - $value = c_database_string::ENABLE_REPLICA_TRIGGER . ' ' . $this->enable_trigger['name']; + $value = c_database_string::ENABLE . ' ' . c_database_string::REPLICA . ' ' . c_database_string::TRIGGER . ' ' . $this->enable_trigger['name']; } } } else if ($this->enable_trigger['type'] === e_database_trigger::NAME) { if (is_string($this->enable_trigger['name'])) { - $value = c_database_string::ENABLE_TRIGGER . ' ' . $this->enable_trigger['name']; + $value = c_database_string::ENABLE . ' ' . c_database_string::TRIGGER . ' ' . $this->enable_trigger['name']; } } else if ($this->enable_trigger['type'] === e_database_trigger::ALL) { - $value = c_database_string::ENABLE_TRIGGER . ' ' . c_database_string::ALL; + $value = c_database_string::ENABLE . ' ' . c_database_string::TRIGGER . ' ' . c_database_string::ALL; } else if ($this->enable_trigger['type'] === e_database_trigger::USER) { - $value = c_database_string::ENABLE_TRIGGER . ' ' . c_database_string::USER; + $value = c_database_string::ENABLE . ' ' . c_database_string::TRIGGER . ' ' . c_database_string::USER; } return $value; diff --git a/common/database/traits/database_for_role.php b/common/database/traits/database_for_role.php index 058000f..6ebc3a7 100644 --- a/common/database/traits/database_for_role.php +++ b/common/database/traits/database_for_role.php @@ -19,7 +19,7 @@ trait t_database_for_role { protected $for_role; /** - * Set the FOR ROLE value. + * Assign the settings. * * @param string|null $for_role * Append a role name to the list. @@ -85,6 +85,6 @@ trait t_database_for_role { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_for_role() { - return c_database_string::FOR_ROLE . ' ' . implode(', ', $this->for_role); + return c_database_string::FOR . ' ' . c_database_string::ROLE . ' ' . implode(', ', $this->for_role); } } diff --git a/common/database/traits/database_function_action.php b/common/database/traits/database_function_action.php index 61af3a4..e408722 100644 --- a/common/database/traits/database_function_action.php +++ b/common/database/traits/database_function_action.php @@ -21,7 +21,7 @@ trait t_database_function_action { protected $function_action; /** - * Set the argument type settings. + * Assign the settings. * * @param int|null $function_action * The function action code to assign. @@ -175,7 +175,7 @@ trait t_database_function_action { $values = []; foreach ($this->function_action as $function_action) { if ($function_action['type'] === e_database_function_action::CALLED_ON_NULL_INPUT) { - $values[] = c_database_string::CALLED_ON_NULL_INPUT; + $values[] = c_database_string::CALLED . ' ' . c_database_string::ON . ' ' . c_database_string::NULL . ' ' . c_database_string::INPUT; } else if ($function_action['type'] === e_database_function_action::COST) { $values[] = c_database_string::COST . ' ' . $function_action['parameter_1']; @@ -187,7 +187,7 @@ trait t_database_function_action { $values[] = c_database_string::LEAKPROOF; } else if ($function_action['type'] === e_database_function_action::NOT_LEAKPROOF) { - $values[] = c_database_string::NOT_LEAKPROOF; + $values[] = c_database_string::NOT . ' ' . c_database_string::LEAKPROOF; } else if ($function_action['type'] === e_database_function_action::PARALLEL_RESTRICTED) { $values[] = c_database_string::PARALLEL_RESTRICTED; @@ -202,19 +202,19 @@ trait t_database_function_action { $values[] = c_database_string::RESET; } else if ($function_action['type'] === e_database_function_action::RESET_ALL) { - $values[] = c_database_string::RESET_ALL; + $values[] = c_database_string::RESET . ' ' . c_database_string::ALL; } else if ($function_action['type'] === e_database_function_action::RETURNS_NULL_ON_NULL_INPUT) { - $values[] = c_database_string::RETURNS_NULL_ON_NULL_INPUT; + $values[] = c_database_string::RETURNS . ' ' . c_database_string::NULL . ' ' . c_database_string::ON . ' ' . c_database_string::NULL . ' ' . c_database_string::INPUT; } else if ($function_action['type'] === e_database_function_action::ROWS) { $values[] = c_database_string::ROWS . ' ' . $function_action['parameter_1']; } else if ($function_action['type'] === e_database_function_action::SECURITY_DEFINER) { - $values[] = c_database_string::SECURITY_DEFINER; + $values[] = c_database_string::SECURITY . ' ' . c_database_string::DEFINER; } else if ($function_action['type'] === e_database_function_action::SECURITY_INVOKER) { - $values[] = c_database_string::SECURITY_INVOKER; + $values[] = c_database_string::SECURITY . ' ' . c_database_string::INVOKER; } else if ($function_action['type'] === e_database_function_action::SET_EQUAL) { $value = is_null($function_action['parameter_2']) ? c_database_string::DEFAULT : $function_action['parameter_2']; @@ -222,7 +222,7 @@ trait t_database_function_action { unset($value); } else if ($function_action['type'] === e_database_function_action::SET_FROM) { - $values[] = c_database_string::SET . ' ' . $function_action['parameter_1'] . ' ' . c_database_string::FROM_CURRENT; + $values[] = c_database_string::SET . ' ' . $function_action['parameter_1'] . ' ' . c_database_string::FROM . ' ' . c_database_string::CURRENT; unset($value); } else if ($function_action['type'] === e_database_function_action::SET_TO) { diff --git a/common/database/traits/database_grant.php b/common/database/traits/database_grant.php index c863e2f..8cbd1cc 100644 --- a/common/database/traits/database_grant.php +++ b/common/database/traits/database_grant.php @@ -22,7 +22,7 @@ trait t_database_grant { protected $grant; /** - * Set the GRANT settings. + * Assign the settings. * * @param int|null $grant * The grant/revoke code to assign. diff --git a/common/database/traits/database_grant_option_for.php b/common/database/traits/database_grant_option_for.php index ed8a935..c85e38f 100644 --- a/common/database/traits/database_grant_option_for.php +++ b/common/database/traits/database_grant_option_for.php @@ -19,7 +19,7 @@ trait t_database_grant_option_for { protected $grant_option_for; /** - * Set the GANT OPTION FOR value. + * Assign the settings. * * @param bool|null $grant_option_for * Set to TRUE for GANT OPTION FOR. @@ -76,6 +76,6 @@ trait t_database_grant_option_for { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_grant_option_for() { - return $this->grant_option_for ? c_database_string::GRANT_OPTION_FOR : NULL; + return $this->grant_option_for ? c_database_string::GRANT . ' ' . c_database_string::OPTION . ' ' . c_database_string::FOR : NULL; } } diff --git a/common/database/traits/database_group_by.php b/common/database/traits/database_group_by.php index 862c541..ac0866f 100644 --- a/common/database/traits/database_group_by.php +++ b/common/database/traits/database_group_by.php @@ -21,7 +21,7 @@ trait t_database_group_by { protected $group_by; /** - * Set the GROUP BY settings. + * Assign the settings. * * @param string|null $group_by * The name to group by. @@ -87,6 +87,6 @@ trait t_database_group_by { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_group_by() { - return c_database_string::GROUP_BY . implode(', ', $this->group_by); + return c_database_string::GROUP . ' ' . c_database_string::BY . implode(', ', $this->group_by); } } diff --git a/common/database/traits/database_handler.php b/common/database/traits/database_handler.php index 89a0db0..4d4f350 100644 --- a/common/database/traits/database_handler.php +++ b/common/database/traits/database_handler.php @@ -19,7 +19,7 @@ trait t_database_handler { protected $handler; /** - * Set the HANDLER settings. + * Assign the settings. * * @param int|null $handler * The integer representing handler/no-handler. @@ -108,7 +108,7 @@ trait t_database_handler { } } else if ($this->handler['type'] === e_database_handler::NO_HANDLER) { - $value .= c_database_string::NO_HANDLER; + $value .= c_database_string::NO . ' ' . c_database_string::HANDLER; } return $value; diff --git a/common/database/traits/database_if_exists.php b/common/database/traits/database_if_exists.php index 01f2dd8..59e76ec 100644 --- a/common/database/traits/database_if_exists.php +++ b/common/database/traits/database_if_exists.php @@ -19,7 +19,7 @@ trait t_database_if_exists { protected $if_exists; /** - * Set the IF EXISTS value. + * Assign the settings. * * @param bool|null $if_exists * Set to TRUE for 'IF EXISTS'. diff --git a/common/database/traits/database_if_not_exists.php b/common/database/traits/database_if_not_exists.php index cad6345..a1de853 100644 --- a/common/database/traits/database_if_not_exists.php +++ b/common/database/traits/database_if_not_exists.php @@ -19,7 +19,7 @@ trait t_database_if_not_exists { protected $if_not_exists; /** - * Set the IF NOT EXISTS value. + * Assign the settings. * * @param bool|null $if_not_exists * Set to TRUE for 'IF NOT EXISTS'. diff --git a/common/database/traits/database_in_database.php b/common/database/traits/database_in_database.php index 8129fb3..6e677d5 100644 --- a/common/database/traits/database_in_database.php +++ b/common/database/traits/database_in_database.php @@ -17,7 +17,7 @@ trait t_database_in_database { protected $in_database; /** - * Set the IN DATABASE settings. + * Assign the settings. * * @param string|null $name * The database name to use. @@ -80,6 +80,6 @@ trait t_database_in_database { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_in_database() { - return c_database_string::IN_DATABASE . ' ' . $this->in_database; + return c_database_string::IN . ' ' . c_database_string::DATABASE . ' ' . $this->in_database; } } diff --git a/common/database/traits/database_in_schema.php b/common/database/traits/database_in_schema.php index 574c824..b27cde0 100644 --- a/common/database/traits/database_in_schema.php +++ b/common/database/traits/database_in_schema.php @@ -19,7 +19,7 @@ trait t_database_in_schema { protected $in_schema; /** - * Set the in schema, schema names. + * Assign the settings. * * @param string|null $schema_name * The schema name to use. @@ -86,6 +86,6 @@ trait t_database_in_schema { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_in_schema() { - return c_database_string::IN_SCHEMA . ' ' . implode(', ', $this->in_schema); + return c_database_string::IN . ' ' . c_database_string::SCHEMA . ' ' . implode(', ', $this->in_schema); } } diff --git a/common/database/traits/database_increment_by.php b/common/database/traits/database_increment_by.php index 7dc754d..224f028 100644 --- a/common/database/traits/database_increment_by.php +++ b/common/database/traits/database_increment_by.php @@ -17,7 +17,7 @@ trait t_database_increment_by { protected $increment_by; /** - * Set the INCREMENT BY settings. + * Assign the settings. * * @param int|null $by * A positive or negative number to increment by. diff --git a/common/database/traits/database_inherit.php b/common/database/traits/database_inherit.php index 3a0f5bf..2dace60 100644 --- a/common/database/traits/database_inherit.php +++ b/common/database/traits/database_inherit.php @@ -19,7 +19,7 @@ trait t_database_inherit { protected $inherit; /** - * Set the INHERIT settings. + * Assign the settings. * * @param string|null $name * The table name to inherit from. @@ -88,7 +88,7 @@ trait t_database_inherit { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_inherit() { - $value = $this->inherit['inherit'] ? c_database_string::INHERIT : c_database_string::NO_INHERIT; + $value = $this->inherit['inherit'] ? c_database_string::INHERIT : c_database_string::NO . ' ' . c_database_string::INHERIT; $value .= ' ' . $this->inherit['name']; return $value; } diff --git a/common/database/traits/database_max_value.php b/common/database/traits/database_max_value.php index 2b7360b..31edd0c 100644 --- a/common/database/traits/database_max_value.php +++ b/common/database/traits/database_max_value.php @@ -17,7 +17,7 @@ trait t_database_max_value { protected $max_value; /** - * Set the MAXVALUE data type settings. + * Assign the settings. * * @param int|false|null $value * A number representing the max value. diff --git a/common/database/traits/database_min_value.php b/common/database/traits/database_min_value.php index 6b4194b..e7663ad 100644 --- a/common/database/traits/database_min_value.php +++ b/common/database/traits/database_min_value.php @@ -17,7 +17,7 @@ trait t_database_min_value { protected $min_value; /** - * Set the MINVALUE data type settings. + * Assign the settings. * * @param int|false|null $value * A number representing the min value. diff --git a/common/database/traits/database_name.php b/common/database/traits/database_name.php index 6295191..563bd55 100644 --- a/common/database/traits/database_name.php +++ b/common/database/traits/database_name.php @@ -17,7 +17,7 @@ trait t_database_name { protected $name; /** - * Set the NAME settings. + * Assign the settings. * * @param string|null $name * The name to use. diff --git a/common/database/traits/database_no_wait.php b/common/database/traits/database_no_wait.php index 8be5ac3..e7bdbb8 100644 --- a/common/database/traits/database_no_wait.php +++ b/common/database/traits/database_no_wait.php @@ -19,7 +19,7 @@ trait t_database_no_wait { protected $no_wait; /** - * Set the NOWAIT value. + * Assign the settings. * * @param bool|null $no_wait * Set to TRUE for NOWAIT. diff --git a/common/database/traits/database_oid.php b/common/database/traits/database_oid.php index 09cca75..3b42473 100644 --- a/common/database/traits/database_oid.php +++ b/common/database/traits/database_oid.php @@ -17,7 +17,7 @@ trait t_database_oid { protected $oid; /** - * Set the OID settings. + * Assign the settings. * * @param string|null $oid * The oid to use. diff --git a/common/database/traits/database_on.php b/common/database/traits/database_on.php index 94e8a26..5f5c981 100644 --- a/common/database/traits/database_on.php +++ b/common/database/traits/database_on.php @@ -84,19 +84,19 @@ trait t_database_on { $value = NULL; switch($this->on) { case e_database_on::TABLES_TO: - $value .= c_database_string::ON_TABLES_TO; + $value .= c_database_string::ON . ' ' . c_database_string::TABLES . ' ' . c_database_string::TO; break; case e_database_on::SEQUENCES: - $value .= c_database_string::ON_SEQUENCES; + $value .= c_database_string::ON . ' ' . c_database_string::SEQUENCES; break; case e_database_on::FUNCTIONS: - $value .= c_database_string::ON_FUNCTIONS; + $value .= c_database_string::ON . ' ' . c_database_string::FUNCTIONS; break; case e_database_on::TYPES: - $value .= c_database_string::ON_TYPES; + $value .= c_database_string::ON . ' ' . c_database_string::TYPES; break; case e_database_on::SCHEMAS: - $value .= c_database_string::ON_SCHEMAS; + $value .= c_database_string::ON . ' ' . c_database_string::SCHEMAS; break; } diff --git a/common/database/traits/database_on_table.php b/common/database/traits/database_on_table.php index 62f63a1..d09d606 100644 --- a/common/database/traits/database_on_table.php +++ b/common/database/traits/database_on_table.php @@ -17,7 +17,7 @@ trait t_database_on_table { protected $on_table; /** - * Set the ON TABLE settings. + * Assign the settings. * * @param string|null $name * The table name to use. diff --git a/common/database/traits/database_operand_left.php b/common/database/traits/database_operand_left.php index 9a16244..de4d5a8 100644 --- a/common/database/traits/database_operand_left.php +++ b/common/database/traits/database_operand_left.php @@ -21,7 +21,7 @@ trait t_database_operand_left { protected $operand_left; /** - * Set the (left) operand settings. + * Assign the settings. * * @param int|string|null $type * The operand to assign. diff --git a/common/database/traits/database_operand_right.php b/common/database/traits/database_operand_right.php index be83e0b..10a0fba 100644 --- a/common/database/traits/database_operand_right.php +++ b/common/database/traits/database_operand_right.php @@ -21,7 +21,7 @@ trait t_database_operand_right { protected $operand_right; /** - * Set the (right) operand settings. + * Assign the settings. * * @param int|string|null $type * The operand to assign. diff --git a/common/database/traits/database_options.php b/common/database/traits/database_options.php index 185b67b..3254749 100644 --- a/common/database/traits/database_options.php +++ b/common/database/traits/database_options.php @@ -19,7 +19,7 @@ trait t_database_options { protected $options; /** - * Set the in options. + * Assign the settings. * * @param string|null $type * The option type to use. diff --git a/common/database/traits/database_order_by.php b/common/database/traits/database_order_by.php index 59e1241..d3ae63a 100644 --- a/common/database/traits/database_order_by.php +++ b/common/database/traits/database_order_by.php @@ -19,7 +19,7 @@ trait t_database_order_by { protected $order_by; /** - * Set the GROUP BY settings. + * Assign the settings. * * @param string|null $order_by * The name to group by. @@ -85,6 +85,6 @@ trait t_database_order_by { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_order_by() { - return c_database_string::ORDER_BY . ' ' . implode(', ', $this->order_by); + return c_database_string::ORDER . ' ' . c_database_string::BY . ' ' . implode(', ', $this->order_by); } } diff --git a/common/database/traits/database_owner_to.php b/common/database/traits/database_owner_to.php index bc064b7..d72f2f9 100644 --- a/common/database/traits/database_owner_to.php +++ b/common/database/traits/database_owner_to.php @@ -21,7 +21,7 @@ trait t_database_owner_to { protected $owner_to; /** - * Set the OWNER TO settings. + * Assign the settings. * * @param int|null $owner_to * The owner type to assign. @@ -117,6 +117,6 @@ trait t_database_owner_to { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_owner_to() { - return c_database_string::OWNER_TO . ' ' . $this->owner_to['value']; + return c_database_string::OWNER . ' ' . c_database_string::TO . ' ' . $this->owner_to['value']; } } diff --git a/common/database/traits/database_procedural.php b/common/database/traits/database_procedural.php index 293af91..887133a 100644 --- a/common/database/traits/database_procedural.php +++ b/common/database/traits/database_procedural.php @@ -19,7 +19,7 @@ trait t_database_procedural { protected $procedural; /** - * Set the PROCEDURAL value. + * Assign the settings. * * @param bool|null $procedural * Set to TRUE for PROCEDURAL. diff --git a/common/database/traits/database_refresh_publication.php b/common/database/traits/database_refresh_publication.php index 08e227b..56b049f 100644 --- a/common/database/traits/database_refresh_publication.php +++ b/common/database/traits/database_refresh_publication.php @@ -19,7 +19,7 @@ trait t_database_refresh_publication { protected $refresh_publication; /** - * Set the REFRESH PUBLICATION settings. + * Assign the settings. * * @param bool|null $refresh * Set to TRUE to use REFRESH PUBLICATION. @@ -71,7 +71,7 @@ trait t_database_refresh_publication { */ protected function p_do_build_refresh_publication() { if ($this->refresh_publication) { - return c_database_string::REFRESH_PUBLICATION; + return c_database_string::REFRESH . ' ' . c_database_string::PUBLICATION; } return NULL; diff --git a/common/database/traits/database_rename_attribute.php b/common/database/traits/database_rename_attribute.php index c7f6268..14e9df7 100644 --- a/common/database/traits/database_rename_attribute.php +++ b/common/database/traits/database_rename_attribute.php @@ -21,7 +21,7 @@ trait t_database_rename_attribute { protected $rename_attribute; /** - * Set the RENAME ATTRIBUTE settings. + * Assign the settings. * * @param string|null $from * The name to rename from. diff --git a/common/database/traits/database_rename_column.php b/common/database/traits/database_rename_column.php index aaea751..15b2349 100644 --- a/common/database/traits/database_rename_column.php +++ b/common/database/traits/database_rename_column.php @@ -17,7 +17,7 @@ trait t_database_rename_column { protected $rename_column; /** - * Set the RENAME COLUMN settings. + * Assign the settings. * * @param string|null $from_name * The column name to rename from. @@ -99,6 +99,6 @@ trait t_database_rename_column { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_rename_column() { - return c_database_string::RENAME_COLUMN . ' ' . $this->rename_column['from'] . ' ' . c_database_string::TO . ' ' . $this->rename_column['to']; + return c_database_string::RENAME . ' ' . c_database_string::COLUMN . ' ' . $this->rename_column['from'] . ' ' . c_database_string::TO . ' ' . $this->rename_column['to']; } } diff --git a/common/database/traits/database_rename_constraint.php b/common/database/traits/database_rename_constraint.php index fa844ae..8985f19 100644 --- a/common/database/traits/database_rename_constraint.php +++ b/common/database/traits/database_rename_constraint.php @@ -17,7 +17,7 @@ trait t_database_rename_constraint { protected $rename_constraint; /** - * Set the RENAME CONSTRAINT settings. + * Assign the settings. * * @param string|null $from_name * The constraint name to rename from. @@ -99,6 +99,6 @@ trait t_database_rename_constraint { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_rename_constraint() { - return c_database_string::RENAME_CONSTRAINT . ' ' . $this->rename_constraint['from'] . ' ' . c_database_string::TO . ' ' . $this->rename_constraint['to']; + return c_database_string::RENAME . ' ' . c_database_string::CONSTRAINT . ' ' . $this->rename_constraint['from'] . ' ' . c_database_string::TO . ' ' . $this->rename_constraint['to']; } } diff --git a/common/database/traits/database_rename_to.php b/common/database/traits/database_rename_to.php index 6bcd403..87985b7 100644 --- a/common/database/traits/database_rename_to.php +++ b/common/database/traits/database_rename_to.php @@ -19,7 +19,7 @@ trait t_database_rename_to { protected $rename_to; /** - * Set the RENAME TO settings. + * Assign the settings. * * @param string|null $rename_to * The name to rename to. @@ -82,6 +82,6 @@ trait t_database_rename_to { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_rename_to() { - return c_database_string::RENAME_TO . ' ' . $this->rename_to; + return c_database_string::RENAME . ' ' . c_database_string::TO . ' ' . $this->rename_to; } } diff --git a/common/database/traits/database_rename_value.php b/common/database/traits/database_rename_value.php index dacd220..bf8c11e 100644 --- a/common/database/traits/database_rename_value.php +++ b/common/database/traits/database_rename_value.php @@ -19,7 +19,7 @@ trait t_database_rename_value { protected $rename_value; /** - * Set the RENAME VALUE settings. + * Assign the settings. * * @param string|null $from * The name to rename from. diff --git a/common/database/traits/database_reset_configuration_parameter.php b/common/database/traits/database_reset_configuration_parameter.php index cf399c7..c70ecbc 100644 --- a/common/database/traits/database_reset_configuration_parameter.php +++ b/common/database/traits/database_reset_configuration_parameter.php @@ -21,7 +21,7 @@ trait t_database_reset_configuration_parameter { protected $reset_configuration_parameter; /** - * Set the RESET configuration_parameter settings. + * Assign the settings. * * @param int|null $type * The reset code to assign. diff --git a/common/database/traits/database_reset_storage_parameter.php b/common/database/traits/database_reset_storage_parameter.php index 24feada..58ea091 100644 --- a/common/database/traits/database_reset_storage_parameter.php +++ b/common/database/traits/database_reset_storage_parameter.php @@ -21,7 +21,7 @@ trait t_database_reset_storage_parameter { protected $reset_storage_parameter; /** - * Set the RESET (storage_parameter ...) settings. + * Assign the settings. * * @param int|null $storage_parameter * The index storage_parameter code to assign. diff --git a/common/database/traits/database_reset_view_option.php b/common/database/traits/database_reset_view_option.php new file mode 100644 index 0000000..a133eb6 --- /dev/null +++ b/common/database/traits/database_reset_view_option.php @@ -0,0 +1,103 @@ +reset_view_option = NULL; + return new c_base_return_true(); + } + + switch ($type) { + case e_database_view_option::CHECK_OPTION: + case e_database_view_option::SECURITY_BARRIER: + break; + default: + $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'value', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + if (!is_array($this->reset_view_option)) { + $this->reset_view_option = []; + } + + $this->reset_view_option[] = [ + 'type' => $type, + ]; + + return new c_base_return_true(); + } + + /** + * Get the currently assigned set configuration parameter settings. + * + * @return c_base_return_array|c_base_return_null + * An array containing the settings. + * NULL is returned if not set. + * NULL with the error bit set is returned on error. + */ + public function get_reset_view_option() { + if (is_null($this->reset_view_option)) { + return new c_base_return_null(); + } + + if (is_array($this->reset_view_option)) { + return c_base_return_array::s_new($this->reset_view_option); + } + + $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'reset_view_option', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE); + return c_base_return_error::s_null($error); + } + + /** + * Perform the common build process for this trait. + * + * As an internal trait method, the caller is expected to perform any appropriate validation. + * + * @return string|null + * A string is returned. + * NULL is returned if there is nothing to process or there is an error. + */ + protected function p_do_build_reset_view_option() { + $values = []; + foreach ($this->reset_view_option as $value) { + if ($value['type'] === e_database_view_option::CHECK_OPTION) { + $values[] = c_database_string::CHECK_OPTION; + } + else if ($value['type'] === e_database_view_option::SECURITY_BARRIER) { + $values[] = c_database_string::SECURITY_BARRIER; + } + } + + return c_database_string::RESET . ' (' . implode(', ', $values) . ')'; + } +} diff --git a/common/database/traits/database_restart_with.php b/common/database/traits/database_restart_with.php index 06b8dd9..de5d402 100644 --- a/common/database/traits/database_restart_with.php +++ b/common/database/traits/database_restart_with.php @@ -17,7 +17,7 @@ trait t_database_restart_with { protected $restart_with; /** - * Set the RESTART WITH settings. + * Assign the settings. * * @param int|null $value * A number representing the start with value. @@ -78,6 +78,6 @@ trait t_database_restart_with { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_restart_with() { - return c_database_string::RESTART_WITH . ' ' . $this->restart_with; + return c_database_string::RESTART . ' ' . c_database_string::WITH . ' ' . $this->restart_with; } } diff --git a/common/database/traits/database_restrict.php b/common/database/traits/database_restrict.php index 6b43eaa..e5aa7b1 100644 --- a/common/database/traits/database_restrict.php +++ b/common/database/traits/database_restrict.php @@ -19,7 +19,7 @@ trait t_database_restrict { protected $restrict; /** - * Set the RESTRICT value. + * Assign the settings. * * @param bool|null $restrict * Set to TRUE for RESTRICT. diff --git a/common/database/traits/database_role_specification.php b/common/database/traits/database_role_specification.php index 79a782c..9224b0b 100644 --- a/common/database/traits/database_role_specification.php +++ b/common/database/traits/database_role_specification.php @@ -21,7 +21,7 @@ trait t_database_role_specification { protected $role_specification; /** - * Set the role specification. + * Assign the settings. * * @param int|string|null $name * A string representing the role name to use. diff --git a/common/database/traits/database_server_name.php b/common/database/traits/database_server_name.php index 44da055..1019c75 100644 --- a/common/database/traits/database_server_name.php +++ b/common/database/traits/database_server_name.php @@ -17,7 +17,7 @@ trait t_database_server_name { protected $server_name; /** - * Set the SERVER settings. + * Assign the settings. * * @param string|null $name * The server name to use. diff --git a/common/database/traits/database_server_options.php b/common/database/traits/database_server_options.php index 01d9f32..c4d3256 100644 --- a/common/database/traits/database_server_options.php +++ b/common/database/traits/database_server_options.php @@ -21,7 +21,7 @@ trait t_database_server_options { protected $server_options; /** - * Set the OPTIONS (...) settings. + * Assign the settings. * * @param int|null $option * The server option code to assign. diff --git a/common/database/traits/database_set_configuration_parameter.php b/common/database/traits/database_set_configuration_parameter.php index 520597b..d93e645 100644 --- a/common/database/traits/database_set_configuration_parameter.php +++ b/common/database/traits/database_set_configuration_parameter.php @@ -21,7 +21,7 @@ trait t_database_set_configuration_parameter { protected $set_configuration_parameter; /** - * Set the SET configuation parameter settings. + * Assign the settings. * * @param int|null $type * The SET code to assign. @@ -152,10 +152,10 @@ trait t_database_set_configuration_parameter { } } else if ($this->set_configuration_parameter['type'] == e_database_set::FROM_CURRENT) { - $value = c_database_string::SET . ' ' . $this->set_configuration_parameter['parameter'] . ' = ' . c_database_string::FROM_CURRENT; + $value = c_database_string::SET . ' ' . $this->set_configuration_parameter['parameter'] . ' = ' . c_database_string::FROM . ' ' . c_database_string::CURRENT; } else if ($this->set_configuration_parameter['type'] == e_database_set::TO_DEFAULT) { - $value = c_database_string::SET . ' ' . $this->set_configuration_parameter['parameter'] . ' ' . c_database_string::TO_DEFAULT; + $value = c_database_string::SET . ' ' . $this->set_configuration_parameter['parameter'] . ' ' . c_database_string::TO . ' ' . c_database_string::DEFAULT; } return $value; diff --git a/common/database/traits/database_set_operator.php b/common/database/traits/database_set_operator.php index 60af5a0..562e393 100644 --- a/common/database/traits/database_set_operator.php +++ b/common/database/traits/database_set_operator.php @@ -21,7 +21,7 @@ trait t_database_set_operator { protected $set_operator; /** - * Set the (operator) SET settings. + * Assign the settings. * * @param int|null $parameter * The SET code to assign. diff --git a/common/database/traits/database_set_publication_name.php b/common/database/traits/database_set_publication_name.php index 06f993d..8f16a83 100644 --- a/common/database/traits/database_set_publication_name.php +++ b/common/database/traits/database_set_publication_name.php @@ -19,7 +19,7 @@ trait t_database_set_publication_name { protected $set_publication_name; /** - * Set the SET PUBLICATION (name ...) settings. + * Assign the settings. * * @param string|null $name * The publication name. @@ -79,6 +79,6 @@ trait t_database_set_publication_name { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_set_publication_name() { - return c_database_string::SET_PUBLICATION . ' ' . implode(', ', $this->set_publication_name); + return c_database_string::SET . ' ' . c_database_string::PUBLICATION . ' ' . implode(', ', $this->set_publication_name); } } diff --git a/common/database/traits/database_set_publication_parameter.php b/common/database/traits/database_set_publication_parameter.php index 040efe0..89bab5c 100644 --- a/common/database/traits/database_set_publication_parameter.php +++ b/common/database/traits/database_set_publication_parameter.php @@ -22,7 +22,7 @@ trait t_database_set_publication_parameter { protected $set_publication_parameter; /** - * Set the SET (publication_parameter ...) settings. + * Assign the settings. * * @param int|null $parameter * The publication parameter code to assign. diff --git a/common/database/traits/database_set_schema.php b/common/database/traits/database_set_schema.php index 3fffb66..0824fc1 100644 --- a/common/database/traits/database_set_schema.php +++ b/common/database/traits/database_set_schema.php @@ -19,7 +19,7 @@ trait t_database_set_schema { protected $set_schema; /** - * Set the SET SCHEMA settings. + * Assign the settings. * * @param string|null $name * The schema name. @@ -82,6 +82,6 @@ trait t_database_set_schema { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_set_schema() { - return c_database_string::SET_SCHEMA . ' ' . $this->set_schema; + return c_database_string::SET . ' ' . c_database_string::SCHEMA . ' ' . $this->set_schema; } } diff --git a/common/database/traits/database_set_storage_parameter.php b/common/database/traits/database_set_storage_parameter.php index 48e002a..232dae9 100644 --- a/common/database/traits/database_set_storage_parameter.php +++ b/common/database/traits/database_set_storage_parameter.php @@ -21,7 +21,7 @@ trait t_database_set_storage_parameter { protected $set_storage_parameter; /** - * Set the SET index (storage_parameter ...) settings. + * Assign the settings. * * @param int|null $parameter * The storage parameter code to assign. diff --git a/common/database/traits/database_set_table.php b/common/database/traits/database_set_table.php index 89f761b..33d63eb 100644 --- a/common/database/traits/database_set_table.php +++ b/common/database/traits/database_set_table.php @@ -19,7 +19,7 @@ trait t_database_set_table { protected $set_table; /** - * Set the SET TABLE settings. + * Assign the settings. * * @param string|null $name * The table name. @@ -106,7 +106,7 @@ trait t_database_set_table { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_set_table() { - $value = c_database_string::SET_TABLE; + $value = c_database_string::SET . ' ' . c_database_string::TABLE; if ($this->set_table['only']) { $value .= ' ' . c_database_string::ONLY; diff --git a/common/database/traits/database_set_tablespace.php b/common/database/traits/database_set_tablespace.php index 81dfc44..c185045 100644 --- a/common/database/traits/database_set_tablespace.php +++ b/common/database/traits/database_set_tablespace.php @@ -19,7 +19,7 @@ trait t_database_set_tablespace { protected $set_tablespace; /** - * Set the SET TABLESPACE settings. + * Assign the settings. * * @param string|null $name * The tablespace name to set to. @@ -82,6 +82,6 @@ trait t_database_set_tablespace { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_set_tablespace() { - return c_database_string::SET_TABLESPACE . ' ' . $this->set_tablespace; + return c_database_string::SET . ' ' . c_database_string::TABLESPACE . ' ' . $this->set_tablespace; } } diff --git a/common/database/traits/database_set_view_option.php b/common/database/traits/database_set_view_option.php new file mode 100644 index 0000000..303bab3 --- /dev/null +++ b/common/database/traits/database_set_view_option.php @@ -0,0 +1,125 @@ +set_view_option = NULL; + return new c_base_return_true(); + } + + if ($type === e_database_view_option::CHECK_OPTION) { + if (!is_string($value)) { + $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'value', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + $placeholder_value = $this->add_placeholder($parameter); + if ($placeholder_value->has_error()) { + return c_base_return_error::s_false($placeholder_value->get_error()); + } + } + else if ($type === e_database_view_option::SECURITY_BARRIER) { + if (!is_bool($value)) { + $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'value', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $placeholder_value = $bool; + } + else { + $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'type', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $set_view_option = [ + 'type' => $type, + 'value' => $placeholder_value, + ]; + unset($placeholder_value); + + if (!is_array($this->set_view_option)) { + $this->set_view_option = []; + } + + $this->set_view_option[] = $set_view_option; + unset($set_view_option); + + return new c_base_return_true(); + } + + /** + * Get the currently assigned settings. + * + * @return c_base_return_array|c_base_return_null + * An array containing the settings. + * NULL is returned if not set. + * NULL with the error bit set is returned on error. + */ + public function get_set_view_option() { + if (is_null($this->set_view_option)) { + return new c_base_return_null(); + } + + if (is_array($this->set_view_option)) { + return c_base_return_array::s_new($this->set_view_option); + } + + $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'set_view_option', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE); + return c_base_return_error::s_null($error); + } + + /** + * Perform the common build process for this trait. + * + * As an internal trait method, the caller is expected to perform any appropriate validation. + * + * @return string|null + * A string is returned. + * NULL is returned if there is nothing to process or there is an error. + */ + protected function p_do_build_set_view_option() { + $values = []; + foreach ($this->set_view_option as $value) { + if ($value['type'] === e_database_view_option::CHECK_OPTION) { + $values[] = c_database_string::CHECK_OPTION .' = ' . $value['value']; + } + else if ($value['type'] === e_database_view_option::SECURITY_BARRIER) { + $values[] = c_database_string::SECURITY_BARRIER; + } + } + + return c_database_string::SET . ' (' . implode(', ', $values) . ')'; + } +} diff --git a/common/database/traits/database_set_with_oids.php b/common/database/traits/database_set_with_oids.php index 4b6efd2..a0b057d 100644 --- a/common/database/traits/database_set_with_oids.php +++ b/common/database/traits/database_set_with_oids.php @@ -19,7 +19,7 @@ trait t_database_set_with_oids { protected $set_with_oids; /** - * Set the SET WITH OIDS value. + * Assign the settings. * * @param bool|null $set_with_oids * Set to TRUE for SET WITH OIDS. @@ -46,7 +46,7 @@ trait t_database_set_with_oids { } /** - * Get the currently assigned set with oids status. + * Get the currently assigned settings. * * @return c_base_return_bool|c_base_return_null * TRUE for SET WITH OIDS or FALSE for SET WITHOUT OIDS on success. @@ -76,6 +76,6 @@ trait t_database_set_with_oids { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_set_with_oids() { - return $this->set_with_oids ? c_database_string::SET_WITH_OIDS : c_database_string::SET_WITHOUT_OIDS; + return $this->set_with_oids ? c_database_string::SET . ' ' . c_database_string::WITH . ' ' . c_database_string::OIDS : c_database_string::SET . ' ' . c_database_string::WITHOUT . ' ' . c_database_string::OIDS; } } diff --git a/common/database/traits/database_set_without_cluster.php b/common/database/traits/database_set_without_cluster.php index 170cf76..0a796e6 100644 --- a/common/database/traits/database_set_without_cluster.php +++ b/common/database/traits/database_set_without_cluster.php @@ -19,7 +19,7 @@ trait t_database_set_without_cluster { protected $set_without_cluster; /** - * Set the SET WITHOUT CLUSTER value. + * Assign the settings. * * @param bool|null $set_without_cluster * Set to TRUE for SET WITHOUT CLUSTER. @@ -46,7 +46,7 @@ trait t_database_set_without_cluster { } /** - * Get the currently assigned with grant option value. + * Get the currently assigned settings. * * @return c_base_return_bool|c_base_return_null * TRUE for SET WITHOUT CLUSTER on success. @@ -76,6 +76,6 @@ trait t_database_set_without_cluster { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_set_without_cluster() { - return $this->set_without_cluster ? c_database_string::SET_WITHOUT_CLUSTER : NULL; + return $this->set_without_cluster ? c_database_string::SET . ' ' . c_database_string::WITHOUT . ' ' . c_database_string::CLUSTER : NULL; } } diff --git a/common/database/traits/database_start_with.php b/common/database/traits/database_start_with.php index 6f36e9a..ae6eef9 100644 --- a/common/database/traits/database_start_with.php +++ b/common/database/traits/database_start_with.php @@ -17,7 +17,7 @@ trait t_database_start_with { protected $start_with; /** - * Set the START WITH settings. + * Assign the settings. * * @param int|null $value * A number representing the start with value. @@ -43,7 +43,7 @@ trait t_database_start_with { } /** - * Get the currently assigned start with value. + * Get the currently assigned settings. * * @return c_base_return_string|c_base_return_null * A number representing the start with value. @@ -73,6 +73,6 @@ trait t_database_start_with { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_start_with() { - return c_database_string::START_WITH . ' ' . $this->start_with; + return c_database_string::START . ' ' . c_database_string::WITH . ' ' . $this->start_with; } } diff --git a/common/database/traits/database_table_name.php b/common/database/traits/database_table_name.php new file mode 100644 index 0000000..d7a4f42 --- /dev/null +++ b/common/database/traits/database_table_name.php @@ -0,0 +1,85 @@ +table_name = NULL; + return new c_base_return_true(); + } + + if (is_string($name)) { + $placeholder = $this->add_placeholder($name); + if ($placeholder->has_error()) { + return c_base_return_error::s_false($placeholder->get_error()); + } + + $this->table_name = $placeholder; + unset($placeholder); + + return new c_base_return_true(); + } + + $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'name', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + /** + * Get the currently assigned settings. + * + * @return i_database_query_placeholder|c_base_return_null + * A name query placeholder on success. + * NULL is returned if not set. + * NULL with the error bit set is returned on error. + */ + public function get_table_name() { + if (is_null($this->table_name)) { + return new c_base_return_null(); + } + + if (isset($this->table_name)) { + return clone($this->table_name); + } + + $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'table_name', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE); + return c_base_return_error::s_null($error); + } + + /** + * Perform the common build process for this trait. + * + * As an internal trait method, the caller is expected to perform any appropriate validation. + * + * @return string|null + * A string is returned. + * NULL is returned if there is nothing to process or there is an error. + */ + protected function p_do_build_table_name() { + return strval($this->table_name); + } +} diff --git a/common/database/traits/database_to_role.php b/common/database/traits/database_to_role.php index 6ef7499..338dcf6 100644 --- a/common/database/traits/database_to_role.php +++ b/common/database/traits/database_to_role.php @@ -21,7 +21,7 @@ trait t_database_to_role { protected $to_role; /** - * Set the in schema, to roles. + * Assign the settings. * * @param int|null $role_type * The role type to use. @@ -74,7 +74,7 @@ trait t_database_to_role { } /** - * Get the in schema, to roles. + * Get the currently assigned settings. * * @return c_base_return_array|c_base_return_null * An array of to role arrays or NULL if not defined. diff --git a/common/database/traits/database_transaction_action.php b/common/database/traits/database_transaction_action.php new file mode 100644 index 0000000..4f536c6 --- /dev/null +++ b/common/database/traits/database_transaction_action.php @@ -0,0 +1,96 @@ +transaction_action = NULL; + return new c_base_return_true(); + } + + switch ($action) { + case e_database_transaction_action::TRANSACTION: + case e_database_transaction_action::WORK: + break; + + default: + $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'action', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->transaction_action = $action; + return new c_base_return_true(); + } + + /** + * Get the currently assigned settings. + * + * @return c_base_return_int|c_base_return_null + * A code representing the setting. + * NULL is returned if not set. + * NULL with the error bit set is returned on error. + */ + public function get_transaction_action() { + if (is_null($this->transaction_action)) { + return new c_base_return_null(); + } + + if (is_int($this->transaction_action)) { + return c_base_return_int::s_new($this->transaction_action); + } + + $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'transaction_action', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE); + return c_base_return_error::s_null($error); + } + + /** + * Perform the common build process for this trait. + * + * As an internal trait method, the caller is expected to perform any appropriate validation. + * + * @return string|null + * A string is returned. + * NULL is returned if there is nothing to process or there is an error. + */ + protected function p_do_build_transaction_action() { + $value = NULL; + + if ($this->transaction_action === e_database_transaction_action::TRANSACTION) { + $value = c_database_string::TRANSACTION; + } + else if ($this->transaction_action === e_database_transaction_action::WORK) { + $value = c_database_string::WORK; + } + + return $value; + } +} diff --git a/common/database/traits/database_transaction_mode.php b/common/database/traits/database_transaction_mode.php new file mode 100644 index 0000000..bf5d9c8 --- /dev/null +++ b/common/database/traits/database_transaction_mode.php @@ -0,0 +1,119 @@ +transaction_mode = NULL; + return new c_base_return_true(); + } + + switch ($action) { + case e_database_transaction_mode::DEFERRABLE: + case e_database_transaction_mode::ISOLATION_LEVEL_REPEATABLE_READ: + case e_database_transaction_mode::ISOLATION_LEVEL_READ_COMMITTED: + case e_database_transaction_mode::ISOLATION_LEVEL_READ_UNCOMMITTED: + case e_database_transaction_mode::ISOLATION_LEVEL_SERIALIZABLE: + case e_database_transaction_mode::NOT_DEFERRABLE: + case e_database_transaction_mode::READ_WRITE: + case e_database_transaction_mode::READ_ONLY: + break; + + default: + $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'action', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT); + return c_base_return_error::s_false($error); + } + + $this->transaction_mode = $action; + return new c_base_return_true(); + } + + /** + * Get the currently assigned settings. + * + * @return c_base_return_int|c_base_return_null + * A code representing the setting. + * NULL is returned if not set. + * NULL with the error bit set is returned on error. + */ + public function get_transaction_mode() { + if (is_null($this->transaction_mode)) { + return new c_base_return_null(); + } + + if (is_int($this->transaction_mode)) { + return c_base_return_int::s_new($this->transaction_mode); + } + + $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'transaction_mode', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE); + return c_base_return_error::s_null($error); + } + + /** + * Perform the common build process for this trait. + * + * As an internal trait method, the caller is expected to perform any appropriate validation. + * + * @return string|null + * A string is returned. + * NULL is returned if there is nothing to process or there is an error. + */ + protected function p_do_build_transaction_mode() { + $value = NULL; + + if ($this->transaction_mode === e_database_transaction_mode::DEFERRABLE) { + $value = c_database_string::DEFERRABLE; + } + else if ($this->transaction_mode === e_database_transaction_mode::ISOLATION_LEVEL_REPEATABLE_READ) { + $value = c_database_string::ISOLATION . ' ' . c_database_string::LEVEL . ' ' . c_database_string::REPEATABLE . ' ' . c_database_string::READ; + } + else if ($this->transaction_mode === e_database_transaction_mode::ISOLATION_LEVEL_READ_COMMITTED) { + $value = c_database_string::ISOLATION . ' ' . c_database_string::LEVEL . ' ' . c_database_string::READ . ' ' . c_database_string::COMMITTED; + } + else if ($this->transaction_mode === e_database_transaction_mode::ISOLATION_LEVEL_READ_UNCOMMITTED) { + $value = c_database_string::ISOLATION . ' ' . c_database_string::LEVEL . ' ' . c_database_string::READ . ' ' . c_database_string::UNCOMMITTED; + } + else if ($this->transaction_mode === e_database_transaction_mode::ISOLATION_LEVEL_SERIALIZABLE) { + $value = c_database_string::ISOLATION . ' ' . c_database_string::LEVEL . ' ' . c_database_string::SERIALIZABLE; + } + else if ($this->transaction_mode === e_database_transaction_mode::NOT_DEFERRABLE) { + $value = c_database_string::NOT . ' ' . c_database_string::DEFERRABLE; + } + else if ($this->transaction_mode === e_database_transaction_mode::READ_WRITE) { + $value = c_database_string::READ . ' ' . c_database_string::WRITE; + } + else if ($this->transaction_mode === e_database_transaction_mode::READ_ONLY) { + $value = c_database_string::READ . ' ' . c_database_string::ONLY; + } + return $value; + } +} diff --git a/common/database/traits/database_type_action.php b/common/database/traits/database_type_action.php index ed2a4c9..9d025d9 100644 --- a/common/database/traits/database_type_action.php +++ b/common/database/traits/database_type_action.php @@ -22,7 +22,7 @@ trait t_database_type_action { protected $type_action; /** - * Set the settings. + * Assign the settings. * * @param int|null $attribute * The attribute type to use from e_database_attribute_action. @@ -174,7 +174,7 @@ trait t_database_type_action { $value = NULL; if ($this->type_action['attribute'] === e_database_attribute_action::ADD) { - $value = c_database_string::ADD_ATTRIBUTE; + $value = c_database_string::ADD . ' ' . c_database_string::ATTRIBUTE; $value .= ' ' . $this->type_action['name']; $value .= ' ' . $this->type_action['data_type']; @@ -184,9 +184,9 @@ trait t_database_type_action { } } else if ($this->type_action['attribute'] === e_database_attribute_action::ALTER) { - $value = c_database_string::ALTER_ATTRIBUTE; + $value = c_database_string::ALTER . ' ' . c_database_string::ATTRIBUTE; $value .= ' ' . $this->type_action['name']; - $value .= ' ' . c_database_string::SET_DATA_TYPE; + $value .= ' ' . c_database_string::SET . ' ' . c_database_string::DATA . ' ' . c_database_string::TYPE; $value .= ' ' . $this->type_action['data_type']; if (isset($this->type_action['collation'])) { @@ -195,9 +195,9 @@ trait t_database_type_action { } } else if ($this->type_action['attribute'] === e_database_attribute_action::DROP) { - $value = c_database_string::DROP_ATTRIBUTE; + $value = c_database_string::DROP . ' ' . c_database_string::ATTRIBUTE; if ($this->type_action['if_exists']) { - $value .= ' ' . c_database_string::IF_EXISTS; + $value .= ' ' . c_database_string::IF . ' ' . c_database_string::EXISTS; } $value .= ' ' . $this->type_action['name']; diff --git a/common/database/traits/database_user_name.php b/common/database/traits/database_user_name.php index 936e87a..8aabd1b 100644 --- a/common/database/traits/database_user_name.php +++ b/common/database/traits/database_user_name.php @@ -21,7 +21,7 @@ trait t_database_user_name { protected $user_name; /** - * Set the user name. + * Assign the settings. * * @param int|null $type * The user name type to use, from e_database_user. @@ -104,13 +104,13 @@ trait t_database_user_name { $value = NULL; if ($this->user_name['type'] === e_database_user::CURRENT) { - $value = c_database_string::CURRENT_USER; + $value = c_database_string::CURRENT . ' ' . c_database_string::USER; } else if ($this->user_name['type'] === e_database_user::PUBLIC) { $value = c_database_string::PUBLIC; } else if ($this->user_name['type'] === e_database_user::SESSION) { - $value = c_database_string::SESSION_USER; + $value = c_database_string::SESSION . ' ' . c_database_string::USER; } else if ($this->user_name['type'] === e_database_user::NAME) { $value = $this->user_name['name']; diff --git a/common/database/traits/database_using_expression.php b/common/database/traits/database_using_expression.php index 4a389c2..2e28c9f 100644 --- a/common/database/traits/database_using_expression.php +++ b/common/database/traits/database_using_expression.php @@ -17,7 +17,7 @@ trait t_database_using_expression { protected $using_expression; /** - * Set the USING expression settings. + * Assign the settings. * * @param string|null $sql_expression * An SQL conditional expression. diff --git a/common/database/traits/database_using_index_method.php b/common/database/traits/database_using_index_method.php index 1057b9c..f22e113 100644 --- a/common/database/traits/database_using_index_method.php +++ b/common/database/traits/database_using_index_method.php @@ -17,7 +17,7 @@ trait t_database_using_index_method { protected $using_index_method; /** - * Set the USING settings. + * Assign the settings. * * @param string|null $using_index_method * The using_index_method to use. diff --git a/common/database/traits/database_validator.php b/common/database/traits/database_validator.php index 61a6c7f..77e9fe8 100644 --- a/common/database/traits/database_validator.php +++ b/common/database/traits/database_validator.php @@ -19,7 +19,7 @@ trait t_database_validator { protected $validator; /** - * Set the VALIDATOR settings. + * Assign the settings. * * @param int|null $validator * The integer representing validator/no-validator. @@ -107,7 +107,7 @@ trait t_database_validator { } } else if ($this->validator['type'] == e_database_validator::NO_VALIDATOR) { - $value = c_database_string::NO_VALIDATOR; + $value = c_database_string::NO . ' ' . c_database_string::VALIDATOR; } return $value; diff --git a/common/database/traits/database_version.php b/common/database/traits/database_version.php index 3f7d7ac..8d0db6d 100644 --- a/common/database/traits/database_version.php +++ b/common/database/traits/database_version.php @@ -17,7 +17,7 @@ trait t_database_version { protected $version; /** - * Set the VERSION settings. + * Assign the settings. * * @param string|null $version * The version to use. diff --git a/common/database/traits/database_wildcard.php b/common/database/traits/database_wildcard.php index 311351a..96be0f5 100644 --- a/common/database/traits/database_wildcard.php +++ b/common/database/traits/database_wildcard.php @@ -19,7 +19,7 @@ trait t_database_wildcard { protected $wildcard; /** - * Set the * value. + * Assign the settings. * * @param bool|null $wildcard * Set to TRUE for '*'. diff --git a/common/database/traits/database_with_check_expression.php b/common/database/traits/database_with_check_expression.php index 253197e..a83fbbf 100644 --- a/common/database/traits/database_with_check_expression.php +++ b/common/database/traits/database_with_check_expression.php @@ -17,7 +17,7 @@ trait t_database_with_check_expression { protected $with_check_expression; /** - * Set the WITH CHECK expression settings. + * Assign the settings. * * @param string|null $sql_expression * An SQL conditional expression. @@ -75,6 +75,6 @@ trait t_database_with_check_expression { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_with_check_expression() { - return c_database_string::WITH_CHECK . ' ' . $this->with_check_expression; + return c_database_string::WITH . ' ' . c_database_string::CHECK . ' ' . $this->with_check_expression; } } diff --git a/common/database/traits/database_with_dictionary.php b/common/database/traits/database_with_dictionary.php index f4356dd..2e1c722 100644 --- a/common/database/traits/database_with_dictionary.php +++ b/common/database/traits/database_with_dictionary.php @@ -19,7 +19,7 @@ trait t_database_with_dictionary { protected $with_dictionary; /** - * Set the WITH DICTIONARY settings. + * Assign the settings. * * @param string|null $name * The dictionary name. @@ -82,6 +82,6 @@ trait t_database_with_dictionary { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_with_dictionary() { - return c_database_string::WITH_DICTIONARY . ' ' . $this->with_dictionary; + return c_database_string::WITH . ' ' . c_database_string::DICTIONARY . ' ' . $this->with_dictionary; } } diff --git a/common/database/traits/database_with_grant_option.php b/common/database/traits/database_with_grant_option.php index 100f144..a9eb6c7 100644 --- a/common/database/traits/database_with_grant_option.php +++ b/common/database/traits/database_with_grant_option.php @@ -19,7 +19,7 @@ trait t_database_with_grant_option { protected $with_grant_option; /** - * Set the WITH GRANT OPTION value. + * Assign the settings. * * @param bool|null $with_grant_option * Set to TRUE for WITH GRANT OPTION. @@ -76,6 +76,6 @@ trait t_database_with_grant_option { * NULL is returned if there is nothing to process or there is an error. */ protected function p_do_build_with_grant_option() { - return $this->with_grant_option ? c_database_string::WITH_GRANT_OPTION : NULL; + return $this->with_grant_option ? c_database_string::WITH . ' ' . c_database_string::GRANT . ' ' . c_database_string::OPTION : NULL; } } diff --git a/common/database/traits/database_with_publication_option.php b/common/database/traits/database_with_publication_option.php index 34610fc..1082907 100644 --- a/common/database/traits/database_with_publication_option.php +++ b/common/database/traits/database_with_publication_option.php @@ -21,7 +21,7 @@ trait t_database_with_publication_option { protected $with_publication_option; /** - * Set the WITH (publication_option ...) settings. + * Assign the settings. * * @param int|null $option * The publication option code to assign. diff --git a/common/database/traits/database_with_refresh_option.php b/common/database/traits/database_with_refresh_option.php index 48bc402..20899e6 100644 --- a/common/database/traits/database_with_refresh_option.php +++ b/common/database/traits/database_with_refresh_option.php @@ -21,7 +21,7 @@ trait t_database_with_refresh_option { protected $with_refresh_option; /** - * Set the WITH (refresh_option ...) settings. + * Assign the settings. * * @param int|null $option * The refresh option code to assign. diff --git a/common/database/traits/database_with_role_option.php b/common/database/traits/database_with_role_option.php index 8ea1c07..caa0ad8 100644 --- a/common/database/traits/database_with_role_option.php +++ b/common/database/traits/database_with_role_option.php @@ -21,7 +21,7 @@ trait t_database_with_role_option { protected $with_role_option; /** - * Set the with role option. + * Assign the settings. * * @param int|null $type * The option type from e_database_role_option. @@ -186,16 +186,16 @@ trait t_database_with_role_option { $values[] = c_database_string::SUPERUSER; } else if ($role_option['type'] === e_database_role_option::CONNECTION_LIMIT) { - $values[] = c_database_string::CONNECTION_LIMIT . ' ' . $role_option['value']; + $values[] = c_database_string::CONNECTION . ' ' . c_database_string::LIMIT . ' ' . $role_option['value']; } else if ($role_option['type'] === e_database_role_option::PASSWORD) { $values[] = c_database_string::PASSWORD . ' ' . $role_option['value']; } else if ($role_option['type'] === e_database_role_option::PASSWORD_ENCRYPTED) { - $values[] = c_database_string::PASSWORD_ENCRYPTED . ' ' . $role_option['value']; + $values[] = c_database_string::PASSWORD . ' ' . c_database_string::ENCRYPTED . ' ' . $role_option['value']; } else if ($role_option['type'] === e_database_role_option::VALID_UNTIL) { - $values[] = c_database_string::VALID_UNTIL . ' ' . $role_option['value']; + $values[] = c_database_string::VALID . ' ' . c_database_string::UNTIL . ' ' . $role_option['value']; } } unset($role_option); diff --git a/common/database/traits/database_with_storage_parameter.php b/common/database/traits/database_with_storage_parameter.php index e2eb5a9..dbd43ec 100644 --- a/common/database/traits/database_with_storage_parameter.php +++ b/common/database/traits/database_with_storage_parameter.php @@ -21,7 +21,7 @@ trait t_database_with_storage_parameter { protected $with_storage_parameter; /** - * Set the WITH index (storage_parameter ...) settings. + * Assign the settings. * * @param int|null $parameter * The storage parameter code to assign.