From 2c7afdc644e27b6c077fb1139354be34a5003c76 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Mon, 13 Aug 2018 23:30:28 -0500 Subject: [PATCH] Progress: continue work on database Begin implementing query parameter class. Move numeration classes into explicit numeration directory and update class names. Continue refactoring database classes. --- .../database/classes/database_alter_database.php | 19 +- .../classes/database_alter_default_privileges.php | 95 ++-- common/database/classes/database_alter_domain.php | 61 +-- .../classes/database_alter_event_trigger.php | 20 +- .../database/classes/database_alter_extension.php | 2 +- .../database_alter_foreign_data_wrapper.php | 2 +- .../classes/database_alter_foreign_table.php | 2 +- .../database/classes/database_alter_function.php | 2 +- common/database/classes/database_alter_group.php | 2 +- common/database/classes/database_alter_index.php | 2 +- .../database/classes/database_alter_language.php | 2 +- .../classes/database_alter_large_object.php | 2 +- .../classes/database_alter_materialized_view.php | 2 +- .../database/classes/database_alter_operator.php | 2 +- .../classes/database_alter_operator_class.php | 2 +- .../classes/database_alter_operator_family.php | 2 +- common/database/classes/database_alter_policy.php | 2 +- .../classes/database_alter_publication.php | 2 +- common/database/classes/database_alter_role.php | 2 +- common/database/classes/database_alter_rule.php | 2 +- common/database/classes/database_alter_schema.php | 2 +- common/database/classes/database_alter_table.php | 2 +- .../database/classes/database_alter_tablespace.php | 2 +- .../database_alter_text_search_configuration.php | 2 +- .../database_alter_text_search_dictionary.php | 2 +- .../classes/database_alter_text_search_parser.php | 2 +- .../database_alter_text_search_template.php | 2 +- common/database/classes/database_alter_trigger.php | 2 +- common/database/classes/database_alter_type.php | 2 +- common/database/classes/database_alter_user.php | 2 +- .../classes/database_alter_user_mapping.php | 2 +- common/database/classes/database_alter_view.php | 2 +- common/database/classes/database_analyze.php | 2 +- common/database/classes/database_begin.php | 2 +- common/database/classes/database_checkpoint.php | 2 +- common/database/classes/database_close.php | 2 +- common/database/classes/database_cluster.php | 2 +- common/database/classes/database_code.php | 46 -- common/database/classes/database_comment.php | 2 +- common/database/classes/database_commit.php | 2 +- .../database/classes/database_commit_prepared.php | 2 +- common/database/classes/database_copy.php | 2 +- .../classes/database_create_access_method.php | 2 +- .../database/classes/database_create_aggregate.php | 2 +- common/database/classes/database_create_cast.php | 2 +- .../database/classes/database_create_collation.php | 2 +- .../classes/database_create_conversion.php | 2 +- .../database/classes/database_create_database.php | 2 +- common/database/classes/database_create_domain.php | 2 +- .../classes/database_create_event_trigger.php | 2 +- .../database/classes/database_create_extension.php | 2 +- .../database/classes/database_create_foreign.php | 2 +- .../database_create_foreign_data_wrapper.php | 2 +- .../database/classes/database_create_function.php | 2 +- common/database/classes/database_create_group.php | 2 +- common/database/classes/database_create_index.php | 2 +- .../database/classes/database_create_language.php | 2 +- .../classes/database_create_materialized_view.php | 2 +- .../database/classes/database_create_operator.php | 2 +- .../classes/database_create_operator_class.php | 2 +- .../classes/database_create_operator_family.php | 2 +- common/database/classes/database_create_policy.php | 2 +- .../classes/database_create_publication.php | 2 +- common/database/classes/database_create_role.php | 2 +- common/database/classes/database_create_rule.php | 2 +- common/database/classes/database_create_schema.php | 2 +- .../database/classes/database_create_sequence.php | 2 +- common/database/classes/database_create_server.php | 2 +- .../classes/database_create_statistics.php | 2 +- .../classes/database_create_subscription.php | 2 +- common/database/classes/database_create_table.php | 2 +- .../database/classes/database_create_table_as.php | 2 +- .../classes/database_create_tablespace.php | 2 +- .../database_create_text_search_configuration.php | 2 +- .../database_create_text_search_dictionary.php | 2 +- .../classes/database_create_text_search_parser.php | 2 +- .../database_create_text_search_template.php | 2 +- .../database/classes/database_create_transform.php | 2 +- .../database/classes/database_create_trigger.php | 2 +- common/database/classes/database_create_type.php | 2 +- common/database/classes/database_create_user.php | 2 +- .../classes/database_create_user_mapping.php | 2 +- common/database/classes/database_create_view.php | 2 +- common/database/classes/database_deallocate.php | 2 +- common/database/classes/database_declare.php | 2 +- common/database/classes/database_delete.php | 2 +- common/database/classes/database_discard.php | 2 +- common/database/classes/database_do.php | 2 +- .../classes/database_drop_access_method.php | 2 +- .../database/classes/database_drop_aggregate.php | 2 +- common/database/classes/database_drop_cast.php | 2 +- .../database/classes/database_drop_collation.php | 2 +- .../database/classes/database_drop_conversion.php | 2 +- common/database/classes/database_drop_database.php | 2 +- common/database/classes/database_drop_domain.php | 2 +- .../classes/database_drop_event_trigger.php | 2 +- .../database/classes/database_drop_extension.php | 2 +- .../classes/database_drop_foreign_data_wrapper.php | 2 +- .../classes/database_drop_foreign_table.php | 2 +- common/database/classes/database_drop_function.php | 2 +- common/database/classes/database_drop_group.php | 2 +- common/database/classes/database_drop_index.php | 2 +- common/database/classes/database_drop_language.php | 2 +- .../classes/database_drop_materialized_view.php | 2 +- common/database/classes/database_drop_operator.php | 2 +- .../classes/database_drop_operator_class.php | 2 +- .../classes/database_drop_operator_family.php | 2 +- common/database/classes/database_drop_owned.php | 2 +- common/database/classes/database_drop_policy.php | 2 +- .../database/classes/database_drop_publication.php | 2 +- common/database/classes/database_drop_role.php | 2 +- common/database/classes/database_drop_rule.php | 2 +- common/database/classes/database_drop_schema.php | 2 +- common/database/classes/database_drop_sequence.php | 2 +- common/database/classes/database_drop_server.php | 2 +- .../database/classes/database_drop_statistics.php | 2 +- .../classes/database_drop_subscription.php | 2 +- common/database/classes/database_drop_table.php | 2 +- .../database/classes/database_drop_tablespace.php | 2 +- .../database_drop_text_search_configuration.php | 2 +- .../database_drop_text_search_dictionary.php | 2 +- .../classes/database_drop_text_search_parser.php | 2 +- .../classes/database_drop_text_search_template.php | 2 +- .../database/classes/database_drop_transform.php | 2 +- common/database/classes/database_drop_trigger.php | 2 +- common/database/classes/database_drop_type.php | 2 +- common/database/classes/database_drop_user.php | 2 +- .../classes/database_drop_user_mapping.php | 2 +- common/database/classes/database_drop_view.php | 2 +- common/database/classes/database_end.php | 2 +- common/database/classes/database_execute.php | 2 +- common/database/classes/database_explain.php | 2 +- common/database/classes/database_fetch.php | 2 +- common/database/classes/database_grant.php | 2 +- .../classes/database_import_foreign_schema.php | 2 +- common/database/classes/database_insert.php | 2 +- common/database/classes/database_listen.php | 2 +- common/database/classes/database_load.php | 2 +- common/database/classes/database_lock.php | 2 +- common/database/classes/database_move.php | 2 +- common/database/classes/database_notify.php | 2 +- common/database/classes/database_prepare.php | 2 +- .../classes/database_prepare_transaction.php | 2 +- .../database/classes/database_query_parameter.php | 559 +++++++++++++++++++++ .../database/classes/database_reassign_owned.php | 2 +- .../classes/database_refresh_materialized.php | 2 +- common/database/classes/database_reindex.php | 2 +- .../classes/database_release_savepoint.php | 2 +- common/database/classes/database_reset.php | 2 +- common/database/classes/database_revoke.php | 2 +- common/database/classes/database_rollback.php | 2 +- .../classes/database_rollback_prepared.php | 2 +- .../classes/database_rollback_to_savepoint.php | 2 +- common/database/classes/database_savepoint.php | 2 +- .../database/classes/database_security_label.php | 2 +- common/database/classes/database_select.php | 2 +- common/database/classes/database_select_into.php | 2 +- common/database/classes/database_set.php | 2 +- .../database/classes/database_set_constraints.php | 2 +- common/database/classes/database_set_role.php | 2 +- .../classes/database_set_session_authorization.php | 2 +- .../database/classes/database_set_transaction.php | 2 +- common/database/classes/database_show.php | 2 +- .../classes/database_start_transaction.php | 2 +- common/database/classes/database_truncate.php | 2 +- common/database/classes/database_unlisten.php | 2 +- common/database/classes/database_update.php | 2 +- common/database/classes/database_vacuum.php | 2 +- common/database/classes/database_values.php | 2 +- common/database/enumerations/database_action.php | 29 ++ .../database/enumerations/database_direction.php | 17 + common/database/enumerations/database_on.php | 20 + common/database/enumerations/database_option.php | 17 + .../database/enumerations/database_privilege.php | 26 + common/database/enumerations/database_property.php | 19 + common/database/enumerations/database_reset.php | 17 + common/database/enumerations/database_set.php | 18 + common/database/enumerations/database_user.php | 18 + common/database/traits/database_action.php | 8 +- common/database/traits/database_group_by.php | 6 +- common/database/traits/database_order_by.php | 4 +- common/database/traits/database_owner_to.php | 13 +- common/database/traits/database_reset.php | 8 +- common/database/traits/database_set.php | 6 +- common/standard/classes/standard_database.php | 8 +- 185 files changed, 1021 insertions(+), 339 deletions(-) delete mode 100644 common/database/classes/database_code.php create mode 100644 common/database/classes/database_query_parameter.php create mode 100644 common/database/enumerations/database_action.php create mode 100644 common/database/enumerations/database_direction.php create mode 100644 common/database/enumerations/database_on.php create mode 100644 common/database/enumerations/database_option.php create mode 100644 common/database/enumerations/database_privilege.php create mode 100644 common/database/enumerations/database_property.php create mode 100644 common/database/enumerations/database_reset.php create mode 100644 common/database/enumerations/database_set.php create mode 100644 common/database/enumerations/database_user.php diff --git a/common/database/classes/database_alter_database.php b/common/database/classes/database_alter_database.php index 1f23293..888ddb4 100644 --- a/common/database/classes/database_alter_database.php +++ b/common/database/classes/database_alter_database.php @@ -8,6 +8,9 @@ namespace n_koopa; require_once('common/base/classes/base_error.php'); require_once('common/base/classes/base_return.php'); +require_once('common/database/enumerations/database_reset.php'); +require_once('common/database/enumerations/database_set.php'); + require_once('common/database/classes/database_query.php'); require_once('common/database/classes/database_string.php'); @@ -27,8 +30,8 @@ class c_database_alter_database extends c_database_query { use t_database_name; use t_database_rename_to; use t_database_owner_to; - use t_database_set_tablespace; use t_database_set; + use t_database_set_tablespace; use t_database_reset; protected const pr_QUERY_COMMAND = 'alter database'; @@ -44,8 +47,8 @@ class c_database_alter_database extends c_database_query { $this->query_name = NULL; $this->query_rename_to = NULL; $this->query_owner_to = NULL; - $this->query_set_tablespace = NULL; $this->query_set = NULL; + $this->query_set_tablespace = NULL; $this->query_set_parameter = NULL; $this->query_set_value = NULL; $this->query_reset = NULL; @@ -61,8 +64,8 @@ class c_database_alter_database extends c_database_query { unset($this->query_name); unset($this->query_rename_to); unset($this->query_owner_to); - unset($this->query_set_tablespace); unset($this->query_set); + unset($this->query_set_tablespace); unset($this->query_set_parameter); unset($this->query_set_value); unset($this->query_reset); @@ -166,7 +169,7 @@ class c_database_alter_database extends c_database_query { $this->value .= ' ' . c_database_string::SET_TABLESPACE . ' (' . $this->query_set_tablespace . ')'; } else if (is_int($this->query_set)) { - if ($this->query_set == c_database_code_set::TO) { + if ($this->query_set === e_database_set::TO) { if (is_null($this->query_set_parameter)) { $this->value .= ' ' . c_database_string::SET . ' ' . $this->query_set_parameter . ' ' . c_database_string::TO . ' ' . c_database_string::DEFAULT; } @@ -174,7 +177,7 @@ class c_database_alter_database extends c_database_query { $this->value .= ' ' . c_database_string::SET . ' ' . $this->query_set_parameter . ' ' . c_database_string::TO . ' ' . $this->query_set_value; } } - else if ($this->query_set == c_database_code_set::EQUAL) { + else if ($this->query_set === e_database_set::EQUAL) { if (is_null($this->query_set_parameter)) { $this->value .= ' ' . c_database_string::SET . ' ' . $this->query_set_parameter . ' = ' . c_database_string::DEFAULT; } @@ -182,19 +185,19 @@ class c_database_alter_database extends c_database_query { $this->value .= ' ' . c_database_string::SET . ' ' . $this->query_set_parameter . ' = ' . $this->query_set_value; } } - else if ($this->query_set == c_database_code_set::FROM_CURRENT) { + else if ($this->query_set == e_database_set::FROM_CURRENT) { if (is_string($this->query_set_parameter)) { $this->value .= ' ' . c_database_string::SET . ' ' . $this->query_set_parameter . ' = ' . c_database_string::FROM_CURRENT; } } } else if (is_string($this->query_reset)) { - if ($this->query_set == c_database_code_reset::PARAMETER) { + if ($this->query_set === e_database_reset::PARAMETER) { if (is_string($this->query_set_parameter)) { $this->value .= ' ' . c_database_string::RESET . ' ' . $this->query_set_parameter; } } - else if ($this->query_set == c_database_code_reset::ALL) { + else if ($this->query_set === e_database_reset::ALL) { $this->value .= ' ' . c_database_string::RESET . ' ' . c_database_string::ALL; } } diff --git a/common/database/classes/database_alter_default_privileges.php b/common/database/classes/database_alter_default_privileges.php index 8261d6d..c6c711e 100644 --- a/common/database/classes/database_alter_default_privileges.php +++ b/common/database/classes/database_alter_default_privileges.php @@ -8,6 +8,11 @@ namespace n_koopa; require_once('common/base/classes/base_error.php'); require_once('common/base/classes/base_return.php'); +require_once('common/database/enumerations/database_action.php'); +require_once('common/database/enumerations/database_on.php'); +require_once('common/database/enumerations/database_option.php'); +require_once('common/database/enumerations/database_privilege.php'); + require_once('common/database/classes/database_query.php'); require_once('common/database/traits/database_in_schema.php'); @@ -24,34 +29,6 @@ class c_database_alter_default_priveleges extends c_database_query { use t_database_action; use t_database_option; - public const ACTION_NONE = 0; - public const ACTION_GRANT = 1; - public const ACTION_REVOKE = 2; - - public const ON_NONE = 0; - public const ON_TABLES_TO = 1; - public const ON_SEQUENCES = 2; - public const ON_FUNCTIONS = 3; - public const ON_TYPES = 4; - public const ON_SCHEMAS = 5; - - public const PRIVILEGE_NONE = 0; - public const PRIVILEGE_SELECT = 1; - public const PRIVILEGE_INSERT = 2; - public const PRIVILEGE_UPDATE = 3; - public const PRIVILEGE_DELETE = 4; - public const PRIVILEGE_TRUNCATE = 5; - public const PRIVILEGE_REFERENCES = 6; - public const PRIVILEGE_TRIGGER = 7; - public const PRIVILEGE_USAGE = 8; - public const PRIVILEGE_EXECUTE = 9; - public const PRIVILEGE_CREATE = 10; - public const PRIVILEGE_ALL = 11; - - public const OPTION_NONE = 0; - public const OPTION_CASCADE = 1; - public const OPTION_RESTRICT = 2; - protected const pr_QUERY_COMMAND = 'alter default privileges'; protected $abbreviated; @@ -198,11 +175,11 @@ class c_database_alter_default_priveleges extends c_database_query { } switch ($on) { - case static::ON_TABLES_TO: - case static::ON_SEQUENCES: - case static::ON_FUNCTIONS: - case static::ON_TYPES: - case static::ON_SCHEMAS: + case e_database_on::TABLES_TO: + case e_database_on::SEQUENCES: + case e_database_on::FUNCTIONS: + case e_database_on::TYPES: + case e_database_on::SCHEMAS: $this->on = $on; return new c_base_return_true(); default: @@ -456,8 +433,8 @@ class c_database_alter_default_priveleges extends c_database_query { } switch ($this->query_action) { - case static::ACTION_GRANT: - case static::ACTION_REVOKE: + case e_database_action::_GRANT: + case e_database_action::_REVOKE: break; default: return new c_base_return_false(); @@ -491,10 +468,10 @@ class c_database_alter_default_priveleges extends c_database_query { unset($names); } - if ($this->query_action === static::ACTION_GRANT) { + if ($this->query_action === e_database_action::ACTION_GRANT) { $this->value .= ' ' . c_database_string::GRANT; } - else if ($this->query_action === static::ACTION_REVOKE) { + else if ($this->query_action === e_database_action::ACTION_REVOKE) { $this->value .= ' ' . c_database_string::REVOKE; if ($this->option_grant) { @@ -507,37 +484,37 @@ class c_database_alter_default_priveleges extends c_database_query { foreach ($this->privileges as $privilege) { $privileges .= ', '; switch ($privilege) { - case static::PRIVILEGE_SELECT: + case e_database_privilege::SELECT: $privileges .= c_database_string::SELECT; break; - case static::PRIVILEGE_INSERT: + case e_database_privilege::INSERT: $privileges .= c_database_string::INSERT; break; - case static::PRIVILEGE_UPDATE: + case e_database_privilege::UPDATE: $privileges .= c_database_string::UPDATE; break; - case static::PRIVILEGE_DELETE: + case e_database_privilege::DELETE: $privileges .= c_database_string::DELETE; break; - case static::PRIVILEGE_TRUNCATE: + case e_database_privilege::TRUNCATE: $privileges .= c_database_string::TRUNCATE; break; - case static::PRIVILEGE_REFERENCES: + case e_database_privilege::REFERENCES: $privileges .= c_database_string::REFERENCES; break; - case static::PRIVILEGE_TRIGGER: + case e_database_privilege::TRIGGER: $privileges .= c_database_string::TRIGGER; break; - case static::PRIVILEGE_USAGE: + case e_database_privilege::USAGE: $privileges .= c_database_string::USAGE; break; - case static::PRIVILEGE_EXECUTE: + case e_database_privilege::EXECUTE: $privileges .= c_database_string::EXECUTE; break; - case static::PRIVILEGE_CREATE: + case e_database_privilege::CREATE: $privileges .= c_database_string::CREATE; break; - case static::PRIVILEGE_ALL: + case e_database_privilege::ALL: $privileges .= c_database_string::ALL; break; default: @@ -550,28 +527,28 @@ class c_database_alter_default_priveleges extends c_database_query { // ON ... switch($this->on) { - case static::ON_TABLES_TO: + case e_database_on::TABLES_TO: $this->value .= ' ' . c_database_string::ON_TABLES_TO; break; - case static::ON_SEQUENCES: + case e_database_on::SEQUENCES: $this->value .= ' ' . c_database_string::ON_SEQUENCES; break; - case static::ON_FUNCTIONS: + case e_database_on::FUNCTIONS: $this->value .= ' ' . c_database_string::ON_FUNCTIONS; break; - case static::ON_TYPES: + case e_database_on::TYPES: $this->value .= ' ' . c_database_string::ON_TYPES; break; - case static::ON_SCHEMAS: + case e_database_on::SCHEMAS: $this->value .= ' ' . c_database_string::ON_SCHEMAS; break; } // [ TO | FROM ] ... role names ... - if ($this->query_action === static::ACTION_GRANT) { + if ($this->query_action === e_database_action::GRANT) { $this->value .= ' ' . c_database_string::TO; } - else if ($this->query_action === static::ACTION_REVOKE) { + else if ($this->query_action === e_database_action::REVOKE) { $this->value .= ' ' . c_database_string::FROM; } @@ -585,18 +562,18 @@ class c_database_alter_default_priveleges extends c_database_query { } unset($role_name); - if ($this->query_action === static::ACTION_GRANT) { + if ($this->query_action === e_database_action::GRANT) { // [ WITH GRANT OPTION ] if ($this->option_grant) { $this->value .= ' ' . c_database_string::WITH_GRANT_OPTION; } } - else if ($this->query_action === static::ACTION_REVOKE) { + else if ($this->query_action === e_database_action::REVOKE) { // [ CASCADE | RESTRICT ] - if ($this->query_option === static::OPTION_CASCADE) { + if ($this->query_option === e_database_option::CASCADE) { $this->value .= ' ' . c_database_string::CASCADE; } - else if ($this->query_option === static::OPTION_RESTRICT) { + else if ($this->query_option === e_database_option::RESTRICT) { $this->value .= ' ' . c_database_string::RESTRICT; } } diff --git a/common/database/classes/database_alter_domain.php b/common/database/classes/database_alter_domain.php index 5d71104..73da8f7 100644 --- a/common/database/classes/database_alter_domain.php +++ b/common/database/classes/database_alter_domain.php @@ -8,9 +8,13 @@ namespace n_koopa; require_once('common/base/classes/base_error.php'); require_once('common/base/classes/base_return.php'); +require_once('common/database/enumerations/database_action.php'); +require_once('common/database/enumerations/database_option.php'); +require_once('common/database/enumerations/database_property.php'); + require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER DOMAIN query string. @@ -28,27 +32,6 @@ class c_database_alter_coalation extends c_database_query { use t_database_property; use t_database_option; - public const ACTION_NONE = 0; - public const ACTION_ADD = 1; - public const ACTION_DROP = 2; - public const ACTION_DROP_CONSTRAINT = 3; - public const ACTION_DROP_DEFAULT = 4; - public const ACTION_OWNER_TO = 5; - public const ACTION_RENAME_CONSTRAINT = 6; - public const ACTION_RENAME_TO = 7; - public const ACTION_SET = 8; - public const ACTION_SET_DEFAULT = 9; - public const ACTION_SET_SCHEMA = 10; - public const ACTION_VALIDATE_CONSTRAINT = 11; - - public const PROPERTY_NONE = 0; - public const PROPERTY_NOT_VALID = 1; - public const PROPERTY_IF_EXISTS = 2; - - public const OPTION_NONE = 0; - public const OPTION_CASCADE = 1; - public const OPTION_RESTRICT = 2; - protected const pr_QUERY_COMMAND = 'alter domain'; protected $expression; @@ -246,7 +229,7 @@ class c_database_alter_coalation extends c_database_query { $action = NULL; switch ($this->query_action) { - case static::ACTION_ADD: + case e_database_action::ADD: if (!is_string($this->constraint)) { unset($action); return new c_base_return_false(); @@ -255,44 +238,44 @@ class c_database_alter_coalation extends c_database_query { $action = c_database_string::ADD; $action .= ' ' . $this->constraint; - if ($this->property === static::PROPERTY_NOT_VALID) { + if ($this->property === e_database_property::NOT_VALID) { $action .= ' ' . c_database_string::NOT_VALID; } break; - case static::ACTION_DROP: + case e_database_action::DROP: $action = c_database_string::DROP; - if ($this->property === static::PROPERTY_NOT_NULL) { + if ($this->property === e_database_property::NOT_NULL) { $action .= ' ' . c_database_string::NOT_NULL; } break; - case static::ACTION_DROP_CONSTRAINT: + case e_database_action::DROP_CONSTRAINT: if (!is_string($this->constraint)) { unset($action); return new c_base_return_false(); } $action = c_database_string::DROP_CONSTRAINT; - if ($this->property === static::PROPERTY_IF_EXISTS) { + if ($this->property === e_database_property::IF_EXISTS) { $action .= ' ' . c_database_string::IF_EXISTS; } $action .= ' ' . $this->constraint; - if ($this->option === static::OPTION_RESTRICT) { + if ($this->option === e_database_option::RESTRICT) { $action .= ' ' . c_database_string::RESTRICT; } - else if ($this->option === static::OPTION_CASCADE) { + else if ($this->option === e_database_option::CASCADE) { $action .= ' ' . c_database_string::CASCADE; } break; - case static::ACTION_DROP_DEFAULT: + case e_database_action::DROP_DEFAULT: $action = c_database_string::DROP_DEFAULT; break; - case static::ACTION_OWNER_TO: + case e_database_action::OWNER_TO: if (!is_string($this->query_owner_to_user_name)) { unset($action); return new c_base_return_false(); @@ -301,7 +284,7 @@ class c_database_alter_coalation extends c_database_query { $action = c_database_string::OWNER_TO . ' (' . $this->query_owner_to_user_name . ')'; break; - case static::ACTION_RENAME_CONSTRAINT: + case e_database_action::RENAME_CONSTRAINT: if (!is_string($this->constraint) || !is_string($this->constraint_new)) { unset($action); return new c_base_return_false(); @@ -310,7 +293,7 @@ class c_database_alter_coalation extends c_database_query { $action = c_database_string::RENAME_CONSTRAINT . ' ' . $this->constraint . ' ' . c_database_string::TO . ' ' . $this->constraint_new; break; - case static::ACTION_RENAME_TO: + case e_database_action::RENAME_TO: if (!is_string($this->query_rename_to)) { unset($action); return new c_base_return_false(); @@ -319,14 +302,14 @@ class c_database_alter_coalation extends c_database_query { $action = c_database_string::RENAME_TO . ' (' . $this->query_rename_to . ')'; break; - case static::ACTION_SET: + case e_database_action::SET: $action = c_database_string::SET; - if ($this->property === static::PROPERTY_NOT_NULL) { + if ($this->property === e_database_property::NOT_NULL) { $action .= ' ' . c_database_string::NOT_NULL; } break; - case static::ACTION_SET_DEFAULT: + case e_database_action::SET_DEFAULT: if (!is_string($this->expression)) { unset($action); return new c_base_return_false(); @@ -335,7 +318,7 @@ class c_database_alter_coalation extends c_database_query { $action = c_database_string::SET_DEFAULT . ' ' . $this->expression; break; - case static::ACTION_SET_SCHEMA: + case e_database_action::SET_SCHEMA: if (!is_string($this->query_set_schema)) { unset($action); return new c_base_return_false(); @@ -344,7 +327,7 @@ class c_database_alter_coalation extends c_database_query { $action = ' ' . c_database_string::SET_SCHEMA . ' (' . $this->query_set_schema . ')'; break; - case static::ACTION_VALIDATE_CONSTRAINT: + case e_database_action::VALIDATE_CONSTRAINT: if (!is_string($this->constraint)) { unset($action); return new c_base_return_false(); diff --git a/common/database/classes/database_alter_event_trigger.php b/common/database/classes/database_alter_event_trigger.php index 98f4f0e..aa3d720 100644 --- a/common/database/classes/database_alter_event_trigger.php +++ b/common/database/classes/database_alter_event_trigger.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER EVENT TRIGGER query string. @@ -20,6 +20,12 @@ require_once('common/base/traits/base_query.php'); * @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html */ class c_database_alter_coalation extends c_database_query { + use t_database_action; + use t_database_action_property; + use t_database_name; + use t_database_owner_to; + use t_database_rename_to; + protected const pr_QUERY_COMMAND = 'alter event trigger'; @@ -28,12 +34,24 @@ class c_database_alter_coalation extends c_database_query { */ public function __construct() { parent::__construct(); + + $this->query_action = NULL; + $this->query_action_property = NULL; + $this->query_name = NULL; + $this->query_owner_to = NULL; + $this->query_rename_to = NULL; } /** * Class destructor. */ public function __destruct() { + unset($this->query_action); + unset($this->query_action_property); + unset($this->query_name); + unset($this->query_owner_to); + unset($this->query_rename_to); + parent::__destruct(); } diff --git a/common/database/classes/database_alter_extension.php b/common/database/classes/database_alter_extension.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_extension.php +++ b/common/database/classes/database_alter_extension.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_foreign_data_wrapper.php b/common/database/classes/database_alter_foreign_data_wrapper.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_foreign_data_wrapper.php +++ b/common/database/classes/database_alter_foreign_data_wrapper.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_foreign_table.php b/common/database/classes/database_alter_foreign_table.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_foreign_table.php +++ b/common/database/classes/database_alter_foreign_table.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_function.php b/common/database/classes/database_alter_function.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_function.php +++ b/common/database/classes/database_alter_function.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_group.php b/common/database/classes/database_alter_group.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_group.php +++ b/common/database/classes/database_alter_group.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_index.php b/common/database/classes/database_alter_index.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_index.php +++ b/common/database/classes/database_alter_index.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_language.php b/common/database/classes/database_alter_language.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_language.php +++ b/common/database/classes/database_alter_language.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_large_object.php b/common/database/classes/database_alter_large_object.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_large_object.php +++ b/common/database/classes/database_alter_large_object.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_materialized_view.php b/common/database/classes/database_alter_materialized_view.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_materialized_view.php +++ b/common/database/classes/database_alter_materialized_view.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_operator.php b/common/database/classes/database_alter_operator.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_operator.php +++ b/common/database/classes/database_alter_operator.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_operator_class.php b/common/database/classes/database_alter_operator_class.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_operator_class.php +++ b/common/database/classes/database_alter_operator_class.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_operator_family.php b/common/database/classes/database_alter_operator_family.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_operator_family.php +++ b/common/database/classes/database_alter_operator_family.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_policy.php b/common/database/classes/database_alter_policy.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_policy.php +++ b/common/database/classes/database_alter_policy.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_publication.php b/common/database/classes/database_alter_publication.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_publication.php +++ b/common/database/classes/database_alter_publication.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_role.php b/common/database/classes/database_alter_role.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_role.php +++ b/common/database/classes/database_alter_role.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_rule.php b/common/database/classes/database_alter_rule.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_rule.php +++ b/common/database/classes/database_alter_rule.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_schema.php b/common/database/classes/database_alter_schema.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_schema.php +++ b/common/database/classes/database_alter_schema.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_table.php b/common/database/classes/database_alter_table.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_table.php +++ b/common/database/classes/database_alter_table.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_tablespace.php b/common/database/classes/database_alter_tablespace.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_tablespace.php +++ b/common/database/classes/database_alter_tablespace.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_text_search_configuration.php b/common/database/classes/database_alter_text_search_configuration.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_text_search_configuration.php +++ b/common/database/classes/database_alter_text_search_configuration.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_text_search_dictionary.php b/common/database/classes/database_alter_text_search_dictionary.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_text_search_dictionary.php +++ b/common/database/classes/database_alter_text_search_dictionary.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_text_search_parser.php b/common/database/classes/database_alter_text_search_parser.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_text_search_parser.php +++ b/common/database/classes/database_alter_text_search_parser.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_text_search_template.php b/common/database/classes/database_alter_text_search_template.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_text_search_template.php +++ b/common/database/classes/database_alter_text_search_template.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_trigger.php b/common/database/classes/database_alter_trigger.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_trigger.php +++ b/common/database/classes/database_alter_trigger.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_type.php b/common/database/classes/database_alter_type.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_type.php +++ b/common/database/classes/database_alter_type.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_user.php b/common/database/classes/database_alter_user.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_user.php +++ b/common/database/classes/database_alter_user.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_user_mapping.php b/common/database/classes/database_alter_user_mapping.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_user_mapping.php +++ b/common/database/classes/database_alter_user_mapping.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_alter_view.php b/common/database/classes/database_alter_view.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_alter_view.php +++ b/common/database/classes/database_alter_view.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_analyze.php b/common/database/classes/database_analyze.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_analyze.php +++ b/common/database/classes/database_analyze.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_begin.php b/common/database/classes/database_begin.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_begin.php +++ b/common/database/classes/database_begin.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_checkpoint.php b/common/database/classes/database_checkpoint.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_checkpoint.php +++ b/common/database/classes/database_checkpoint.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_close.php b/common/database/classes/database_close.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_close.php +++ b/common/database/classes/database_close.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_cluster.php b/common/database/classes/database_cluster.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_cluster.php +++ b/common/database/classes/database_cluster.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_code.php b/common/database/classes/database_code.php deleted file mode 100644 index f862448..0000000 --- a/common/database/classes/database_code.php +++ /dev/null @@ -1,46 +0,0 @@ -value = $value; + return TRUE; + } + + /** + * Assign the value at a specific index in the array. + * + * @param i_base_query_parameter $value + * Any i_base_query_parameter implementation to be assigned at the specified position in the array. + * @param int|string $key + * A key to assign a specific value to. + * + * @return bool + * TRUE on success, FALSE otherwise. + * FALSE is returned if value is not of type i_base_query_parameter. + */ + public function set_value_at($value, $key) { + if (!($value instanceof i_base_query_parameter)) { + return FALSE; + } + + return parent::set_value_at($value, $key); + } + + /** + * Append the value at the end of the array. + * + * @param i_base_query_parameter $value + * Any i_base_query_parameter to be appended in the array. + * + * @return bool + * TRUE on success, FALSE otherwise. + * FALSE is returned if value is not of type i_base_query_parameter. + */ + public function set_value_append($value) { + if (!($value instanceof i_base_query_parameter)) { + return FALSE; + } + + return parent::set_value_append($value); + } + + /** + * Assigns the array from a serialized array string. + * + * @param string $serialized + * A serialized string to convert to an array. + * + * @return bool + * TRUE on success, FALSE otherwise. + * if converted string does not produce an array, FALSE is returned and value is set to an empty array. + * FALSE is returned if any value in the array is not of type i_base_query_parameter. + * + * @see: unserialize() + */ + public function set_value_serialized($serialized) { + if (!is_string($serialized)) { + return FALSE; + } + + $unserialized = unserialize($serialized); + if (is_array($unserialized)) { + // guarantee that only i_base_query_parameter are assigend in the array. + foreach ($unserialized as $v) { + if (!($v instanceof i_base_query_parameter)) { + unset($v); + return FALSE; + } + } + unset($v); + + $this->value = $unserialized; + unset($unserialized); + + return TRUE; + } + unset($unserialized); + + $this->value = []; + return FALSE; + } + + /** + * Returns the data as a json-serialized array string. + * + * @param string $jsonized + * A jsonized string to convert to an array. + * @param bool $associative + * (optional) When TRUE array is return as an associative array. + * @param int $options + * (optional) bitmask of json constants. + * @param int $depth + * (optional) Maximum array depth. + * + * @return bool + * TRUE on success, FALSE otherwise. + * if converted string does not produce an array, FALSE is returned and value is set to an empty array. + * FALSE is returned if any value in the array is not of type i_base_query_parameter. + * + * @see: json_decode() + */ + public function set_value_jsonized($jsonized, $associative = TRUE, $options = 0, $depth = 512) { + if (!is_string($jsonized)) { + return FALSE; + } + + if (!is_bool($associative)) { + $associative = TRUE; + } + + if (!is_int($options)) { + $options = 0; + } + + if (!is_int($depth) || $depth < 1) { + $depth = 512; + } + + $decoded = json_decode($jsonized, $associative, $options, $depth); + if (is_array($decoded)) { + // guarantee that only i_base_query_parameter are assigend in the array. + foreach ($unserialized as $v) { + if (!($v instanceof i_base_query_parameter)) { + unset($v); + return FALSE; + } + } + unset($v); + + $this->value = $decoded; + unset($decoded); + + return TRUE; + } + unset($decoded); + + $this->value = []; + return FALSE; + } +} + +/** + * A query parameter representing an array of query parameters, stored in this object as an array. + * + * All array values must be an implementation of type i_database_query_parameter. + * + * @see: c_base_return_array + */ +class c_database_query_parameter_set extends c_base_return_array implements i_database_query_parameter { + + /** + * @see: t_base_return_value::p_s_new() + */ + public static function s_new($value) { + return self::p_s_new($value, __CLASS__); + } + + /** + * @see: t_base_return_value::p_s_value() + */ + public static function s_value($return) { + return self::p_s_value($return, __CLASS__); + } + + /** + * @see: t_base_return_value_exact::p_s_value_exact() + */ + public static function s_value_exact($return) { + return self::p_s_value_exact($return, __CLASS__, []); + } + + /** + * Assign the value. + * + * @param array $value + * Any value so long as it is an array. + * NULL is not allowed. + * + * @return bool + * TRUE on success, FALSE otherwise. + * FALSE is returned if any value in the array is not of type i_base_query_parameter. + */ + public function set_value($value) { + if (!is_array($value)) { + return FALSE; + } + + // guarantee that only i_base_query_parameter are assigend in the array. + foreach ($value as $v) { + if (!($v instanceof i_base_query_parameter)) { + unset($v); + return FALSE; + } + } + unset($v); + + $this->value = $value; + return TRUE; + } + + /** + * Assign the value at a specific index in the array. + * + * @param i_base_query_parameter $value + * Any i_base_query_parameter implementation to be assigned at the specified position in the array. + * @param int|string $key + * A key to assign a specific value to. + * + * @return bool + * TRUE on success, FALSE otherwise. + * FALSE is returned if value is not of type i_base_query_parameter. + */ + public function set_value_at($value, $key) { + if (!($value instanceof i_base_query_parameter)) { + return FALSE; + } + + return parent::set_value_at($value, $key); + } + + /** + * Append the value at the end of the array. + * + * @param i_base_query_parameter $value + * Any i_base_query_parameter to be appended in the array. + * + * @return bool + * TRUE on success, FALSE otherwise. + * FALSE is returned if value is not of type i_base_query_parameter. + */ + public function set_value_append($value) { + if (!($value instanceof i_base_query_parameter)) { + return FALSE; + } + + return parent::set_value_append($value); + } + + /** + * Assigns the array from a serialized array string. + * + * @param string $serialized + * A serialized string to convert to an array. + * + * @return bool + * TRUE on success, FALSE otherwise. + * if converted string does not produce an array, FALSE is returned and value is set to an empty array. + * FALSE is returned if any value in the array is not of type i_base_query_parameter. + * + * @see: unserialize() + */ + public function set_value_serialized($serialized) { + if (!is_string($serialized)) { + return FALSE; + } + + $unserialized = unserialize($serialized); + if (is_array($unserialized)) { + // guarantee that only i_base_query_parameter are assigend in the array. + foreach ($unserialized as $v) { + if (!($v instanceof i_base_query_parameter)) { + unset($v); + return FALSE; + } + } + unset($v); + + $this->value = $unserialized; + unset($unserialized); + + return TRUE; + } + unset($unserialized); + + $this->value = []; + return FALSE; + } + + /** + * Returns the data as a json-serialized array string. + * + * @param string $jsonized + * A jsonized string to convert to an array. + * @param bool $associative + * (optional) When TRUE array is return as an associative array. + * @param int $options + * (optional) bitmask of json constants. + * @param int $depth + * (optional) Maximum array depth. + * + * @return bool + * TRUE on success, FALSE otherwise. + * if converted string does not produce an array, FALSE is returned and value is set to an empty array. + * FALSE is returned if any value in the array is not of type i_base_query_parameter. + * + * @see: json_decode() + */ + public function set_value_jsonized($jsonized, $associative = TRUE, $options = 0, $depth = 512) { + if (!is_string($jsonized)) { + return FALSE; + } + + if (!is_bool($associative)) { + $associative = TRUE; + } + + if (!is_int($options)) { + $options = 0; + } + + if (!is_int($depth) || $depth < 1) { + $depth = 512; + } + + $decoded = json_decode($jsonized, $associative, $options, $depth); + if (is_array($decoded)) { + // guarantee that only i_base_query_parameter are assigend in the array. + foreach ($unserialized as $v) { + if (!($v instanceof i_base_query_parameter)) { + unset($v); + return FALSE; + } + } + unset($v); + + $this->value = $decoded; + unset($decoded); + + return TRUE; + } + unset($decoded); + + $this->value = []; + return FALSE; + } +} diff --git a/common/database/classes/database_reassign_owned.php b/common/database/classes/database_reassign_owned.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_reassign_owned.php +++ b/common/database/classes/database_reassign_owned.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_refresh_materialized.php b/common/database/classes/database_refresh_materialized.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_refresh_materialized.php +++ b/common/database/classes/database_refresh_materialized.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_reindex.php b/common/database/classes/database_reindex.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_reindex.php +++ b/common/database/classes/database_reindex.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_release_savepoint.php b/common/database/classes/database_release_savepoint.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_release_savepoint.php +++ b/common/database/classes/database_release_savepoint.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_reset.php b/common/database/classes/database_reset.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_reset.php +++ b/common/database/classes/database_reset.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_revoke.php b/common/database/classes/database_revoke.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_revoke.php +++ b/common/database/classes/database_revoke.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_rollback.php b/common/database/classes/database_rollback.php index 7cd92a5..2aa118c 100644 --- a/common/database/classes/database_rollback.php +++ b/common/database/classes/database_rollback.php @@ -12,7 +12,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ROLLBACK query string. diff --git a/common/database/classes/database_rollback_prepared.php b/common/database/classes/database_rollback_prepared.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_rollback_prepared.php +++ b/common/database/classes/database_rollback_prepared.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_rollback_to_savepoint.php b/common/database/classes/database_rollback_to_savepoint.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_rollback_to_savepoint.php +++ b/common/database/classes/database_rollback_to_savepoint.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_savepoint.php b/common/database/classes/database_savepoint.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_savepoint.php +++ b/common/database/classes/database_savepoint.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_security_label.php b/common/database/classes/database_security_label.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_security_label.php +++ b/common/database/classes/database_security_label.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_select.php b/common/database/classes/database_select.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_select.php +++ b/common/database/classes/database_select.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_select_into.php b/common/database/classes/database_select_into.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_select_into.php +++ b/common/database/classes/database_select_into.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_set.php b/common/database/classes/database_set.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_set.php +++ b/common/database/classes/database_set.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_set_constraints.php b/common/database/classes/database_set_constraints.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_set_constraints.php +++ b/common/database/classes/database_set_constraints.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_set_role.php b/common/database/classes/database_set_role.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_set_role.php +++ b/common/database/classes/database_set_role.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_set_session_authorization.php b/common/database/classes/database_set_session_authorization.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_set_session_authorization.php +++ b/common/database/classes/database_set_session_authorization.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_set_transaction.php b/common/database/classes/database_set_transaction.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_set_transaction.php +++ b/common/database/classes/database_set_transaction.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_show.php b/common/database/classes/database_show.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_show.php +++ b/common/database/classes/database_show.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_start_transaction.php b/common/database/classes/database_start_transaction.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_start_transaction.php +++ b/common/database/classes/database_start_transaction.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_truncate.php b/common/database/classes/database_truncate.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_truncate.php +++ b/common/database/classes/database_truncate.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_unlisten.php b/common/database/classes/database_unlisten.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_unlisten.php +++ b/common/database/classes/database_unlisten.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_update.php b/common/database/classes/database_update.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_update.php +++ b/common/database/classes/database_update.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_vacuum.php b/common/database/classes/database_vacuum.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_vacuum.php +++ b/common/database/classes/database_vacuum.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/classes/database_values.php b/common/database/classes/database_values.php index 92ac008..4fe2fc8 100644 --- a/common/database/classes/database_values.php +++ b/common/database/classes/database_values.php @@ -10,7 +10,7 @@ require_once('common/base/classes/base_return.php'); require_once('common/database/classes/database_query.php'); -require_once('common/base/traits/base_query.php'); +require_once('common/database/traits/database_query.php'); /** * The class for building and returning a Postgresql ALTER COALATION query string. diff --git a/common/database/enumerations/database_action.php b/common/database/enumerations/database_action.php new file mode 100644 index 0000000..5868fcd --- /dev/null +++ b/common/database/enumerations/database_action.php @@ -0,0 +1,29 @@ +query_action_property)) { return new c_base_return_null(); } diff --git a/common/database/traits/database_group_by.php b/common/database/traits/database_group_by.php index 0aad14d..ab720e5 100644 --- a/common/database/traits/database_group_by.php +++ b/common/database/traits/database_group_by.php @@ -19,7 +19,7 @@ trait t_database_group_by { protected $query_group_by; /** - * Set the RENAME TO settings. + * Set the GROUP BY settings. * * @param string|null $group_by * The name to rename to. @@ -45,11 +45,11 @@ trait t_database_group_by { } /** - * Get the currently assigned name to rename to. + * Get the currently assigned name to group by. * * @return c_base_return_string|c_base_return_null * A name on success. - * NULL is returned if not set (rename to is not to be used). + * NULL is returned if not set (group by is not to be used). * NULL with the error bit set is returned on error. */ public function get_query_group_by() { diff --git a/common/database/traits/database_order_by.php b/common/database/traits/database_order_by.php index 5798fe8..0176a09 100644 --- a/common/database/traits/database_order_by.php +++ b/common/database/traits/database_order_by.php @@ -45,11 +45,11 @@ trait t_database_order_by { } /** - * Get the currently assigned name to rename to. + * Get the currently assigned name to order by. * * @return c_base_return_string|c_base_return_null * A name on success. - * NULL is returned if not set (rename to is not to be used). + * NULL is returned if not set (order by to is not to be used). * NULL with the error bit set is returned on error. */ public function get_query_order_by() { diff --git a/common/database/traits/database_owner_to.php b/common/database/traits/database_owner_to.php index 4b343c2..6162f3f 100644 --- a/common/database/traits/database_owner_to.php +++ b/common/database/traits/database_owner_to.php @@ -12,6 +12,9 @@ namespace n_koopa; require_once('common/base/classes/base_error.php'); require_once('common/base/classes/base_return.php'); +require_once('common/database/enumerations/database_owner_to.php'); +require_once('common/database/enumerations/database_user.php'); + require_once('common/database/classes/database_string.php'); /** @@ -26,7 +29,7 @@ trait t_database_owner_to { * * @param int|null $owner_to * The owner type to assign. - * Should be one of: c_database_code_user. + * Should be one of: e_database_user. * Set to NULL to disable. * @param string|null $user_name * (optional) When non-NULL this is the database user name. @@ -48,7 +51,7 @@ trait t_database_owner_to { return c_base_return_error::s_false($error); } - if ($owner_type == c_database_code_user::USER_NAME) { + if ($owner_type == e_database_user::NAME) { if (!is_null($user_name) && !is_string($user_name)) { $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'user_name', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT); return c_base_return_error::s_false($error); @@ -67,10 +70,10 @@ trait t_database_owner_to { $this->query_owner_to = $owner_to; $this->query_owner_to_user_name = NULL; - if ($owner_type == c_database_code_user::USER_CURRENT) { + if ($owner_type == e_database_user::CURRENT) { $this->query_owner_to_user_name = c_database_string::USER_CURRENT; } - else if ($owner_type == c_database_code_user::USER_SESSION) { + else if ($owner_type == e_database_user::SESSION) { $this->query_owner_to_user_name = c_database_string::USER_SESSION; } @@ -81,7 +84,7 @@ trait t_database_owner_to { * Get the currently assigned sql owner to. * * @return c_base_return_int|c_base_return_null - * A (c_database_code_user) code representing the owner on success. + * A (e_database_user) code representing the owner on success. * NULL without error bit set is returned if not assigned. * NULL with the error bit set is returned on error. */ diff --git a/common/database/traits/database_reset.php b/common/database/traits/database_reset.php index a7d097b..1d8c753 100644 --- a/common/database/traits/database_reset.php +++ b/common/database/traits/database_reset.php @@ -12,6 +12,8 @@ namespace n_koopa; require_once('common/base/classes/base_error.php'); require_once('common/base/classes/base_return.php'); +require_once('common/database/enumerations/database_reset.php'); + require_once('common/database/classes/database_code.php'); /** @@ -26,7 +28,7 @@ trait t_database_reset { * * @param int|null $reset * The reset code to assign. - * Should be one of: c_database_code_reset. + * Should be one of: e_database_reset. * Set to NULL to disable. * @param string|null $parameter * (optional) When non-NULL this is the configuration parameter. @@ -48,7 +50,7 @@ trait t_database_reset { return c_base_return_error::s_false($error); } - if ($reset == c_database_code_reset::PARAMETER) { + if ($reset == e_database_reset::PARAMETER) { if (!is_null($parameter) || !is_string($parameter)) { $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'parameter', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT); return c_base_return_error::s_false($error); @@ -58,7 +60,7 @@ trait t_database_reset { $this->query_reset_parameter = $parameter; return new c_base_return_true(); } - else if ($reset == c_database_code_reset::ALL) { + else if ($reset == e_database_reset::ALL) { $this->query_reset = $reset; $this->query_reset_parameter = NULL; return new c_base_return_true(); diff --git a/common/database/traits/database_set.php b/common/database/traits/database_set.php index d7b2053..93837f4 100644 --- a/common/database/traits/database_set.php +++ b/common/database/traits/database_set.php @@ -12,6 +12,8 @@ namespace n_koopa; require_once('common/base/classes/base_error.php'); require_once('common/base/classes/base_return.php'); +require_once('common/database/enumerations/database_set.php'); + require_once('common/database/classes/database_code.php'); /** @@ -53,7 +55,7 @@ trait t_database_set { return c_base_return_error::s_false($error); } - if ($set == c_database_code_set::TO || $set == c_database_code_set::EQUAL) { + if ($set == e_database_set::TO || $set == e_database_set::EQUAL) { if (!is_null($parameter) || !is_string($parameter)) { $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'parameter', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT); return c_base_return_error::s_false($error); @@ -69,7 +71,7 @@ trait t_database_set { $this->query_set_value = $value; return new c_base_return_true(); } - else if ($set == c_database_code_set::FROM_CURRENT) { + else if ($set == e_database_set::FROM_CURRENT) { $this->query_set = $set; $this->query_set_parameter = NULL; $this->query_set_value = NULL; diff --git a/common/standard/classes/standard_database.php b/common/standard/classes/standard_database.php index 63bd050..a31b378 100644 --- a/common/standard/classes/standard_database.php +++ b/common/standard/classes/standard_database.php @@ -37,7 +37,7 @@ class c_standard_database extends c_base_database { $query_parameters[8] = $response_code; if ($log_type === c_base_log::TYPE_CONNECT) { - $query_parameters[0] = "Logging in to the system."; + $query_parameters[0] = 'Logging in to the system.'; $query_parameters[1] = c_base_log::TYPE_SESSION; $query_parameters[2] = c_base_log::TYPE_CONNECT; $query_parameters[3] = c_base_error::SEVERITY_INFORMATIONAL; @@ -63,7 +63,7 @@ class c_standard_database extends c_base_database { } } else if ($log_type === c_base_log::TYPE_DISCONNECT) { - $query_parameters[0] = "Logging out of the system."; + $query_parameters[0] = 'Logging out of the system.'; $query_parameters[1] = c_base_log::TYPE_SESSION; $query_parameters[2] = c_base_log::TYPE_DISCONNECT; $query_parameters[3] = c_base_error::SEVERITY_INFORMATIONAL; @@ -71,7 +71,7 @@ class c_standard_database extends c_base_database { $query_parameters[9] = NULL; } else if ($log_type === c_base_log::TYPE_CREATE) { - $query_parameters[0] = "Created the user account."; + $query_parameters[0] = 'Created the user account.'; $query_parameters[1] = c_base_log::TYPE_CREATE; $query_parameters[2] = c_base_log::TYPE_NONE; $query_parameters[3] = c_base_error::SEVERITY_INFORMATIONAL; @@ -84,7 +84,7 @@ class c_standard_database extends c_base_database { $user_name = $data['user_name']; } - $query_parameters[0] = "Failed to login as the user ':{user_name}'."; + $query_parameters[0] = 'Failed to login as the user \':{user_name}\'.'; $query_parameters[1] = c_base_log::TYPE_CONNECT; $query_parameters[2] = c_base_log::TYPE_FAILURE; $query_parameters[3] = c_base_error::SEVERITY_NOTICE; -- 1.8.3.1