use t_database_owner_to;
use t_database_set_schema;
- protected const pr_QUERY_COMMAND = 'alter aggregate';
+ protected const p_QUERY_COMMAND = 'alter aggregate';
// @todo: move these into their own traits.
protected $aggregate_signatures;
}
unset($aggregate_signatures);
- $this->value = static::pr_QUERY_COMMAND;
+ $this->value = static::p_QUERY_COMMAND;
$this->value .= ' ' . $this->name;
$this->value .= ' ' . $action;
unset($action);
use t_database_owner_to;
use t_database_set_schema;
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* Class constructor.
return new c_base_return_false();
}
- $this->value = static::pr_QUERY_COMMAND;
+ $this->value = static::p_QUERY_COMMAND;
$this->value .= ' ' . $this->name;
$this->value .= ' ' . $action;
unset($action);
use t_database_owner_to;
use t_database_set_schema;
- protected const pr_QUERY_COMMAND = 'alter conversion';
+ protected const p_QUERY_COMMAND = 'alter conversion';
/**
return new c_base_return_false();
}
- $this->value = static::pr_QUERY_COMMAND;
+ $this->value = static::p_QUERY_COMMAND;
$this->value .= ' ' . $this->name;
$this->value .= ' ' . $action;
unset($action);
use t_database_set_tablespace;
use t_database_reset;
- protected const pr_QUERY_COMMAND = 'alter database';
+ protected const p_QUERY_COMMAND = 'alter database';
protected $option;
return new c_base_return_false();
}
- $this->value = static::pr_QUERY_COMMAND;
+ $this->value = static::p_QUERY_COMMAND;
$this->value .= ' ' . $this->name;
$this->value .= ' ' . $action;
unset($action);
use t_database_in_schema;
use t_database_action;
- protected const pr_QUERY_COMMAND = 'alter default privileges';
+ protected const p_QUERY_COMMAND = 'alter default privileges';
protected $abbreviated;
protected $cascade;
}
}
- $this->value = static::pr_QUERY_COMMAND;
+ $this->value = static::p_QUERY_COMMAND;
$this->value .= ' ' . $this->name;
$this->value .= ' ' . $action;
unset($action);
use t_database_set_schema;
use t_database_action;
- protected const pr_QUERY_COMMAND = 'alter domain';
+ protected const p_QUERY_COMMAND = 'alter domain';
protected $expression;
protected $constraint;
return new c_base_return_false();
}
- $this->value = static::pr_QUERY_COMMAND;
+ $this->value = static::p_QUERY_COMMAND;
$this->value .= ' ' . $this->name;
$this->value .= ' ' . $action;
unset($action);
use t_database_owner_to;
use t_database_rename_to;
- protected const pr_QUERY_COMMAND = 'alter event trigger';
+ protected const p_QUERY_COMMAND = 'alter event trigger';
/**
return new c_base_return_false();
}
- $this->value = static::pr_QUERY_COMMAND;
+ $this->value = static::p_QUERY_COMMAND;
$this->value .= ' ' . $action;
unset($action);
use t_database_action_parameter;
use t_database_name;
- protected const pr_QUERY_COMMAND = 'alter extension';
+ protected const p_QUERY_COMMAND = 'alter extension';
protected $member_object;
use t_database_rename_to;
use t_database_validator;
- protected const pr_QUERY_COMMAND = 'alter foreign data wrapper';
+ protected const p_QUERY_COMMAND = 'alter foreign data wrapper';
/**
$actions .= ' ' . $this->p_do_build_options();
}
- $this->value = static::pr_QUERY_COMMAND;
+ $this->value = static::p_QUERY_COMMAND;
$this->value .= ' ' . $this->name;
$this->value .= ' ' . $action;
unset($action);
<?php
/**
* @file
- * Provides a class for specific Postgesql query: ALTER COALATION.
+ * Provides a class for specific Postgesql query: ALTER FOREIGN TABLE.
*/
namespace n_koopa;
require_once('common/base/classes/base_error.php');
require_once('common/base/classes/base_return.php');
+require_once('common/database/classes/database_alter_foeign_table_action.php');
require_once('common/database/classes/database_query.php');
-require_once('common/database/traits/database_action.php');
require_once('common/database/traits/database_name.php');
-require_once('common/database/traits/database_options.php');
-require_once('common/database/traits/database_owner_to.php');
require_once('common/database/traits/database_rename_column.php');
require_once('common/database/traits/database_rename_to.php');
require_once('common/database/traits/database_set_schema.php');
-require_once('common/database/traits/database_set_with_oids.php');
/**
* The class for building and returning a Postgresql ALTER FOREIGN TABLE query string.
* @see: https://www.postgresql.org/docs/current/static/sql-alterforeigntable.html
*/
class c_database_alter_foreign_table extends c_database_query {
- use t_database_action;
use t_database_name;
- use t_database_options;
- use t_database_owner_to;
use t_database_rename_column;
use t_database_rename_to;
use t_database_set_schema;
- use t_database_set_with_oids;
- protected const pr_QUERY_COMMAND = 'alter foreign table';
+ protected const p_QUERY_COMMAND = 'alter foreign table';
+ protected $actions;
protected $if_exists;
protected $include_descendents; // The '*' following 'name'
protected $only;
public function __construct() {
parent::__construct();
- $this->action = NULL;
$this->name = NULL;
- $this->options = NULL;
- $this->owner_to = NULL;
$this->rename_column = NULL;
$this->rename_to = NULL;
$this->set_schema = NULL;
- $this->set_with_oids = NULL;
+ $this->actions = NULL;
$this->if_exists = NULL;
$this->include_descendents = NULL;
$this->only = NULL;
public function __destruct() {
parent::__destruct();
- unset($this->action);
unset($this->name);
- unset($this->options);
- unset($this->owner_to);
unset($this->rename_column);
unset($this->rename_to);
unset($this->set_schema);
- unset($this->set_with_oids);
+ unset($this->actions);
unset($this->if_exists);
unset($this->include_descendents);
unset($this->only);
}
/**
+ * Set or append and action.
+ *
+ * @param c_database_alter_foreign_table_action|null $action
+ * A specific action to this class.
+ * Set to NULL to disable.
+ * When NULL, this will remove all actions.
+ *
+ * @return c_base_return_status
+ * TRUE on success, FALSE otherwise.
+ * FALSE with error bit set is returned on error.
+ */
+ public function set_action($action) {
+ if (is_null($action)) {
+ $this->actions = NULL;
+ return new c_base_return_true();
+ }
+
+ if (is_string($action)) {
+ if (!is_array($this->actions)) {
+ $this->actions = [];
+ }
+
+ $this->actions[] = $action;
+ }
+ else {
+ $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);
+ }
+
+ return new c_base_return_true();
+ }
+
+ /**
* Assigns IF EXISTS.
*
* @param bool|null $if_exists
}
/**
+ * Get an action or all actions.
+ *
+ * @param int|null $index
+ * (optional) Get the action at the specified index.
+ * When NULL, all actions are returned.
+ *
+ * @return c_database_alter_foreign_table_action|c_base_return_array|c_base_return_null
+ * An array of actions or NULL if not defined.
+ * A single action is returned if $index is an integer.
+ * NULL with the error bit set is returned on error.
+ */
+ public function get_action($index = NULL) {
+ if (is_null($this->actions)) {
+ return new c_base_return_null();
+ }
+
+ if (is_null($index)) {
+ if (is_array($this->actions)) {
+ return c_base_return_array::s_new($this->actions);
+ }
+ }
+ else {
+ if (is_int($index) && array_key_exists($index, $this->actions) && $this->actions[$index] instanceof c_database_alter_foreign_table_action) {
+ return $this->actions[$index];
+ }
+
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'actions[index]', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE);
+ return c_base_return_error::s_null($error);
+ }
+
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'actions', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE);
+ return c_base_return_error::s_null($error);
+ }
+
+ /**
+ * Get the if exists setting.
+ *
+ * @return c_base_return_bool|c_base_return_null
+ * A boolean representing the IF EXISTS setting.
+ * NULL is returned if not defined.
+ * NULL with the error bit set is returned on error.
+ */
+ public function get_if_exists($index = NULL) {
+ if (is_null($this->if_exists)) {
+ return new c_base_return_null();
+ }
+
+ if (is_bool($index)) {
+ return c_base_return_bool::s_new($this->if_exists);
+ }
+
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'if_exists', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE);
+ return c_base_return_error::s_null($error);
+ }
+
+ /**
+ * Get the include decendents setting.
+ *
+ * @return c_base_return_bool|c_base_return_null
+ * A boolean representing the '*' setting.
+ * NULL is returned if not defined.
+ * NULL with the error bit set is returned on error.
+ */
+ public function get_include_decendents($index = NULL) {
+ if (is_null($this->include_decendents)) {
+ return new c_base_return_null();
+ }
+
+ if (is_bool($index)) {
+ return c_base_return_bool::s_new($this->include_decendents);
+ }
+
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'include_decendents', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE);
+ return c_base_return_error::s_null($error);
+ }
+
+ /**
+ * Get the set only setting.
+ *
+ * @return c_base_return_bool|c_base_return_null
+ * A boolean representing the ONLY setting.
+ * NULL is returned if not defined.
+ * NULL with the error bit set is returned on error.
+ */
+ public function get_set_only($index = NULL) {
+ if (is_null($this->set_only)) {
+ return new c_base_return_null();
+ }
+
+ if (is_bool($index)) {
+ return c_base_return_bool::s_new($this->set_only);
+ }
+
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'set_only', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE);
+ return c_base_return_error::s_null($error);
+ }
+
+ /**
* Implements do_build().
*/
public function do_build() {
return new c_base_return_false();
}
- $action = NULL;
+ $value = NULL;
if ($this->if_exists) {
- $action = ' ' . c_database_string::IF_EXISTS;
+ $value = ' ' . c_database_string::IF_EXISTS;
}
if (is_array($this->rename_column)) {
if ($this->only) {
- $action .= is_null($action) ? '' : ' ';
- $action .= c_database_string::ONLY;
+ $value .= is_null($value) ? '' : ' ';
+ $value .= c_database_string::ONLY;
}
- $action .= ' ' . $this->p_do_build_rename_column();
+ $value .= ' ' . $this->p_do_build_rename_column();
}
else if (is_array($this->rename_to)) {
- $action .= is_null($action) ? '' : ' ';
- $action .= $this->p_do_build_rename_to();
+ $value .= is_null($value) ? '' : ' ';
+ $value .= $this->p_do_build_rename_to();
}
else if (is_array($this->set_schema)) {
- $action .= is_null($action) ? '' : ' ';
- $action .= $this->p_do_build_set_schema();
+ $value .= is_null($value) ? '' : ' ';
+ $value .= $this->p_do_build_set_schema();
}
else {
if ($this->only) {
- $action .= is_null($action) ? '' : ' ';
- $action .= c_database_string::ONLY;
+ $value .= is_null($value) ? '' : ' ';
+ $value .= c_database_string::ONLY;
}
- $action .= is_null($action) ? '' : ' ';
- // @todo
-
-// sub-forms:
-// ADD COLUMN
-// DROP COLUMN
-// SET DATA TYPE
-// SET DEFAULT
-// SET NOT NULL
-// SET STATISTICS
-// SET
-// RESET
-// SET STORAGE
-// ADD ...
-// VALIDATE CONSTRAINT
-// DROP CONSTRAINT
-// DISABLE/ENABLE
-// SET WITH OIDS
-// SET WITHOUT OIDS
-// INHERIT
-// NO INHERIT
-// OWNER
-// OPTIONS
-// RENAME
-// SET SCHEMA
- else if (is_bool($this->set_with_oids)) {
- $action .= $this->p_do_build_set_with_oids();
- }
- else if (is_array($this->inherit)) {
- $action .= $this->p_do_build_inherit();
- }
- else if (is_array($this->owner_to)) {
- $action .= $this->p_do_build_owner_to();
- }
- else if (is_array($this->options)) {
- $action .= $this->p_do_build_options();
+ $value .= is_null($value) ? '' : ' ';
+ if (is_array($this->actions) && !empty($this->actions)) {
+ $actions = [];
+ foreach ($this->actions as $action) {
+ if ($action instanceof c_database_alter_foreign_table_action && $action->do_build() instanceof c_base_return_true) {
+ $actions[] = $action->get_value_exact();
+ }
+ }
+ unset($action);
+
+ $value .= implode(', ', $actions);
+ unset($actions);
}
else {
- unset($action);
+ unset($value);
return new c_base_return_false();
}
}
- $this->value = static::pr_QUERY_COMMAND;
+ $this->value = static::p_QUERY_COMMAND;
$this->value .= ' ' . $this->name;
if ($this->include_descendents) {
$this->value .' *';
}
- $this->value .= ' ' . $action;
- unset($action);
+ $this->value .= ' ' . $value;
+ unset($value);
return new c_base_return_true();
}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides a class for specific Postgesql query: ALTER FOREIGN TABLE action.
+ */
+namespace n_koopa;
+
+require_once('common/base/classes/base_error.php');
+require_once('common/base/classes/base_return.php');
+
+require_once('common/database/classes/database_query.php');
+
+require_once('common/database/traits/database_add_column.php');
+require_once('common/database/traits/database_alter_column.php');
+require_once('common/database/traits/database_constraint.php');
+require_once('common/database/traits/database_drop_column.php');
+require_once('common/database/traits/database_enable_trigger.php');
+require_once('common/database/traits/database_inherit.php');
+require_once('common/database/traits/database_options.php');
+require_once('common/database/traits/database_owner_to.php');
+require_once('common/database/traits/database_set_with_oids.php');
+
+/**
+ * The class for building and returning a Postgresql ALTER FOREIGN TABLE action query string.
+ *
+ * @see: https://www.postgresql.org/docs/current/static/sql-alterforeigntable.html
+ */
+class c_database_alter_foreign_table_action extends c_database_query {
+ use t_database_add_column;
+ use t_database_alter_column;
+ use t_database_constraint;
+ use t_database_drop_column;
+ use t_database_enable_trigger;
+ use t_database_inherit;
+ use t_database_options;
+ use t_database_owner_to;
+ use t_database_set_with_oids;
+
+ protected const p_QUERY_COMMAND = '';
+
+ /**
+ * Class constructor.
+ */
+ public function __construct() {
+ parent::__construct();
+
+ $this->add_column = NULL;
+ $this->alter_column = NULL;
+ $this->constraint = NULL;
+ $this->drop_column = NULL;
+ $this->enable_trigger = NULL;
+ $this->inherit = NULL;
+ $this->options = NULL;
+ $this->owner_to = NULL;
+ $this->set_with_oids = NULL;
+ }
+
+ /**
+ * Class destructor.
+ */
+ public function __destruct() {
+ parent::__destruct();
+
+ unset($this->add_column);
+ unset($this->alter_column);
+ unset($this->constaint);
+ unset($this->drop_column);
+ unset($this->enable_trigger);
+ unset($this->inherit);
+ unset($this->options);
+ unset($this->owner_to);
+ unset($this->set_with_oids);
+ }
+
+ /**
+ * @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__, '');
+ }
+
+ /**
+ * Implements do_build().
+ */
+ public function do_build() {
+ $value = NULL;
+ if (is_array($this->add_column)) {
+ $value = $this->p_do_build_add_column();
+ }
+ else if (is_array($this->alter_column)) {
+ $value = $this->p_do_build_alter_column();
+ }
+ else if (is_array($this->constraint)) {
+ $value = $this->p_do_build_constraint();
+ }
+ else if (is_array($this->drop_column)) {
+ $value = $this->p_do_build_drop_column();
+ }
+ else if (is_array($this->enable_trigger)) {
+ $value = $this->p_do_build_enable_trigger();
+ }
+ else if (is_array($this->inherit)) {
+ $value = $this->p_do_build_inherit();
+ }
+ else if (is_array($this->options)) {
+ $value = '(' . $this->p_do_build_options() . ')';
+ }
+ else if (is_array($this->owner_to)) {
+ $value = $this->p_do_build_owner_to();
+ }
+ else if (is_bool($this->set_with_oids)) {
+ $value = $this->p_do_build_set_with_oids();
+ }
+ else {
+ unset($value);
+ return new c_base_return_false();
+ }
+
+ $this->value = static::p_QUERY_COMMAND;
+ $this->value .= ' ' . $value;
+ unset($value);
+
+ return new c_base_return_true();
+ }
+}
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
use t_database_action_parameter;
use t_database_name;
- protected const pr_QUERY_COMMAND = '';
+ protected const p_QUERY_COMMAND = '';
/**
return new c_base_return_false();
}
- $this->value = static::pr_QUERY_COMMAND;
+ $this->value = static::p_QUERY_COMMAND;
$this->value .= ' ' . $action;
unset($action);
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
abstract class c_database_query extends c_base_return_string implements i_database_query {
public const PARAMETER_NONE = 0;
- protected const pr_QUERY_COMMAND = '';
+ protected const p_QUERY_COMMAND = '';
protected $placeholders;
* Implements do_build().
*/
public function do_build() {
- $this->value = static::pr_QUERY_COMMAND;
+ $this->value = static::p_QUERY_COMMAND;
return new c_base_return_true();
}
* Provide an SQL expression argument.
*/
class c_database_argument_expression extends c_base_return_string implements i_database_query_parameter {
- protected const pr_QUERY_AS = 'as';
+ protected const p_QUERY_AS = 'as';
protected $expression;
protected $alias;
$this->value = $this->expression;
if (!is_string($this->alias)) {
- $this->value .= ' ' . static::pr_QUERY_AS . ' ' . $this->alias;
+ $this->value .= ' ' . static::p_QUERY_AS . ' ' . $this->alias;
}
return new c_base_return_true();
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-rollback.html
*/
class c_database_rollback extends c_database_query {
- protected const pr_QUERY_COMMAND = 'rollback';
+ protected const p_QUERY_COMMAND = 'rollback';
/**
* @see: t_base_return_value::p_s_new()
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
public const CREATE = 'create';
public const DELETE = 'delete';
public const DESCEND = 'desc';
+ public const DISABLE_TRIGGER = 'disable trigger';
public const DOMAIN = 'domain';
public const DROP = 'drop';
public const DROP_CONSTRAINT = 'drop constraint';
public const DROP_DEFAULT = 'drop default';
+ public const ENABLE_ALWAYS_TRIGGER = 'enable always trigger';
+ public const ENABLE_REPLICA_TRIGGER = 'enable replica trigger';
+ public const ENABLE_TRIGGER = 'enable trigger';
public const EVENT_TRIGGER = 'event trigger';
public const EXECUTE = 'execute';
public const FALSE = 'false';
public const TO = 'to';
public const UPDATE = 'update';
public const USAGE = 'usage';
+ public const USER = 'user';
public const USER_CURRENT = 'current_user';
public const USER_SESSION = 'session_user';
public const USING = 'using';
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
* @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
*/
class c_database_alter_coalation extends c_database_query {
- protected const pr_QUERY_COMMAND = 'alter coalation';
+ protected const p_QUERY_COMMAND = 'alter coalation';
/**
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides enumeration classes for managing codes used for generating specific Postgesql Queries.
+ *
+ * @see: https://www.postgresql.org/docs/current/static/sql-commands.html
+ */
+namespace n_koopa;
+
+/**
+ * Codes associated with database constaint.
+ */
+class e_database_constaint {
+ public const NONE = 0;
+ public const ADD = 1;
+ public const DROP = 2;
+ public const VALIDATE = 3;
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides enumeration classes for managing codes used for generating specific Postgesql Queries.
+ *
+ * @see: https://www.postgresql.org/docs/current/static/sql-commands.html
+ */
+namespace n_koopa;
+
+/**
+ * Codes associated with postgresql enable/disable trigger information.
+ */
+class e_database_enable_trigger {
+ public const NONE = 0;
+ public const ALL = 1;
+ public const ALWAYS = 2;
+ public const NAME = 3;
+ public const REPLICA = 4;
+ public const USER = 5;
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides traits for specific Postgesql Queries.
+ *
+ * These traits are associated with actions.
+ *
+ * @see: https://www.postgresql.org/docs/current/static/sql-commands.html
+ */
+namespace n_koopa;
+
+require_once('common/base/classes/base_error.php');
+require_once('common/base/classes/base_return.php');
+
+require_once('common/database/classes/database_string.php');
+
+require_once('common/database/enumerations/database_cascade.php');
+require_once('common/database/enumerations/database_constraint.php');
+
+/**
+ * Provide the sql ADD/VALIDATE/DROP CONSTAINT functionality.
+ */
+trait t_database_constraint {
+ protected $constraint;
+
+ /**
+ * Set the ADD/VALIDATE/DROP CONSTRAINT settings.
+ *
+ * @param string|null $constraint_name
+ * The name to use.
+ * Set to NULL to disable.
+ * @param int|null $type
+ * The type code representing the constaint operation.
+ * This can only be NULL when $constraint_name is NULL.
+ * @param bool|null $exists_or_invalid
+ * When $type is ADD, then this is a boolean such that NOT VALID is added when TRUE.
+ * When $type is DROP, then this is a boolean such that IS EXISTS is added when TRUE.
+ * Otherwise this should be NULL.
+ * @param int|null $cascade
+ * When $type is DROP, this must be an integer representing CASCADE or RESTRICT.
+ * Otherwise this should be NULL.
+ *
+ * @return c_base_return_status
+ * TRUE on success, FALSE otherwise.
+ * FALSE with the error bit set is returned on error.
+ */
+ public function set_constraint($constraint_name, $type = NULL, $exists_or_invalid = NULL, $cascade = NULL) {
+ if (is_null($constraint)) {
+ $this->constraint = NULL;
+ return new c_base_return_true();
+ }
+
+ if (!is_string($constraint_name)) {
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'constraint', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $constraint = [
+ 'name' => $constraint_name,
+ 'type' => $type,
+ 'exists_or_invalid' => NULL,
+ 'cascade' => NULL,
+ ];
+
+ if ($type === e_database_constraint::ADD) {
+ if (!is_bool($exists_or_invalid)) {
+ unset($constraint);
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'exists_or_invalid', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $constraint['exists_or_invalid'] = $exists_or_invalid;
+ }
+ else if ($type === e_database_constraint::DROP) {
+ if (!is_bool($exists_or_invalid)) {
+ unset($constraint);
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'exists_or_invalid', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $constraint['exists_or_invalid'] = $exists_or_invalid;
+ }
+ else if ($type === e_database_constraint::VALIDATE) {
+ switch ($cascade) {
+ case e_database_cascade::CASCADE:
+ case e_database_cascade::RESTRICT:
+ $constraint['cascade'] = $cascade;
+ break;
+ default:
+ unset($constraint);
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'cascade', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+ }
+ else {
+ unset($constraint);
+ $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);
+ }
+
+ $this->constraint = $constraint;
+ unset($constraint);
+ return new c_base_return_true();
+ }
+
+ /**
+ * Get the currently assigned name.
+ *
+ * @return c_base_return_string|c_base_return_null
+ * A name on success.
+ * NULL is returned if not set (constraint is not to be used).
+ * NULL with the error bit set is returned on error.
+ */
+ public function get_constraint_name() {
+ if (is_null($this->constraint)) {
+ return new c_base_return_null();
+ }
+
+ if (is_string($this->constraint['name'])) {
+ return c_base_return_string::s_new($this->constraint['name']);
+ }
+
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'constraint[name]', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE);
+ return c_base_return_error::s_null($error);
+ }
+
+ /**
+ * Get the currently assigned type.
+ *
+ * @return c_base_return_int|c_base_return_null
+ * A type code on success.
+ * NULL is returned if not set (constraint is not to be used).
+ * NULL with the error bit set is returned on error.
+ */
+ public function get_constraint_type() {
+ if (is_null($this->constraint)) {
+ return new c_base_return_null();
+ }
+
+ if (is_int($this->constraint['type'])) {
+ return c_base_return_int::s_new($this->constraint['type']);
+ }
+
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'constraint[type]', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE);
+ return c_base_return_error::s_null($error);
+ }
+
+ /**
+ * Get the currently assigned exists or invalid setting.
+ *
+ * @return c_base_return_bool|c_base_return_null
+ * A boolean on success.
+ * NULL is returned if not set (constraint is not to be used).
+ * NULL with the error bit set is returned on error.
+ */
+ public function get_constraint_exists_or_invalid() {
+ if (is_null($this->constraint) || is_null($this->constraint['exists_or_invalid'])) {
+ return new c_base_return_null();
+ }
+
+ if (is_bool($this->constraint['exists_or_invalid'])) {
+ return c_base_return_bool::s_new($this->constraint['exists_or_invalid']);
+ }
+
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'constraint[exists_or_invalid]', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE);
+ return c_base_return_error::s_null($error);
+ }
+
+ /**
+ * Get the currently assigned cascade setting.
+ *
+ * @return c_base_return_int|c_base_return_null
+ * A cascade code on success.
+ * NULL is returned if not set (constraint is not to be used).
+ * NULL with the error bit set is returned on error.
+ */
+ public function get_constraint_cascade() {
+ if (is_null($this->constraint) || is_null($this->constraint['cascade'])) {
+ return new c_base_return_null();
+ }
+
+ if (is_int($this->constraint['cascade'])) {
+ return c_base_return_bool::s_new($this->constraint['cascade']);
+ }
+
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'constraint[cascade]', ':{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 on success.
+ * NULL is returned if there is nothing to process or there is an error.
+ */
+ protected function p_do_build_constraint() {
+ if (is_null($this->constraint)) {
+ return NULL;
+ }
+
+ $value = NULL;
+ if ($this->constraint['type'] === e_database_constraint::ADD) {
+ if (is_string($this->constraint['name'])) {
+ $value = c_database_string::ADD . ' ' . $this->constraint['name'];
+
+ if ($this->constraint['exists_or_invalid']) {
+ $value .= ' ' . c_database_string::NOT_VALID;
+ }
+ }
+ }
+ else if ($this->constraint['type'] === e_database_constraint::DROP) {
+ if (is_string($this->constraint['name'])) {
+ $value = c_database_string::DROP_CONSTRAINT . ' ' . $this->constraint['name'];
+ }
+ }
+ else if ($this->constraint['type'] === e_database_constraint::VALIDATE) {
+ if (is_string($this->constraint['name'])) {
+ $value = c_database_string::VALIDATE_CONSTAINT;
+
+ if ($this->constraint['exists_or_invalid']) {
+ $value .= ' ' . c_database_string::NOT_VALID;
+ }
+
+ $value .=' ' . $this->constraint['name'];
+
+ if ($this->constraint['cascade'] === e_database_cascade::CASCADE) {
+ $value .= ' ' . c_database_string::CASCADE;
+ }
+ else if ($this->constraint['cascade'] === e_database_cascade::RESTRICT) {
+ $value .= ' ' . c_database_string::RESTRICT;
+ }
+ }
+ }
+
+ return $value;
+ }
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides traits for specific Postgesql Queries.
+ *
+ * These traits are associated with actions.
+ *
+ * @see: https://www.postgresql.org/docs/current/static/sql-commands.html
+ */
+namespace n_koopa;
+
+require_once('common/base/classes/base_error.php');
+require_once('common/base/classes/base_return.php');
+
+require_once('common/database/classes/database_string.php');
+
+require_once('common/database/enumerations/database_enable_trigger.php');
+
+/**
+ * Provide the sql SET WITH OIDS functionality.
+ */
+trait t_database_enable_trigger {
+ protected $enable_trigger;
+
+ /**
+ * Set the ENABLE TRIGGER or DISABLE TRIGGER value.
+ *
+ * @param bool|null $enable_trigger
+ * Set to TRUE for ENABLE TRIGGER, FALSE for DISABLE TRIGGER.
+ * Set to NULL to disable (as-in: no SQL is generated, do not confuse this with the generated DISABLE TRIGGER state produced by FALSE).
+ * @param int|null $type
+ * An integer representing the type of the trigger.
+ * Should only be NULL when $enable_trigger is NULL.
+ * @param string|null $name
+ * A string representing the table name depending on the $type.
+ * Use type NAME to explicitly require this.
+ * Some types require this value, others ignore it.
+ *
+ * @return c_base_return_status
+ * TRUE on success, FALSE otherwise.
+ * FALSE with the error bit set is returned on error.
+ */
+ public function set_enable_trigger($enable, $type = NULL, $name = NULL) {
+ if (is_null($enable_trigger)) {
+ $this->enable_trigger = NULL;
+ return new c_base_return_true();
+ }
+
+ if (!is_bool($enable_trigger)) {
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'enable_trigger', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $use_name = NULL;
+ switch ($type) {
+ case e_database_enable_trigger::ALWAYS:
+ case e_database_enable_trigger::NAME:
+ case e_database_enable_trigger::REPLICA:
+ if (!is_string($name)) {
+ unset($use_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);
+ }
+ break;
+ case e_database_enable_trigger::ALL:
+ $use_name = c_database_string::ALL;
+ break;
+ case e_database_enable_trigger::USER:
+ $use_name = c_database_string::USER;
+ break;
+ default:
+ unset($use_name);
+ $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);
+ }
+
+ $this->enable_trigger = [
+ 'status' => $enable_trigger,
+ 'type' => $type,
+ 'name' => $use_name,
+ ];
+ unset($use_name);
+
+ return new c_base_return_true();
+ }
+
+ /**
+ * Get the currently assigned ENABLE or DISABLE status.
+ *
+ * @return c_base_return_bool|c_base_return_null
+ * TRUE for ENABLE TRIGGER or FALSE for DISABLE TRIGGER on success.
+ * NULL is returned if not set (not to be confused with DISABLE TRIGGER).
+ * NULL with the error bit set is returned on error.
+ */
+ public function get_enable_trigger_status() {
+ if (is_null($this->enable_trigger)) {
+ return new c_base_return_null();
+ }
+
+ if (is_bool($this->enable_trigger['status'])) {
+ return c_base_return_bool::s_new($this->enable_trigger['status']);
+ }
+
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'enable_trigger[status]', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE);
+ return c_base_return_error::s_null($error);
+ }
+
+ /**
+ * Get the currently assigned ENABLE or DISABLE type.
+ *
+ * @return c_base_return_int|c_base_return_null
+ * An integer representing the type code on success.
+ * NULL is returned if not set.
+ * NULL with the error bit set is returned on error.
+ */
+ public function get_enable_trigger_type() {
+ if (is_null($this->enable_trigger)) {
+ return new c_base_return_null();
+ }
+
+ if (is_int($this->enable_trigger['type'])) {
+ return c_base_return_int::s_new($this->enable_trigger['type']);
+ }
+
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'enable_trigger[type]', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE);
+ return c_base_return_error::s_null($error);
+ }
+
+ /**
+ * Get the currently assigned ENABLE or DISABLE name.
+ *
+ * @return c_base_return_string|c_base_return_null
+ * An integer representing the type code on success.
+ * NULL is returned if not set.
+ * NULL with the error bit set is returned on error.
+ */
+ public function get_enable_trigger_name() {
+ if (is_null($this->enable_trigger) || is_null($this->enable_trigger['name'])) {
+ return new c_base_return_null();
+ }
+
+ if (is_int($this->enable_trigger['name'])) {
+ return c_base_return_int::s_new($this->enable_trigger['name']);
+ }
+
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'enable_trigger[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 on success.
+ * NULL is returned if there is nothing to process or there is an error.
+ */
+ protected function p_do_build_enable_trigger() {
+ if (is_null($this->enable_trigger)) {
+ return NULL;
+ }
+
+ $value = NULL;
+ switch ($this->enable_trigger['type']) {
+ case e_database_enable_trigger::ALWAYS:
+ case e_database_enable_trigger::REPLICA:
+ if (is_string($this->enable_trigger['name'])) {
+ if ($this->enable_trigger['type'] === e_database_enable_trigger::ALWAYS) {
+ $value = c_database_string::ENABLE_ALWAYS_TRIGGER . ' ' . $this->enable_trigger['name'];
+ }
+ else if ($this->enable_trigger['type'] === e_database_enable_trigger::REPLICA) {
+ $value = c_database_string::ENABLE_REPLICA_TRIGGER . ' ' . $this->enable_trigger['name'];
+ }
+ }
+ break;
+
+ case e_database_enable_trigger::NAME:
+ if (is_string($this->enable_trigger['name'])) {
+ if ($this->enable_trigger['status']) {
+ $value = c_database_string::ENABLE_TRIGGER . ' ' . $this->enable_trigger['name'];
+ }
+ else {
+ $value = c_database_string::DISABLE_TRIGGER . ' ' . $this->enable_trigger['name'];
+ }
+ }
+ break;
+ case e_database_enable_trigger::ALL:
+ if ($this->enable_trigger['status']) {
+ $value = c_database_string::ENABLE_TRIGGER . ' ' . c_database_string::ALL;
+ }
+ else {
+ $value = c_database_string::DISABLE_TRIGGER . ' ' . c_database_string::ALL;
+ }
+ break;
+ case e_database_enable_trigger::USER:
+ if ($this->enable_trigger['status']) {
+ $value = c_database_string::ENABLE_TRIGGER . ' ' . c_database_string::USER;
+ }
+ else {
+ $value = c_database_string::DISABLE_TRIGGER . ' ' . c_database_string::USER;
+ }
+ break;
+ }
+
+ return $value;
+ }
+}
if ($handler === e_database_handler::HANDLER) {
if (is_string($handler_function)) {
- $this->handler[
+ $this->handler = [
'type' => $handler,
'name' => $handler_function,
];
return c_base_return_error::s_false($error);
}
else if ($handler === e_database_handler::NO_HANDLER) {
- $this->handler[
+ $this->handler = [
'type' => $handler,
'name' => null,
];
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_handler() {
- $value = NULL;
+ if (is_null($this->handler)) {
+ return NULL;
+ }
- if (isset($this->handler['type'])) {
- if ($this->handler['type'] == e_database_handler::HANDLER) {
- if (isset($this->handler['name'])) {
- $value = c_database_string::HANDLER . ' ' . $this->handler['name'];
- }
- }
- else if ($this->handler['type'] == e_database_handler::NO_HANDLER) {
- $value .= c_database_string::NO_HANDLER;
+ $value = NULL;
+ if ($this->handler['type'] == e_database_handler::HANDLER) {
+ if (isset($this->handler['name'])) {
+ $value = c_database_string::HANDLER . ' ' . $this->handler['name'];
}
}
+ else if ($this->handler['type'] == e_database_handler::NO_HANDLER) {
+ $value .= c_database_string::NO_HANDLER;
+ }
return $value;
}
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_in_schema() {
+ if (is_null($this->in_schema)) {
+ return NULL;
+ }
+
return c_database_string::IN . ' ' . c_database_string::SCHEMA . ' ' . implode(', ', $this->in_schema);
}
}
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_inherit() {
+ if (is_null($this->inherit)) {
+ return NULL;
+ }
+
$value = $this->inherit['inherit'] ? c_database_string::INHERIT : c_database_string::NO_INHERIT;
$value .= ' ' . $this->inherit['name'];
return $value;
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_options() {
+ if (is_null($this->options)) {
+ return NULL;
+ }
+
$options = [];
foreach ($this->options as $options_value) {
if ($options_value['type'] == e_database_options::ADD) {
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_order_by() {
+ if (is_null($this->order_by)) {
+ return NULL;
+ }
+
return c_database_string::ORDER_BY . ' ' . $this->order_by;
}
}
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_owner_to() {
+ if (is_null($this->owner_to)) {
+ return NULL;
+ }
+
return c_database_string::OWNER_TO . ' ' . $this->owner_to['value'];
}
}
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_rename_column() {
+ if (is_null($this->rename_column)) {
+ return NULL;
+ }
+
return c_database_string::RENAME_COLUMN . ' ' . $this->rename_column['from'] . ' ' . c_database_string::TO . $this->rename_column['to'];
}
}
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_rename_to() {
+ if (is_null($this->rename_to)) {
+ return NULL;
+ }
+
return c_database_string::RENAME_TO . ' ' . $this->rename_to;
}
}
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_reset() {
- $value = NULL;
+ if (is_null($this->reset)) {
+ return NULL;
+ }
+ $value = NULL;
if ($this->reset['type'] === e_database_reset::PARAMETER) {
if (is_string($this->reset['value'])) {
$value = c_database_string::RESET . ' ' . $this->reset['value'];
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_set() {
- $value = NULL;
+ if (is_null($this->set)) {
+ return NULL;
+ }
+ $value = NULL;
if ($this->set['type'] === e_database_set::TO) {
if (is_null($this->set['parameter'])) {
$value = c_database_string::SET . ' ' . $this->set['parameter'] . ' ' . c_database_string::TO . ' ' . c_database_string::DEFAULT;
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_set_schema() {
+ if (is_null($this->set_schema)) {
+ return NULL;
+ }
+
return c_database_string::SET_SCHEMA . ' ' . $this->set_schema;
}
}
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_set_tablespace() {
+ if (is_null($this->set_tablespace)) {
+ return NULL;
+ }
+
return c_database_string::SET_TABLESPACE . ' (' . $this->set_tablespace . ')';
}
}
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_set_with_oids() {
+ if (is_null($this->set_with_oids)) {
+ return NULL;
+ }
+
return $this->set_with_oids ? c_database_string::SET_WITH_OIDS : c_database_string::SET_WITHOUT_OIDS;
}
}
if ($validator === e_database_validator::VALIDATOR) {
if (is_string($validator_function)) {
- $this->validator[
+ $this->validator = [
'type' => $validator,
'name' => $validator_function,
];
return c_base_return_error::s_false($error);
}
else if ($validator === e_database_validator::NO_VALIDATOR) {
- $this->validator[
+ $this->validator = [
'type' => $validator,
'name' => null,
];
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_validator() {
- $value = NULL;
+ if (is_null($this->validator)) {
+ return NULL;
+ }
- if (is_array($this->validator) && isset($this->validator['type'])) {
- if ($this->validator['type'] == e_database_validator::VALIDATOR) {
- if (isset($this->validator['name'])) {
- $value = c_database_string::VALIDATOR . ' ' . $this->validator['name'];
- }
- }
- else if ($this->validator['type'] == e_database_validator::NO_VALIDATOR) {
- $value = c_database_string::NO_VALIDATOR;
+ $value = NULL;
+ if ($this->validator['type'] == e_database_validator::VALIDATOR) {
+ if (isset($this->validator['name'])) {
+ $value = c_database_string::VALIDATOR . ' ' . $this->validator['name'];
}
}
+ else if ($this->validator['type'] == e_database_validator::NO_VALIDATOR) {
+ $value = c_database_string::NO_VALIDATOR;
+ }
return $value;
}