protected $aggregate_signatures;
protected $order_by_signatures;
-
/**
* Class constructor.
*/
}
/**
- * Set the aggregate signatures.
+ * Assign the settings.
*
* @param c_database_argument_aggregate_signature|null $aggregate_signature
* The aggregate signatures to use.
}
/**
- * Set the order by aggregate signatures.
+ * Assign the settings.
*
* @param c_database_argument_aggregate_signature_base|null $order_by_signature
* The order by aggregate signature to use.
if (isset($aggregate_signatures)) {
$aggregate_signatures = ' (' . $aggregate_signatures;
if (isset($order_by_signatures)) {
- $aggregate_signatures = ' ' . c_database_string::ORDER_BY . ' ' . $order_by_signatures . '';
+ $aggregate_signatures = ' ' . c_database_string::ORDER . ' ' . c_database_string::BY . ' ' . $order_by_signatures . '';
}
$aggregate_signatures .= ')';
}
}
/**
- * Set the refresh version.
+ * Assign the settings.
*
* @param bool|null $refresh_version
* Whether or not to use REFRESH VERSION in the query.
$value = $this->p_do_build_name();
if (is_bool($this->refresh_version)) {
if ($this->refresh_version) {
- $value .= c_database_string::REFRESH_VERSION;
+ $value .= c_database_string::REFRESH . ' ' . c_database_string::VERSION;
}
}
else if (isset($this->rename_to)) {
protected const p_QUERY_COMMAND = 'alter conversion';
-
/**
* Class constructor.
*/
}
/**
- * Set the option.
+ * Assign the settings.
*
* @param c_database_argument_database_option|null $option
* The database options to use.
*/
public function __construct() {
parent::__construct();
-;
+
$this->action = NULL;
$this->name = NULL;
$this->owner_to = NULL;
$value .= ' ' . $this->constraint['name'];
if ($this->property === e_database_property::NOT_VALID) {
- $value .= ' ' . c_database_string::NOT_VALID;
+ $value .= ' ' . c_database_string::NOT . ' ' . c_database_string::VALID;
}
break;
case e_database_action_deprecated::DROP:
$value .= c_database_string::DROP;
if ($this->property === e_database_property::NOT_NULL) {
- $value .= ' ' . c_database_string::NOT_NULL;
+ $value .= ' ' . c_database_string::NOT . ' ' . c_database_string::NULL;
}
break;
return new c_base_return_false();
}
- $value .= c_database_string::DROP_CONSTRAINT;
+ $value .= c_database_string::DROP . ' ' . c_database_string::CONSTRAINT;
if ($this->property === e_database_property::IF_EXISTS) {
- $value .= ' ' . c_database_string::IF_EXISTS;
+ $value .= ' ' . c_database_string::IF . ' ' . c_database_string::EXISTS;
}
$value .= ' ' . $this->constraint['name'];
break;
case e_database_action_deprecated::DROP_DEFAULT:
- $value .= c_database_string::DROP_DEFAULT;
+ $value .= c_database_string::DROP . ' ' . c_database_string::DEFAULT;
break;
case e_database_action_deprecated::OWNER_TO:
return new c_base_return_false();
}
- $value .= c_database_string::RENAME_CONSTRAINT . ' ' . $this->constraint['name'] . ' ' . c_database_string::TO . ' ' . $this->constraint['name_new'];
+ $value .= c_database_string::RENAME . ' ' . c_database_string::CONSTRAINT . ' ' . $this->constraint['name'] . ' ' . c_database_string::TO . ' ' . $this->constraint['name_new'];
break;
case e_database_action_deprecated::RENAME_TO:
return new c_base_return_false();
}
- $value .= c_database_string::SET_DEFAULT . ' ' . $this->expression;
+ $value .= c_database_string::SET . ' ' . c_database_string::DEFAULT . ' ' . $this->expression;
break;
case e_database_action_deprecated::SET_SCHEMA:
return new c_base_return_false();
}
- $value .= c_database_string::VALIDATE_CONSTRAINT . ' ' . $this->constraint['name'];
+ $value .= c_database_string::VALIDATE . ' ' . c_database_string::CONSTRAINT . ' ' . $this->constraint['name'];
break;
default:
protected const p_QUERY_COMMAND = 'alter event trigger';
-
/**
* Class constructor.
*/
protected $member_object;
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter foreign data wrapper';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter foreign table';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter group';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter index';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter language';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter large object';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter materialized view';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter operator';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter operator class';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter operator family';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter policy';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter publication';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter role';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter rule';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter schema';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter sequence';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter server';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter statistics';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter subsciption';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter system';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter table';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter tablespace';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter text search configuration';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter text search dictionary';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter text search parser';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter text search template';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter trigger';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter type';
-
/**
* Class constructor.
*/
protected const p_QUERY_COMMAND = 'alter user';
-
/**
* Class constructor.
*/
require_once('common/database/classes/database_query.php');
+require_once('common/database/traits/database_alter_column.php');
+require_once('common/database/traits/database_if_exists.php');
+require_once('common/database/traits/database_name.php');
+require_once('common/database/traits/database_owner_to.php');
+require_once('common/database/traits/database_rename_to.php');
+require_once('common/database/traits/database_reset_view_option.php');
+require_once('common/database/traits/database_set_schema.php');
+require_once('common/database/traits/database_set_view_option.php');
/**
- * The class for building and returning a Postgresql ALTER COALATION query string.
+ * The class for building and returning a Postgresql ALTER VIEW query string.
*
- * @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
+ * @see: https://www.postgresql.org/docs/current/static/sql-alterview.html
*/
-class c_database_alter_coalation extends c_database_query {
- protected const p_QUERY_COMMAND = 'alter coalation';
+class c_database_alter_view extends c_database_query {
+ use t_database_alter_column;
+ use t_database_if_exists;
+ use t_database_name;
+ use t_database_owner_to;
+ use t_database_rename_to;
+ use t_database_reset_view_option;
+ use t_database_set_schema;
+ use t_database_set_view_option;
+ protected const p_QUERY_COMMAND = 'alter view';
/**
* Class constructor.
*/
public function __construct() {
parent::__construct();
+
+ $this->alter_column = NULL;
+ $this->if_exists = NULL;
+ $this->name = NULL;
+ $this->owner_to = NULL;
+ $this->rename_to = NULL;
+ $this->reset_view_option = NULL;
+ $this->set_schema = NULL;
+ $this->set_view_option = NULL;
}
/**
* Class destructor.
*/
public function __destruct() {
+ unset($this->alter_column);
+ unset($this->if_exists);
+ unset($this->name);
+ unset($this->owner_to);
+ unset($this->rename_to);
+ unset($this->reset_view_option);
+ unset($this->set_schema);
+ unset($this->set_view_option);
+
parent::__destruct();
}
$value = $this->p_do_build_name();
+ if (isset($this->if_exists)) {
+ $value = $this->p_do_build_if_exists() . ' ' . $value;
+ }
+
+ if (isset($this->alter_column)) {
+ $value .= ' ' . $this->p_do_build_alter_column();
+ }
+ else if (isset($this->owner_to)) {
+ $value .= ' ' . $this->p_do_build_owner_to();
+ }
+ else if (isset($this->rename_to)) {
+ $value .= ' ' . $this->p_do_build_rename_to();
+ }
+ else if (isset($this->set_schema)) {
+ $value .= ' ' . $this->p_do_build_set_schema();
+ }
+ else if (isset($this->set_view_option)) {
+ $value .= ' ' . $this->p_do_build_set_view_option();
+ }
+ else if (isset($this->reset_view_option)) {
+ $value .= ' ' . $this->p_do_build_reset_view_option();
+ }
+ else {
+ unset($value);
+ return new c_base_return_false();
+ }
+
$this->value = static::p_QUERY_COMMAND;
$this->value .= ' ' . $value;
unset($value);
<?php
/**
* @file
- * Provides a class for specific Postgesql query: ALTER COALATION.
+ * Provides a class for specific Postgesql query: ANALYZE.
*/
namespace n_koopa;
require_once('common/database/classes/database_query.php');
+require_once('common/database/traits/database_analyze_options.php');
+require_once('common/database/traits/database_column_names.php');
+require_once('common/database/traits/database_table_name.php');
/**
- * The class for building and returning a Postgresql ALTER COALATION query string.
+ * The class for building and returning a Postgresql ANALYZE query string.
*
- * @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
+ * @see: https://www.postgresql.org/docs/current/static/sql-analyze.html
*/
-class c_database_alter_coalation extends c_database_query {
- protected const p_QUERY_COMMAND = 'alter coalation';
+class c_database_analyze extends c_database_query {
+ use t_database_analyze_options;
+ use t_database_column_names;
+ use t_database_table_name;
+ protected const p_QUERY_COMMAND = 'analyze';
/**
* Class constructor.
*/
public function __construct() {
parent::__construct();
+
+ unset($this->analyze_options);
+ unset($this->column_names);
+ unset($this->table_name);
}
/**
* Class destructor.
*/
public function __destruct() {
+ $this->analyze_options = NULL;
+ $this->column_names = NULL;
+ $this->table_name = NULL;
+
parent::__destruct();
}
* Implements do_build().
*/
public function do_build() {
- if (is_null($this->name)) {
+ if (is_null($this->table_name)) {
return new c_base_return_false();
}
- $value = $this->p_do_build_name();
+ $value = $this->p_do_build_table_name();
+
+ if (!is_null($this->analyze_options)) {
+ $value = '(' . $this->p_do_build_analyze_options() . ') ' . $value;
+ }
+
+ if (!is_null($this->column_names)) {
+ $value .= ' (' . $this->p_do_build_column_names() . ')';
+ }
$this->value = static::p_QUERY_COMMAND;
$this->value .= ' ' . $value;
require_once('common/database/classes/database_query.php');
+require_once('common/database/traits/database_transaction_action.php');
+require_once('common/database/traits/database_transaction_mode.php');
/**
- * The class for building and returning a Postgresql ALTER COALATION query string.
+ * The class for building and returning a Postgresql BEGIN query string.
*
- * @see: https://www.postgresql.org/docs/current/static/sql-alteraggregate.html
+ * @see: https://www.postgresql.org/docs/current/static/sql-begin.html
*/
-class c_database_alter_coalation extends c_database_query {
- protected const p_QUERY_COMMAND = 'alter coalation';
+class c_database_begin extends c_database_query {
+ use t_database_transaction_action;
+ use t_database_transaction_mode;
+ protected const p_QUERY_COMMAND = 'begin';
/**
* Class constructor.
*/
public function __construct() {
parent::__construct();
+
+ $this->transaction_action = NULL;
+ $this->transaction_mode = NULL;
}
/**
* Class destructor.
*/
public function __destruct() {
+ unset($this->transaction_action);
+ unset($this->transaction_mode);
+
parent::__destruct();
}
* Implements do_build().
*/
public function do_build() {
- if (is_null($this->name)) {
- return new c_base_return_false();
+ $value = NULL;
+
+ if (isset($this->transaction_action)) {
+ $value = $this->p_do_build_transaction_action();
}
- $value = $this->p_do_build_name();
+ if (isset($this->transaction_mode)) {
+ if (is_null($value)) {
+ $value = $this->p_do_build_transaction_mode();
+ }
+ else {
+ $value = ' ' . $this->p_do_build_transaction_mode();
+ }
+ }
$this->value = static::p_QUERY_COMMAND;
$this->value .= ' ' . $value;
$value = NULL;
switch($this->action) {
case e_database_method_object::ACCESS_METHOD:
- $value = c_database_string::ACCESS_METHOD . ' ' . $this->p_do_build_name();
+ $value = c_database_string::ACCESS . ' ' . c_database_string::METHOD . ' ' . $this->p_do_build_name();
break;
case e_database_method_object::AGGREGATE:
$value = c_database_string::AGGREGATE . ' ' . $this->p_do_build_name();
$value = c_database_string::DOMAIN . ' ' . $this->p_do_build_name();
break;
case e_database_method_object::EVENT_TRIGGER:
- $value = c_database_string::EVENT_TRIGGER . ' ' . $this->p_do_build_name();
+ $value = c_database_string::EVENT . ' ' . c_database_string::TRIGGER . ' ' . $this->p_do_build_name();
break;
case e_database_method_object::FOREIGN_DATA_WRAPPER:
- $value = c_database_string::FOREIGN_DATA_WRAPPER . ' ' . $this->p_do_build_name();
+ $value = c_database_string::FOREIGN . ' ' . c_database_string::DATA . ' ' . c_database_string::WRAPPER . ' ' . $this->p_do_build_name();
break;
case e_database_method_object::FOREIGN_TABLE:
- $value = c_database_string::FOREIGN_TABLE . ' ' . $this->p_do_build_name();
+ $value = c_database_string::FOREIGN . ' ' . c_database_string::TABLE . ' ' . $this->p_do_build_name();
break;
case e_database_method_object::FUNCTION:
$value = c_database_string::FUNCTION . ' ' . $this->p_do_build_name();
}*/
break;
case e_database_method_object::MATERIALIZED_VIEW:
- $value = c_database_string::MATERIALIZED_VIEW . ' ' . $this->p_do_build_name();
+ $value = c_database_string::MATERIALIZED . ' ' . c_database_string::VIEW . ' ' . $this->p_do_build_name();
break;
case e_database_method_object::OPERATOR:
$value = c_database_string::OPERATOR . ' ' . $this->p_do_build_name();
}
break;
case e_database_method_object::OPERATOR_CLASS:
- $value = c_database_string::OPERATOR_CLASS . ' ' . $this->p_do_build_name();
+ $value = c_database_string::OPERATOR . ' ' . c_database_string::CLASS_ . ' ' . $this->p_do_build_name();
if (is_string($this->action_parameter)) {
$value .= ' ' . c_database_string::USING . ' ' . $this->action_parameter;
}
}
break;
case e_database_method_object::OPERATOR_FAMILY:
- $value = c_database_string::OPERATOR_FAMILY . ' ' . $this->p_do_build_name();
+ $value = c_database_string::OPERATOR . ' ' . c_database_string::FAMILY . ' ' . $this->p_do_build_name();
if (is_string($this->action_parameter)) {
$value .= ' ' . c_database_string::USING . ' ' . $this->action_parameter;
}
$value = c_database_string::TABLE . ' ' . $this->p_do_build_name();
break;
case e_database_method_object::TEXT_SEARCH_CONFIGURATION:
- $value = c_database_string::TEXT_SEARCH_CONFIGURATION . ' ' . $this->p_do_build_name();
+ $value = c_database_string::TEXT . ' ' . c_database_string::SEARCH . ' ' . c_database_string::CONFIGURATION . ' ' . $this->p_do_build_name();
break;
case e_database_method_object::TEXT_SEARCH_DICTIONARY:
- $value = c_database_string::TEXT_SEARCH_DICTIONARY . ' ' . $this->p_do_build_name();
+ $value = c_database_string::TEXT . ' ' . c_database_string::SEARCH . ' ' . c_database_string::DICTIONARY . ' ' . $this->p_do_build_name();
break;
case e_database_method_object::TEXT_SEARCH_PARSER:
- $value = c_database_string::TEXT_SEARCH_PARSER . ' ' . $this->p_do_build_name();
+ $value = c_database_string::TEXT . ' ' . c_database_string::SEARCH . ' ' . c_database_string::PARSER . ' ' . $this->p_do_build_name();
break;
case e_database_method_object::TEXT_SEARCH_TEMPLATE:
- $value = c_database_string::TEXT_SEARCH_TEMPLATE . ' ' . $this->p_do_build_name();
+ $value = c_database_string::TEXT . ' ' . c_database_string::SEARCH . ' ' . c_database_string::TEMPLATE . ' ' . $this->p_do_build_name();
break;
case e_database_method_object::TRANSFORM_FOR:
- $value = c_database_string::TRANSFORM_FOR . ' ' . $this->p_do_build_name();
+ $value = c_database_string::TRANSFORM . ' ' . c_database_string::FOR . ' ' . $this->p_do_build_name();
if (is_string($this->action_parameter)) {
$value .= ' ' . c_database_string::LANGUAGE . ' ' . $this->action_parameter;
}
}
/**
- * Set the SQL query.
+ * Assign the settings.
*
* @param c_database_query|null $query
* A fully configured query.
}
/**
- * Set the SQL expression.
+ * Assign the settings.
*
* Expression are usually fields but also be other expressions.
* Expressions may even be SQL queries.
}
/**
- * Set the SQL expression alias.
+ * Assign the settings.
*
* @param string|null $alias
* An optional alias to assign.
}
/**
- * Set the SQL expression column.
+ * Assign the settings.
*
* @param string|null $column
* Set to NULL to remove the assigned expression column.
}
/**
- * Set the SQL argument mode.
+ * Assign the settings.
*
* @param int|null $argument_mode
* The argument mode to assign.
}
/**
- * Set the SQL argument name.
+ * Assign the settings.
*
* @param string|null $argument_name
* The argument name to assign.
}
/**
- * Set the SQL argument type.
+ * Assign the settings.
*
* @param string|null $argument_type
* The argument type to assign.
}
/**
- * Set the SQL argument all.
+ * Assign the settings.
*
* This represents whether or not a wildcard is used to represent all fields.
*
}
/**
- * Set the SQL argument allow connection.
+ * Assign the settings.
*
* @param bool|null $allow_connection
* Set to TRUE to enable allow connection.
}
/**
- * Set the SQL argument connection limit.
+ * Assign the settings.
*
* @param int|null $connection_limit
* A connection limit integer.
}
/**
- * Set the SQL argument is template.
+ * Assign the settings.
*
* @param bool|null $is_template
* Set to TRUE to enable is template.
}
/**
- * Set the SQL argument mode.
+ * Assign the settings.
*
* @param int|null $argument_mode
* The argument mode to assign.
}
/**
- * Set the SQL argument name.
+ * Assign the settings.
*
* @param string|null $argument_name
* The argument name to assign.
* A collection of strings used for generating SQL.
*/
class c_database_string {
- public const ACCESS_METHOD = 'access method';
+ public const ACCESS = 'access';
public const ADD = 'add';
- public const ADD_ATTRIBUTE = 'add attribute';
- public const ADD_COLUMN = 'add column';
- public const ADD_TABLE = 'add table';
- public const ADD_VALUE = 'add value';
public const AFTER = 'after';
public const AGGREGATE = 'aggregate';
public const ALL = 'all';
- public const ALLOW_CONNECTIONS = 'allow_connections';
+ public const ALLOW = 'allow';
public const ALTER = 'alter';
- public const ALTER_ATTRIBUTE = 'alter attribute';
- public const ALTER_CONSTRAINT = 'alter constraint';
+ public const ALWAYS = 'always';
public const AS = 'as';
public const ASCEND = 'asc';
- public const ATTACH_PARTITION = 'attach partition';
+ public const ATTACH = 'attach';
+ public const ATTRIBUTE = 'attribute';
public const AUTOSUMMARIZE = 'autosummarize';
public const AUTOVACUUM_ANALYZE_SCALE_FACTOR = 'autovacuum_analyze_scale_factor';
public const AUTOVACUUM_ANALYZE_THRESHOLD = 'autovacuum_analyze_threshold';
public const AUTOVACUUM_SCALE_FACTOR = 'autovacuum_scale_factor';
public const AUTOVACUUM_VACUUM_THRESHOLD = 'autovacuum_vacuum_threshold';
public const BEFORE = 'before';
+ public const BEGIN = 'begin';
public const BUFFERING = 'buffering';
+ public const BY = 'by';
public const BYPASSRLS = 'bypassrls';
public const CACHE = 'cache';
- public const CALLED_ON_NULL_INPUT = 'called on null input';
+ public const CALLED = 'called';
public const CASCADE = 'cascade';
public const CAST = 'cast';
- public const CLUSTER_ON = 'cluster on';
+ public const CHECK = 'check';
+ public const CHECK_OPTION = 'check_option';
+ public const CLASS_ = 'class';
+ public const CLUSTER = 'cluster';
public const COLLATE = 'collate';
public const COLLATION = 'collation';
public const COLUMN = 'column';
+ public const COMMIT = 'commit';
+ public const COMMITTED = 'committed';
+ public const CONFIGURATION = 'configuration';
public const CONNECT = 'connect';
public const CONNECTION = 'connection';
- public const CONNECTION_LIMIT = 'connection limit';
+ public const CONNECTIONS = 'connections';
+ public const CONSTRAINT = 'constraint';
public const CONVERSION = 'conversion';
public const COPY_DATA = 'copy_data';
public const COST = 'cost';
public const CREATEDB = 'createdb';
public const CREATEROLE = 'createrole';
public const CREATE_SLOT = 'create_slot';
- public const CURRENT_USER = 'current user';
+ public const CURRENT = 'current';
public const CYCLE = 'cycle';
+ public const DATA = 'data';
+ public const DATABASE = 'database';
public const DEFAULT = 'default';
public const DEFERRABLE = 'deferrable';
+ public const DEFERRED = 'deferred';
+ public const DEFINER = 'definer';
public const DELETE = 'delete';
- public const DEPENDS_ON_EXTENSION = 'depends on extension';
+ public const DEPENDS = 'depends';
public const DESCEND = 'desc';
+ public const DICTIONARY = 'dictionary';
public const DISABLE = 'disable';
- public const DISABLE_RULE = 'disable rule';
- public const DISABLE_TRIGGER = 'disable trigger';
public const DOMAIN = 'domain';
public const DROP = 'drop';
- public const DROP_ATTRIBUTE = 'drop attribute';
- public const DROP_CONSTRAINT = 'drop constraint';
- public const DROP_DEFAULT = 'drop default';
- public const DROP_MAPPING = 'drop mapping';
- public const DROP_TABLE = 'drop table';
public const ENABLE = 'enable';
public const ENABLED = 'enabled';
- public const ENABLE_ALWAYS_RULE = 'enable always rule';
- public const ENABLE_ALWAYS_TRIGGER = 'enable always trigger';
- public const ENABLE_REPLICA_RULE = 'enable replica rule';
- public const ENABLE_REPLICA_TRIGGER = 'enable replica trigger';
- public const ENABLE_RULE = 'enable rule';
- public const ENABLE_TRIGGER = 'enable trigger';
- public const EVENT_TRIGGER = 'event trigger';
+ public const ENCRYPTED = 'encypted';
+ public const EVENT = 'event';
public const EXECUTE = 'execute';
+ public const EXISTS = 'exists';
public const EXTENDED = 'extended';
+ public const EXTENSION = 'extension';
public const EXTERNAL = 'external';
public const FALSE = 'false';
+ public const FAMILY = 'family';
public const FASTUPDATE = 'fastupdate';
public const FILLFACTOR = 'fillfactor';
public const FOR = 'for';
- public const FOREIGN_DATA_WRAPPER = 'foreign data wrapper';
- public const FOREIGN_TABLE = 'foreign table';
- public const FOR_ORDER_BY = 'for order by';
- public const FOR_ROLE = 'for role';
- public const FOR_SEARCH = 'for search';
- public const FOR_VALUES = 'for values';
- public const FROM_CURRENT = 'from current';
+ public const FOREIGN = 'foreign';
+ public const FROM = 'from';
public const FULL = 'full';
public const FUNCTION = 'function';
+ public const FUNCTIONS = 'functons';
public const GRANT = 'grant';
- public const GRANT_OPTION_FOR = 'grant option for';
public const GROUP = 'group';
- public const GROUP_BY = 'group by';
public const GIN_PENDING_LIST_LIMIT = 'gin_pending_list_limit';
public const HANDLER = 'handler';
- public const IF_EXISTS = 'if exists';
- public const IF_NOT_EXISTS = 'if not exists';
+ public const IDENTITY = 'identity';
+ public const IF = 'if';
+ public const IMMEDIATE = 'immediate';
public const IMMUTABLE = 'immutable';
public const IN = 'in';
- public const IN_DATABASE = 'in database';
+ public const INDEX = 'index';
public const INOUT = 'inout';
- public const IN_SCHEMA = 'in schema';
+ public const INPUT = 'input';
+ public const INVOKER = 'invoker';
public const INHERIT = 'inherit';
- public const INITIALLY_DEFERRED = 'initially deferred';
- public const INITIALLY_IMMEDIATE = 'initially immediate';
+ public const INITIALLY = 'initially';
public const INSERT = 'insert';
+ public const ISOLATION = 'isolation';
public const IS_TEMPLATE = 'is_template';
public const LANGUAGE = 'language';
public const LEAKPROOF = 'leakproof';
+ public const LEVEL = 'level';
+ public const LIMIT = 'limit';
+ public const LOGGED = 'logged';
public const LOGIN = 'login';
public const LOG_AUTOVACUUM_MIN_DURATION = 'log_autovacuum_min_duration';
public const MAIN = 'main';
public const MAPPING = 'mapping';
- public const MAPPING_FOR = 'mapping for';
- public const MAPPING_REPLACE = 'mapping replace';
- public const MATERIALIZED_VIEW = 'materialized view';
+ public const MATERIALIZED = 'materialized';
public const MAXVALUE = 'maxvalue';
+ public const METHOD = 'method';
public const MINVALUE = 'minvalue';
public const N_DISTINCT = 'n_distinct';
public const N_DISTINCT_INHERITED = 'n_distinct_inherited';
public const NOREPLICATION = 'noreplication';
public const NOSUPERUSER = 'nosuperuser';
public const NOTHING = 'nothing';
- public const NOWAIT = 'nowait';
- public const NO_HANDLER = 'no handler';
- public const NO_INHERIT = 'no inherit';
- public const NO_VALIDATOR = 'no validator';
- public const NOT_DEFERRABLE = 'not deferrable';
- public const NOT_LEAKPROOF = 'not leakproof';
- public const NOT_OF = 'not of';
- public const NOT_NULL = 'not null';
- public const NOT_VALID = 'not valid';
- public const ON_FUNCTIONS = 'on functons';
- public const ON_SCHEMAS = 'on schemas';
- public const ON_SEQUENCES = 'on sequences';
- public const ON_TABLES_TO = 'on tables to';
- public const ON_TYPES = 'on types';
+ public const NOWAIT = 'nowait';
+ public const NOT = 'not';
+ public const NULL = 'null';
+ public const OF = 'of';
+ public const OIDS = 'oids';
+ public const ON = 'on';
public const ONLY = 'only';
public const OPERATOR = 'operator';
- public const OPERATOR_CLASS = 'operator class';
- public const OPERATOR_FAMILY = 'operator family';
+ public const OPTION = 'option';
public const OPTIONS = 'options';
- public const ORDER_BY = 'order by';
+ public const ORDER = 'order';
public const OUT = 'out';
- public const OWNED_BY = 'owned by';
- public const OWNER_TO = 'owner to';
+ public const OWNED = 'owned';
public const PAGES_PER_RANGE = 'pages_per_range';
public const PARALLEL = 'parallel';
public const PARALLEL_WORKERS = 'parallel_workers';
+ public const PARSER = 'parser';
+ public const PARTITION = 'partition';
public const PASSWORD = 'password';
- public const PASSWORD_ENCRYPTED = 'encypted password';
public const PLAIN = 'plain';
public const PROCEDURAL = 'procedural';
public const PUBLIC = 'public';
+ public const PUBLICATION = 'publication';
public const PUBLISH = 'publish';
+ public const READ = 'read';
public const REFERENCES = 'references';
public const REFRESH = 'refresh';
- public const REFRESH_PUBLICATION = 'refresh publication';
- public const REFRESH_VERSION = 'refresh version';
- public const RENAME_ATTRIBUTE = 'rename attribute';
- public const RENAME_COLUMN = 'rename column';
- public const RENAME_CONSTRAINT = 'rename constraint';
- public const RENAME_TO = 'rename to';
- public const REPLICA_IDENTITY = 'replica identity';
+ public const RENAME = 'rename';
+ public const REPEATABLE = 'repeatable';
+ public const REPLACE = 'replace';
+ public const REPLICA = 'replica';
public const REPLICATION = 'replication';
public const RESET = 'reset';
- public const RESET_ALL = 'reset all';
- public const RESET_PUBLICATION = 'reset publication';
- public const RESTART_WITH = 'restart with';
+ public const RESTART = 'restart';
public const RESTRICT = 'restrict';
public const RESTRICTED = 'restricted';
- public const RETURNS_NULL_ON_NULL_INPUT = 'returns null on null input';
+ public const RETURNS = 'returns';
public const REVOKE = 'revoke';
public const ROLE = 'role';
+ public const ROLLBACK = 'rollback';
+ public const ROW = 'row';
public const ROWS = 'rows';
- public const ROW_LEVEL_SECURITY = 'row level security';
+ public const RULE = 'rule';
public const SAFE = 'safe';
public const SCHEMA = 'schema';
- public const SECURITY_DEFINER = 'security definer';
- public const SECURITY_INVOKER = 'security invoker';
+ public const SCHEMAS = 'schemas';
+ public const SEARCH = 'search';
+ public const SECURITY = 'security';
+ public const SECURITY_BARRIER = 'security_barrier';
public const SELECT = 'select';
public const SEQUENCE = 'sequence';
+ public const SEQUENCES = 'sequences';
+ public const SERIALIZABLE = 'serializable';
public const SERVER = 'server';
- public const SESSION_USER = 'session user';
+ public const SESSION = 'session';
public const SET = 'set';
- public const SET_DATA = 'set data';
- public const SET_DATA_TYPE = 'set data type';
- public const SET_DEFAULT = 'set default';
- public const SET_LOGGED = 'set logged';
- public const SET_PUBLICATION = 'set publication';
- public const SET_SCHEMA = 'set schema';
- public const SET_STATISTICS = 'set statistics';
- public const SET_STORAGE = 'set storage';
- public const SET_TABLE = 'set table';
- public const SET_TABLESPACE = 'set tablespace';
- public const SET_UNLOGGED = 'set unlogged';
- public const SET_WITH_OIDS = 'set with oids';
- public const SET_WITHOUT_CLUSTER = 'set without cluster';
- public const SET_WITHOUT_OIDS = 'set without oids';
public const SLOT_NAME = 'slot_name';
+ public const SNAPSHOT = 'snapshot';
public const STABLE = 'stable';
- public const START_WITH = 'start with';
+ public const START = 'start';
+ public const STATISTICS = 'statistics';
+ public const STORAGE = 'storage';
public const STRICT = 'strict';
public const SUPERUSER = 'superuser';
public const SYNCHRONOUS_COMMIT = 'synchronous_commit';
public const TABLE = 'table';
- public const TEXT_SEARCH_CONFIGURATION = 'text search configuration';
- public const TEXT_SEARCH_DICTIONARY = 'text search dictionary';
- public const TEXT_SEARCH_PARSER = 'text search parser';
- public const TEXT_SEARCH_TEMPLATE = 'text search template';
- public const TRANSFORM_FOR = 'transform for';
+ public const TABLES = 'tables';
+ public const TABLESPACE = 'tablespace';
+ public const TEMPLATE = 'template';
+ public const TEXT = 'text';
+ public const TRANSACTION = 'transaction';
+ public const TRANSFORM = 'transform';
public const TRIGGER = 'trigger';
public const TRUE = 'true';
public const TRUNCATE = 'truncate';
public const TYPE = 'type';
+ public const TYPES = 'types';
public const TO = 'to';
- public const TO_DEFAULT = 'to default';
+ public const UNCOMMITTED = 'uncommitted';
+ public const UNLOGGED = 'unlogged';
public const UNSAFE = 'unsafe';
+ public const UNTIL = 'until';
public const UPDATE = 'update';
public const USAGE = 'usage';
public const USER = 'user';
public const USER_CURRENT = 'current_user';
public const USER_SESSION = 'session_user';
public const USING = 'using';
- public const USING_INDEX = 'using index';
+ public const VALID = 'valid';
+ public const VALIDATE = 'validate';
public const VALIDATOR = 'validator';
- public const VALIDATE_CONSTRAINT = 'validate constraint';
- public const VALID_UNTIL = 'valid until';
+ public const VALUE = 'value';
+ public const VALUES = 'values';
public const VARIADIC = 'variadic';
public const VERSION = 'version';
public const VOLATILE = 'volatile';
public const VIEW = 'view';
+ public const WRAPPER = 'wrapper';
public const WITH = 'with';
- public const WITH_DICTIONARY = 'with dictionary';
- public const WITHOUT_CLUSTER = 'without cluster';
- public const WITH_CHECK = 'with check';
- public const WITH_GRANT_OPTION = 'with grant option';
+ public const WITHOUT = 'without';
+ public const WRITE = 'write';
}
--- /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 analyze options.
+ */
+class e_database_analyze_option {
+ public const NONE = 0;
+ public const VERBOSE = 1;
+}
--- /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 SET/DROP DEFAULT for columns and related queries.
+ */
+class e_database_set_column_default {
+ public const NONE = 0;
+ public const DROP = 1;
+ public const SET = 2;
+}
--- /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 transaction action information.
+ */
+class e_database_transaction_action {
+ public const NONE = 0;
+ public const TRANSACTION = 1;
+ public const WORK = 2;
+}
--- /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 transaction mode information.
+ */
+class e_database_transaction_mode {
+ public const NONE = 0;
+ public const DEFERRABLE = 1;
+ public const ISOLATION_LEVEL_REPEATABLE_READ = 2;
+ public const ISOLATION_LEVEL_READ_COMMITTED = 3;
+ public const ISOLATION_LEVEL_READ_UNCOMMITTED = 4;
+ public const ISOLATION_LEVEL_SERIALIZABLE = 5;
+ public const NOT_DEFERRABLE = 6;
+ public const READ_WRITE = 7;
+ public const READ_ONLY = 8;
+}
--- /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 view option information.
+ */
+class e_database_view_option {
+ public const NONE = 0;
+ public const CHECK_OPTION = 1;
+ public const SECURITY_BARRIER = 2;
+}
protected $action;
/**
- * Set the settings.
+ * Assign the settings.
*
* @param string|null $name
* The type action name.
protected $action_add_column;
/**
- * Set the action ADD COLUMN settings.
+ * Assign the settings.
*
* @param string|null $column_name
* The column name to use.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_action_add_column() {
- $value = c_database_string::ADD_COLUMN . ' ' . $this->action_add_column['column_name'] . ' ' . $this->action_add_column['data_type'];
+ $value = c_database_string::ADD . ' ' . c_database_string::COLUMN . ' ' . $this->action_add_column['column_name'] . ' ' . $this->action_add_column['data_type'];
if (!is_null($this->action_add_column['collate'])) {
$value .= ' ' . $this->action_add_column['collate'];
}
protected $action_alter_column;
/**
- * Set the action ALTER COLUMN settings.
+ * Assign the settings.
*
* @param string|null $column_name
* The column name to use.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_action_alter_column() {
- $value = c_database_string::ALTER_COLUMN . ' ' . $this->action_alter_column['column_name'];
+ $value = c_database_string::ALTER . ' ' . c_database_string::COLUMN . ' ' . $this->action_alter_column['column_name'];
switch ($this->action_alter_column['type']) {
case e_database_alter_column::DROP:
$value .= ' ' . c_database_string::DROP;
if ($this->action_alter_column['value']) {
- $value .= ' ' . c_database_string::NOT_NULL;
+ $value .= ' ' . c_database_string::NOT . ' ' . c_database_string::NULL;
}
break;
case e_database_alter_column::SET:
$value .= ' ' . c_database_string::SET;
if ($this->action_alter_column['value']) {
- $value .= ' ' . c_database_string::NOT_NULL;
+ $value .= ' ' . c_database_string::NOT . ' ' . c_database_string::NULL;
}
break;
case e_database_alter_column::DROP_DEFAULT:
- $value .= ' ' . c_database_string::DROP_DEFAULT;
+ $value .= ' ' . c_database_string::DROP . ' ' . c_database_string::DEFAULT;
break;
case e_database_alter_column::SET_DATA:
- $value .= ' ' . c_database_string::SET_DATA;
+ $value .= ' ' . c_database_string::SET . ' ' . c_database_string::DATA;
$value .= ' ' . c_database_string::TYPE;
$value .= ' ' . strval($this->action_alter_column['value']);
if (isset($this->action_alter_column['value2'])) {
break;
case e_database_alter_column::SET_DEFAULT:
- $value .= ' ' . c_database_string::SET_DEFAULT;
+ $value .= ' ' . c_database_string::SET . ' ' . c_database_string::DEFAULT;
$value .= ' ' . strval($this->action_alter_column['value']);
break;
break;
case e_database_alter_column::SET_STORAGE:
- $value .= ' ' . c_database_string::SET_STORAGE;
+ $value .= ' ' . c_database_string::SET . ' ' . c_database_string::STORAGE;
if ($this->action_alter_column['value'] === e_database_set_storage::EXTENDED) {
$value .= ' ' . c_database_string::EXTENDED;
}
protected $action_alter_column_options;
/**
- * Set the OPTIONS settings.
+ * Assign the settings.
*
* @param string|null $column_name
* The column name to use.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_action_alter_column_options() {
- $value = c_database_string::ALTER_COLUMN . ' ' . $this->action_alter_column_options['column_name'] . ' ' . c_database_string::OPTIONS;
+ $value = c_database_string::ALTER . ' ' . c_database_string::COLUMN . ' ' . $this->action_alter_column_options['column_name'] . ' ' . c_database_string::OPTIONS;
$values = [];
foreach ($this->action_alter_column_options['values'] as $set) {
protected $action_alter_column_reset;
/**
- * Set the RESET attribute option settings.
+ * Assign the settings.
*
* @param string|null $column_name
* The column name to use.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_action_alter_column_reset() {
- $value = c_database_string::ALTER_COLUMN . ' ' . $this->action_alter_column_reset['column_name'] . ' ' . c_database_string::RESET;
+ $value = c_database_string::ALTER . ' ' . c_database_string::COLUMN . ' ' . $this->action_alter_column_reset['column_name'] . ' ' . c_database_string::RESET;
$values = [];
foreach ($this->action_alter_column_reset['values'] as $reset) {
protected $action_alter_column_set;
/**
- * Set the SET attribute option settings.
+ * Assign the settings.
*
* @param string|null $column_name
* The column name to use.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_action_alter_column_set() {
- $value = c_database_string::ALTER_COLUMN . ' ' . $this->action_alter_column_set['column_name'] . ' ' . c_database_string::SET;
+ $value = c_database_string::ALTER . ' ' . c_database_string::COLUMN . ' ' . $this->action_alter_column_set['column_name'] . ' ' . c_database_string::SET;
$values = [];
foreach ($this->action_alter_column_set['values'] as $set) {
protected $action_cluster_on;
/**
- * Set the action CLUSTER ON settings.
+ * Assign the settings.
*
* @param string|null $name
* The index name to use.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_action_cluster_on() {
- return c_database_string::CLUSTER_ON . ' ' . $this->action_cluster_on;
+ return c_database_string::CLUSTER . ' ' . c_database_string::ON . ' ' . $this->action_cluster_on;
}
}
protected $action_constraint;
/**
- * Set the ADD/ALTER/VALIDATE/DROP action CONSTRAINT settings.
+ * Assign the settings.
*
* @param string|null $action_constraint_name
* The name to use.
$value = c_database_string::ADD . ' ' . $this->action_constraint['name'];
if ($this->action_constraint['value']) {
- $value .= ' ' . c_database_string::NOT_VALID;
+ $value .= ' ' . c_database_string::NOT . ' ' . c_database_string::VALID;
}
}
else if ($this->action_constraint['type'] === e_database_constraint::ALTER) {
- $value = c_database_string::ALTER_CONSTRAINT . ' ' . $this->action_constraint['name'];
+ $value = c_database_string::ALTER . ' ' . c_database_string::CONSTRAINT . ' ' . $this->action_constraint['name'];
if ($this->action_constraint['value'] === e_database_constraint_mode::DEFERRABLE) {
$value .= ' ' . c_database_string::DEFERRABLE;
}
else if ($this->action_constraint['value'] === e_database_constraint_mode::INITIALLY_DEFERRED) {
- $value .= ' ' . c_database_string::INITIALLY_DEFERRED;
+ $value .= ' ' . c_database_string::INITIALLY . ' ' . c_database_string::DEFERRED;
}
else if ($this->action_constraint['value'] === e_database_constraint_mode::INITIALLY_IMMEDIATE) {
- $value .= ' ' . c_database_string::INITIALLY_IMMEDIATE;
+ $value .= ' ' . c_database_string::INITIALLY . ' ' . c_database_string::IMMEDIATE;
}
else if ($this->action_constraint['value'] === e_database_constraint_mode::NOT_DEFERRABLE) {
- $value .= ' ' . c_database_string::NOT_DEFERRABLE;
+ $value .= ' ' . c_database_string::NOT . ' ' . c_database_string::DEFERRABLE;
}
}
else if ($this->action_constraint['type'] === e_database_constraint::DROP) {
- $value = c_database_string::DROP_CONSTRAINT . ' ' . $this->action_constraint['name'];
+ $value = c_database_string::DROP . ' ' . c_database_string::CONSTRAINT . ' ' . $this->action_constraint['name'];
}
else if ($this->action_constraint['type'] === e_database_constraint::VALIDATE) {
$value = c_database_string::VALIDATE_CONSTAINT;
if ($this->action_constraint['value']) {
- $value .= ' ' . c_database_string::NOT_VALID;
+ $value .= ' ' . c_database_string::NOT . ' ' . c_database_string::VALID;
}
$value .=' ' . $this->action_constraint['name'];
protected $action_disable_rule;
/**
- * Set the action DISABLE RULE value.
+ * Assign the settings.
*
* @param string|null $name
* A string representing the rule name.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_action_disable_rule() {
- return c_database_string::DISABLE_RULE . ' ' . $this->action_disable_rule;
+ return c_database_string::DISABLE . ' ' . c_database_string::RULE . ' ' . $this->action_disable_rule;
}
}
protected $action_disable_trigger;
/**
- * Set the action DISABLE TRIGGER value.
+ * Assign the settings.
*
* @param int|null $type
* An integer representing the type of the trigger.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_action_disable_trigger() {
- $value = c_database_string::DISABLE_TRIGGER;
+ $value = c_database_string::DISABLE . ' ' . c_database_string::TRIGGER;
if ($this->action_disable_trigger['type'] === e_database_trigger::NAME) {
if (is_string($this->action_disable_trigger['name'])) {
protected $action_drop_column;
/**
- * Set the action DROP COLUMN settings.
+ * Assign the settings.
*
* @param string|null $column_name
* The column name to use.
protected $action_enable_rule;
/**
- * Set the action ENABLE RULE value.
+ * Assign the settings.
*
* @param int|null $type
* An integer representing the type of the rule.
if ($this->action_enable_rule['type'] === e_database_rule::ALWAYS || $this->action_enable_rule['type'] === e_database_rule::REPLICA) {
if (is_string($this->action_enable_rule['name'])) {
if ($this->action_enable_rule['type'] === e_database_rule::ALWAYS) {
- $value = c_database_string::ENABLE_ALWAYS_RULE . ' ' . $this->action_enable_rule['name'];
+ $value = c_database_string::ENABLE . ' ' . c_database_string::ALWAYS . ' ' . c_database_string::RULE . ' ' . $this->action_enable_rule['name'];
}
else if ($this->action_enable_rule['type'] === e_database_rule::REPLICA) {
- $value = c_database_string::ENABLE_REPLICA_RULE . ' ' . $this->action_enable_rule['name'];
+ $value = c_database_string::ENABLE . ' ' . c_database_string::REPLICA . ' ' . c_database_string::RULE . ' ' . $this->action_enable_rule['name'];
}
}
}
else if ($this->action_enable_rule['type'] === e_database_rule::NAME) {
if (is_string($this->action_enable_rule['name'])) {
- $value = c_database_string::ENABLE_RULE . ' ' . $this->action_enable_rule['name'];
+ $value = c_database_string::ENABLE . ' ' . c_database_string::RULE . ' ' . $this->action_enable_rule['name'];
}
}
else if ($this->action_enable_rule['type'] === e_database_rule::ALL) {
- $value = c_database_string::ENABLE_RULE . ' ' . c_database_string::ALL;
+ $value = c_database_string::ENABLE . ' ' . c_database_string::RULE . ' ' . c_database_string::ALL;
}
else if ($this->action_enable_rule['type'] === e_database_rule::USER) {
- $value = c_database_string::ENABLE_RULE . ' ' . c_database_string::USER;
+ $value = c_database_string::ENABLE . ' ' . c_database_string::RULE . ' ' . c_database_string::USER;
}
return $value;
protected $action_enable_trigger;
/**
- * Set the action ENABLE TRIGGER value.
+ * Assign the settings.
*
* @param int|null $type
* An integer representing the type of the trigger.
if ($this->action_enable_trigger['type'] === e_database_trigger::ALWAYS || $this->action_enable_trigger['type'] === e_database_trigger::REPLICA) {
if (is_string($this->action_enable_trigger['name'])) {
if ($this->action_enable_trigger['type'] === e_database_trigger::ALWAYS) {
- $value = c_database_string::ENABLE_ALWAYS_TRIGGER . ' ' . $this->action_enable_trigger['name'];
+ $value = c_database_string::ENABLE . ' ' . c_database_string::ALWAYS . ' ' . c_database_string::TRIGGER . ' ' . $this->action_enable_trigger['name'];
}
else if ($this->action_enable_trigger['type'] === e_database_trigger::REPLICA) {
- $value = c_database_string::ENABLE_REPLICA_TRIGGER . ' ' . $this->action_enable_trigger['name'];
+ $value = c_database_string::ENABLE . ' ' . c_database_string::REPLICA . ' ' . c_database_string::TRIGGER . ' ' . $this->action_enable_trigger['name'];
}
}
}
else if ($this->action_enable_trigger['type'] === e_database_trigger::NAME) {
if (is_string($this->action_enable_trigger['name'])) {
- $value = c_database_string::ENABLE_TRIGGER . ' ' . $this->action_enable_trigger['name'];
+ $value = c_database_string::ENABLE . ' ' . c_database_string::TRIGGER . ' ' . $this->action_enable_trigger['name'];
}
}
else if ($this->action_enable_trigger['type'] === e_database_trigger::ALL) {
- $value = c_database_string::ENABLE_TRIGGER . ' ' . c_database_string::ALL;
+ $value = c_database_string::ENABLE . ' ' . c_database_string::TRIGGER . ' ' . c_database_string::ALL;
}
else if ($this->action_enable_trigger['type'] === e_database_trigger::USER) {
- $value = c_database_string::ENABLE_TRIGGER . ' ' . c_database_string::USER;
+ $value = c_database_string::ENABLE . ' ' . c_database_string::TRIGGER . ' ' . c_database_string::USER;
}
return $value;
protected $mapping_for;
/**
- * Set the MAPPING FOR settings.
+ * Assign the settings.
*
* Set all parameters to NULL to reset data to NULL.
*
$value = NULL;
if ($this->mapping_for['type'] === e_database_mapping_for::ADD) {
- $value = c_database_string::ADD . ' ' . c_database_string::MAPPING_FOR;
+ $value = c_database_string::ADD . ' ' . c_database_string::MAPPING . ' ' . c_database_string::FOR;
}
else if ($this->mapping_for['type'] === e_database_mapping_for::ALTER) {
- $value = c_database_string::ALTER . ' ' . c_database_string::MAPPING_FOR;
+ $value = c_database_string::ALTER . ' ' . c_database_string::MAPPING . ' ' . c_database_string::FOR;
}
else if ($this->mapping_for['type'] === e_database_mapping_for::DROP) {
- $value = c_database_string::DROP_MAPPING;
+ $value = c_database_string::DROP . ' ' . c_database_string::MAPPING;
if ($this->mapping_for['if_exists']) {
- $value .= ' ' . c_database_string::IF_EXISTS;
+ $value .= ' ' . c_database_string::IF . ' ' . c_database_string::EXISTS;
}
$value .= ' ' . c_database_string::FOR;
protected $action_not_of;
/**
- * Set the action NOT OF settings.
+ * Assign the settings.
*
* @param bool|null $not_of
* Set to TRUE to enable.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_action_not_of() {
- return $this->action_not_of ? c_database_string::NOT_OF : NULL;
+ return $this->action_not_of ? c_database_string::NOT . ' ' . c_database_string::OF : NULL;
}
}
protected $action_of;
/**
- * Set the action OF settings.
+ * Assign the settings.
*
* @param string|null $type_name
* The of type name to set to.
protected $action_options;
/**
- * Set the in action_options.
+ * Assign the settings.
*
* @param string|null $type
* The option type to use.
protected $action_replica_identity;
/**
- * Set the REPLICA IDENTITY attribute option settings.
+ * Assign the settings.
*
* @param int|null $type
* An integer of e_database_replica_identity to use.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_action_replica_identity() {
- $value = c_database_string::REPLICA_IDENTITY;
+ $value = c_database_string::REPLICA . ' ' . c_database_string::IDENTITY;
if ($this->action_replica_identity['type'] === e_database_replica_identity::DEFAULT) {
$value .= ' ' . c_database_string::DEFAULT;
$value .= ' ' . c_database_string::NOTHING;
}
else if ($this->action_replica_identity['type'] === e_database_replica_identity::USING_INDEX) {
- $value .= ' ' . c_database_string::USING_INDEX;
+ $value .= ' ' . c_database_string::USING . ' ' . c_database_string::INDEX;
$value .= ' ' . $this->action_replica_identity['name'];
}
protected $action_row_level_security;
/**
- * Set the ROW LEVEL SECURITY attribute option settings.
+ * Assign the settings.
*
* @param int|null $type
* An integer of e_database_row_level_security to use.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_action_row_level_security() {
- $value = c_database_string::REPLICA_IDENTITY;
+ $value = c_database_string::REPLICA . ' ' . c_database_string::IDENTITY;
if ($this->action_row_level_security['type'] === e_database_row_level_security::DISABLE) {
$value .= ' ' . c_database_string::DISABLE;
$value .= ' ' . c_database_string::NO_FORCE;
}
- $value .= ' ' . c_database_string::ROW_LEVEL_SECURITY;
+ $value .= ' ' . c_database_string::ROW . ' ' . c_database_string::LEVEL . ' ' . c_database_string::SECURITY;
return $value;
}
}
protected $action_set_logged;
/**
- * Set the action SET LOGGED / SET UNLOGGED settings.
+ * Assign the settings.
*
* @param bool|null $logged
* Set to TRUE for logged.
*/
protected function p_do_build_action_set_logged() {
if ($this->action_set_logged) {
- return c_database_string::SET_LOGGED;
+ return c_database_string::SET . ' ' . c_database_string::LOGGED;
}
- return c_database_string::SET_UNLOGGED;
+ return c_database_string::SET . ' ' . c_database_string::UNLOGGED;
}
}
protected $action_set_tablespace;
/**
- * Set the action SET TABLESPACE settings.
+ * Assign the settings.
*
* @param string|null $name
* The tablespace name to set to.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_action_set_tablespace() {
- return c_database_string::SET_TABLESPACE . ' ' . $this->action_set_tablespace;
+ return c_database_string::SET . ' ' . c_database_string::TABLESPACE . ' ' . $this->action_set_tablespace;
}
}
protected $action_without_cluster;
/**
- * Set the WITHOUT CLUSTER value.
+ * Assign the settings.
*
* @param bool|null $without_cluster
* Set to TRUE for WITHOUT CLUSTER.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_action_without_cluster() {
- return $this->action_without_cluster ? c_database_string::WITHOUT_CLUSTER : NULL;
+ return $this->action_without_cluster ? c_database_string::WITHOUT . ' ' . c_database_string::CLUSTER : NULL;
}
}
protected $add_operator_family;
/**
- * Set the add user or drop user.
+ * Assign the settings.
*
* @param bool|null $add
* Set to TRUE for ADD OPERATOR.
if ($add_operator_family['add'] && $add_operator_family['type'] === e_database_operator_family::OPERATOR) {
if ($add_operator_family['for_type'] === e_database_operator_for::FOR_ORDER_BY) {
- $value .= ' ' . c_database_string::FOR_ORDER_BY;
+ $value .= ' ' . c_database_string::FOR . ' ' . c_database_string::ORDER . ' ' . c_database_string::BY;
if (isset($add_operator_family['sort_family_name'])) {
$value .= ' ' . $add_operator_family['sort_family_name'];
}
}
else if ($add_operator_family['for_type'] === e_database_operator_for::FOR_SEARCH) {
- $value .= ' ' . c_database_string::FOR_SEARCH;
+ $value .= ' ' . c_database_string::FOR . ' ' . c_database_string::SEARCH;
}
}
protected $add_table;
/**
- * Set the ADD TABLE settings.
+ * Assign the settings.
*
* @param string|null $name
* The table name.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_add_table() {
- $value = c_database_string::ADD_TABLE;
+ $value = c_database_string::ADD . ' ' . c_database_string::TABLE;
if ($this->add_table['only']) {
$value .= ' ' . c_database_string::ONLY;
protected $add_user;
/**
- * Set the add user or drop user.
+ * Assign the settings.
*
* @param string|int|bool|null $name
* The user name (role name) to use.
protected $add_value;
/**
- * Set the SET WITH OIDS value.
+ * Assign the settings.
*
* @param string|null $new_enum_value
* The enum value to use.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_add_value() {
- $value = c_database_string::ADD_VALUE;
+ $value = c_database_string::ADD . ' ' . c_database_string::VALUE;
// @todo: confirm/deny whether or not the placeholder will be auto-quoted by PDO.
$value .= ' \'' . $this->add_value['new_enum_value'] . '\'';
if ($this->add_value['if_not_exists']) {
- $value .= ' ' . c_database_string::IF_NOT_EXISTS;
+ $value .= ' ' . c_database_string::IF . ' ' . c_database_string::NOT . ' ' . c_database_string::EXISTS;
}
if (is_int($this->add_value['position'])) {
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides traits for specific Postgesql Queries.
+ *
+ * @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_set_column_default.php');
+
+/**
+ * Provide the sql SET DEFAULT / DROP DEFAULT functionality.
+ */
+trait t_database_alter_column {
+ protected $alter_column;
+
+ /**
+ * Assign the settings.
+ *
+ * @param string|null $name
+ * The column name to set to.
+ * Set to NULL to disable.
+ * @param int|null $type
+ * (optional) The e_database_set_column_default to assign.
+ * Required when $name is not NULL.
+ * @param string|null $expression
+ * (optional) The expression to use.
+ * This may be required or ignored depending on $type.
+ *
+ * @return c_base_return_status
+ * TRUE on success, FALSE otherwise.
+ * FALSE with the error bit set is returned on error.
+ */
+ public function set_alter_column($name, $type = NULL, $expression = NULL) {
+ if (is_null($name)) {
+ $this->alter_column = NULL;
+ return new c_base_return_true();
+ }
+
+ if (!is_string($name)) {
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'name', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ switch ($type) {
+ case e_database_set_column_default::DROP:
+ $placeholder_expression = NULL;
+ break;
+
+ case e_database_set_column_default::SET:
+ if (!is_string($expression)) {
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'expression', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $placeholder_expression = $this->add_placeholder($expression);
+ if ($placeholder_expression->has_error()) {
+ return c_base_return_error::s_false($placeholder_expression->get_error());
+ }
+
+ break;
+
+ default:
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'type', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $placeholder_name = $this->add_placeholder($name);
+ if ($placeholder_name->has_error()) {
+ unset($placeholder_expression);
+ return c_base_return_error::s_false($placeholder_name->get_error());
+ }
+
+ $this->alter_column = [
+ 'name' => $placeholder_name,
+ 'type' => $type,
+ 'expression' => $placeholder_expression,
+ ];
+ unset($placeholder_name);
+ unset($placeholder_expression);
+
+ return new c_base_return_true();
+ }
+
+ /**
+ * Get the currently assigned tablespace name to set to.
+ *
+ * @return c_base_return_array|c_base_return_null
+ * An array of settings.
+ * NULL is returned if not set.
+ * NULL with the error bit set is returned on error.
+ */
+ public function get_alter_column() {
+ if (is_null($this->alter_column)) {
+ return new c_base_return_null();
+ }
+
+ if (is_array($this->alter_column)) {
+ return c_base_return_array::s_new($this->alter_column);
+ }
+
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'alter_column', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE);
+ return c_base_return_error::s_null($error);
+ }
+
+ /**
+ * Perform the common build process for this trait.
+ *
+ * As an internal trait method, the caller is expected to perform any appropriate validation.
+ *
+ * @return string|null
+ * A string is returned.
+ * NULL is returned if there is nothing to process or there is an error.
+ */
+ protected function p_do_build_alter_column() {
+ $value = c_database_string::ALTER . ' ' . c_database_string::COLUMN . ' ' . $this->alter_column['name'];
+
+ if ($this->alter_column['type'] === e_database_set_column_default::DROP) {
+ $value .= ' ' . c_database_string::DROP . ' ' . c_database_string::DEFAULT;
+ }
+ else if ($this->alter_column['type'] === e_database_set_column_default::SET) {
+ $value .= ' ' . c_database_string::SET_DEFAULT;
+ $value .= ' ' . $this->alter_column['expression'];
+ }
+
+ return $value;
+ }
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides traits for specific Postgesql Queries.
+ *
+ * @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_analyze_option.php');
+
+/**
+ * Provide the sql ANALYZE options functionality.
+ */
+trait t_database_analyze_options {
+ protected $analyze_options;
+
+ /**
+ * Assign the settings.
+ *
+ * @param int|null $attribute_option
+ * The attribute option code to assign.
+ * Should be one of: e_database_analyze_option.
+ * When both this and $name are NULL, then column reset is disabled.
+ *
+ * @return c_base_return_status
+ * TRUE on success, FALSE otherwise.
+ * FALSE with the error bit set is returned on error.
+ */
+ public function set_analyze_options($option) {
+ if (is_null($option)) {
+ $this->analyze_options = NULL;
+ return new c_base_return_true();
+ }
+
+ switch ($option) {
+ case e_database_analyze_option::VERBOSE:
+ break;
+ case NULL:
+ break;
+ default:
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'option', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ if (!is_array($this->analyze_options)) {
+ $this->analyze_options = [];
+ }
+
+ $this->analyze_options[] = $option;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Get the currently assigned settings.
+ *
+ * @return c_base_return_array|c_base_return_null
+ * An array of codes representing the argument_type on success.
+ * NULL is returned if not set.
+ * NULL with the error bit set is returned on error.
+ */
+ public function get_analyze_options() {
+ if (is_null($this->analyze_options)) {
+ return new c_base_return_null();
+ }
+
+ if (is_array($this->analyze_options)) {
+ return c_base_return_array::s_new($this->analyze_options);
+ }
+
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'analyze_options', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE);
+ return c_base_return_error::s_null($error);
+ }
+
+ /**
+ * Perform the common build process for this trait.
+ *
+ * As an internal trait method, the caller is expected to perform any appropriate validation.
+ *
+ * @return string|null
+ * A string is returned.
+ * NULL is returned if there is nothing to process or there is an error.
+ */
+ protected function p_do_build_analyze_options() {
+ $values = [];
+ foreach ($this->analyze_options as $analyze_option) {
+ if ($analyze_option === e_database_attribute_option::VERBOSE) {
+ $values[] = c_database_string::VERBOSE;
+ }
+ }
+ unset($analyze_option);
+
+ return implode(', ', $values);
+ }
+}
protected $argument_type;
/**
- * Set the argument type settings.
+ * Assign the settings.
*
* @param string|null $argument_type
* The argument type to assign.
protected $as_data_type;
/**
- * Set the AS data type settings.
+ * Assign the settings.
*
* @param string|null $type
* The data type to use.
protected $attach_partition;
/**
- * Set the ATTACH PARTITION settings.
+ * Assign the settings.
*
* @param string|null $name
* The partition name to use.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_attach_partition() {
- return c_database_string::ATTACH_PARTITION . ' ' . $this->attach_partition['name'] . ' ' . c_database_string::FOR_VALUES . ' ' . $this->attach_partition['bound_spec'];
+ return c_database_string::ATTACH . ' ' . c_database_string::PARTITION . ' ' . $this->attach_partition['name'] . ' ' . c_database_string::FOR . ' ' . c_database_string::VALUES . ' ' . $this->attach_partition['bound_spec'];
}
}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides traits for specific Postgesql Queries.
+ *
+ * @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_transaction_action.php');
+
+/**
+ * Provide the sql BEGIN functionality.
+ */
+trait t_database_begin {
+ protected $begin;
+
+ /**
+ * Assign the settings.
+ *
+ * @param int|null $begin
+ * The begin code from e_database_transaction_action.
+ * Set to NULL to disable.
+ *
+ * @return c_base_return_status
+ * TRUE on success, FALSE otherwise.
+ * FALSE with the error bit set is returned on error.
+ */
+ public function set_begin($begin) {
+ if (is_null($begin)) {
+ $this->begin = NULL;
+ return new c_base_return_true();
+ }
+
+ switch ($begin) {
+ case e_database_transaction_action::TRANSACTION:
+ case e_database_transaction_action::WORK:
+ break;
+
+ default:
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'begin', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->begin = $begin;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Get the currently assigned settings.
+ *
+ * @return c_base_return_int|c_base_return_null
+ * A e_database_transaction_action on success.
+ * NULL is returned if not set (begin is not to be used).
+ * NULL with the error bit set is returned on error.
+ */
+ public function get_begin() {
+ if (is_null($this->begin)) {
+ return new c_base_return_null();
+ }
+
+ if (is_int($this->begin)) {
+ return c_base_return_int::s_new($this->begin);
+ }
+
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'begin', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE);
+ return c_base_return_error::s_null($error);
+ }
+
+ /**
+ * Perform the common build process for this trait.
+ *
+ * As an internal trait method, the caller is expected to perform any appropriate validation.
+ *
+ * @return string|null
+ * A string is returned.
+ * NULL is returned if there is nothing to process or there is an error.
+ */
+ protected function p_do_build_begin() {
+ $value = NULL;
+ if ($this->begin === e_database_transaction_action::TRANSACTION) {
+ $value = c_database_string::TRANSACTION;
+ }
+ else if ($this->begin === e_database_transaction_action::WORK) {
+ $value = c_database_string::WORK;
+ }
+
+ return $value;
+ }
+}
protected $cache;
/**
- * Set the CACHE settings.
+ * Assign the settings.
*
* @param int|null $sequence
* The cache sequence number to use.
protected $cascade;
/**
- * Set the HANDLER settings.
+ * Assign the settings.
*
* @param int|null $cascade
* The integer representing cascade/no-cascade.
protected $cluster_on;
/**
- * Set the CLUSTER ON settings.
+ * Assign the settings.
*
* @param string|null $index_name
* The index name to use.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_cluster_on() {
- return c_database_string::CLUSTER_ON . ' ' . strval($this->cluster_on);
+ return c_database_string::CLUSTER . ' ' . c_database_string::ON . ' ' . $this->cluster_on;
}
}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides traits for specific Postgesql Queries.
+ *
+ * @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/interfaces/database_query_placeholder.php');
+
+/**
+ * Provide the sql GROUP BY functionality.
+ */
+trait t_database_column_names {
+ protected $column_names;
+
+ /**
+ * Assign the settings.
+ *
+ * @param string|null $name
+ * The column name to use.
+ * Set to NULL to disable.
+ *
+ * @return c_base_return_status
+ * TRUE on success, FALSE otherwise.
+ * FALSE with the error bit set is returned on error.
+ */
+ public function set_column_names($name) {
+ if (is_null($name)) {
+ $this->column_names = NULL;
+ return new c_base_return_true();
+ }
+
+ if (!is_string($name)) {
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'name', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ if (!is_array($this->column_names)) {
+ $this->column_names = [];
+ }
+
+ $placeholder = $this->add_placeholder($name);
+ if ($placeholder->has_error()) {
+ return c_base_return_error::s_false($placeholder->get_error());
+ }
+
+ $this->column_names[] = $placeholder;
+ unset($placeholder);
+
+ return new c_base_return_true();
+ }
+
+ /**
+ * Get the currently assigned settings.
+ *
+ * @return c_base_return_array|c_base_return_null
+ * An array of group by values or NULL if not defined.
+ * NULL with the error bit set is returned on error.
+ */
+ public function get_column_names() {
+ if (is_null($this->column_names)) {
+ return new c_base_return_null();
+ }
+
+ if (is_array($this->column_names)) {
+ return c_base_return_array::s_new($this->column_names);
+ }
+
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'column_names', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE);
+ return c_base_return_error::s_null($error);
+ }
+
+ /**
+ * Perform the common build process for this trait.
+ *
+ * As an internal trait method, the caller is expected to perform any appropriate validation.
+ *
+ * @return string|null
+ * A string is returned.
+ * NULL is returned if there is nothing to process or there is an error.
+ */
+ protected function p_do_build_column_names() {
+ return implode(', ', $this->column_names);
+ }
+}
protected $column_reset;
/**
- * Set the COLUMN_RESET (attribute_option ...) settings.
+ * Assign the settings.
*
* @param int|null $attribute_option
* The attribute option code to assign.
}
/**
- * Get the currently assigned COLUMN_RESET attribute option.
+ * Get the currently assigned settings.
*
* @return c_base_return_array|c_base_return_null
* An array of codes representing the argument_type on success.
protected $column_set;
/**
- * Set the SET index (attribute_option ...) settings.
+ * Assign the settings.
*
* @param int|null $attribute_option
* The attribute option code to assign.
}
/**
- * Get the currently assigned COLUMN .. SET index attribute option.
+ * Get the currently assigned settings.
*
* @return c_base_return_array|c_base_return_null
* An array containing the set index attribute option settings.
protected $column_set_statistics;
/**
- * Set the COLUMN .. SET STATISTICS settings.
+ * Assign the settings.
*
* @param string|null $name
* The column name.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_column_set_statistics() {
- return c_database_string::COLUMN . ' ' . $this->column_set_statistics['name'] . ' ' . c_database_string::SET_STATISTICS . ' ' . $this->column_set_statistics['value'];
+ return c_database_string::COLUMN . ' ' . $this->column_set_statistics['name'] . ' ' . c_database_string::SET . ' ' . c_database_string::STATISTICS . ' ' . $this->column_set_statistics['value'];
}
}
protected $column_set_storage;
/**
- * Set the COLUMN .. SET STORAGE settings.
+ * Assign the settings.
*
* @param string|null $name
* The column name.
protected $connection;
/**
- * Set the CONNECTION settings.
+ * Assign the settings.
*
* @param string|null $value
* The connection information to use.
protected $constraint;
/**
- * Set the ADD/VALIDATE/DROP CONSTRAINT settings.
+ * Assign the settings.
*
* @param string|null $constraint_name
* The name to use.
$value = c_database_string::ADD . ' ' . $this->constraint['name']->get_name();
if ($this->constraint['exists_or_invalid']) {
- $value .= ' ' . c_database_string::NOT_VALID;
+ $value .= ' ' . c_database_string::NOT . ' ' . c_database_string::VALID;
}
}
else if ($this->constraint['type'] === e_database_constraint::DROP) {
- $value = c_database_string::DROP_CONSTRAINT . ' ' . $this->constraint['name'];
+ $value = c_database_string::DROP . ' ' . c_database_string::CONSTRAINT . ' ' . $this->constraint['name'];
}
else if ($this->constraint['type'] === e_database_constraint::VALIDATE) {
$value = c_database_string::VALIDATE_CONSTAINT;
if ($this->constraint['exists_or_invalid']) {
- $value .= ' ' . c_database_string::NOT_VALID;
+ $value .= ' ' . c_database_string::NOT . ' ' . c_database_string::VALID;
}
$value .=' ' . $this->constraint['name'];
protected $cycle;
/**
- * Set the CYCLE settings.
+ * Assign the settings.
*
* @param bool|null $cycle
* Set to TRUE for CYCLE.
protected $depends_on_extension;
/**
- * Set the RENAME TO settings.
+ * Assign the settings.
*
* @param string|null $depends_on_extension
* The name to rename to.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_depends_on_extension() {
- return c_database_string::DEPENDS_ON_EXTENSION . ' ' . $this->depends_on_extension;
+ return c_database_string::DEPENDS . ' ' . c_database_string::ON . ' ' . c_database_string::EXTENSION . ' ' . $this->depends_on_extension;
}
}
protected $detach_partition;
/**
- * Set the ATTACH PARTITION settings.
+ * Assign the settings.
*
* @param string|null $name
* The partition name to use.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_detach_partition() {
- return c_database_string::ATTACH_PARTITION . ' ' . $this->detach_partition['name'] . ' ' . c_database_string::FOR_VALUES . ' ' . $this->detach_partition['bound_spec'];
+ return c_database_string::ATTACH . ' ' . c_database_string::PARTITION . ' ' . $this->detach_partition['name'] . ' ' . c_database_string::FOR . ' ' . c_database_string::VALUES . ' ' . $this->detach_partition['bound_spec'];
}
}
protected $disable;
/**
- * Set the DISABLE settings.
+ * Assign the settings.
*
* @param bool|null $disable
* Set to TRUE for DISABLE.
protected $disable_trigger;
/**
- * Set the DISABLE TRIGGER value.
+ * Assign the settings.
*
* @param int|null $type
* An integer representing the type of the trigger.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_disable_trigger() {
- $value = c_database_string::DISABLE_TRIGGER;
+ $value = c_database_string::DISABLE . ' ' . c_database_string::TRIGGER;
if ($this->disable_trigger['type'] === e_database_trigger::NAME) {
if (is_string($this->disable_trigger['name'])) {
protected $drop_value;
/**
- * Set the DROP TABLE settings.
+ * Assign the settings.
*
* @param string|null $name
* The table name.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_drop_value() {
- $value = c_database_string::DROP_TABLE;
+ $value = c_database_string::DROP . ' ' . c_database_string::TABLE;
if ($this->drop_value['only']) {
$value .= ' ' . c_database_string::ONLY;
protected $enable;
/**
- * Set the ENABLE settings.
+ * Assign the settings.
*
* @param bool|null $enable
* Set to TRUE for ENABLE.
protected $enable_trigger;
/**
- * Set the ENABLE TRIGGER value.
+ * Assign the settings.
*
* @param int|null $type
* An integer representing the type of the trigger.
if ($this->enable_trigger['type'] === e_database_trigger::ALWAYS || $this->enable_trigger['type'] === e_database_trigger::REPLICA) {
if (is_string($this->enable_trigger['name'])) {
if ($this->enable_trigger['type'] === e_database_trigger::ALWAYS) {
- $value = c_database_string::ENABLE_ALWAYS_TRIGGER . ' ' . $this->enable_trigger['name'];
+ $value = c_database_string::ENABLE . ' ' . c_database_string::ALWAYS . ' ' . c_database_string::TRIGGER . ' ' . $this->enable_trigger['name'];
}
else if ($this->enable_trigger['type'] === e_database_trigger::REPLICA) {
- $value = c_database_string::ENABLE_REPLICA_TRIGGER . ' ' . $this->enable_trigger['name'];
+ $value = c_database_string::ENABLE . ' ' . c_database_string::REPLICA . ' ' . c_database_string::TRIGGER . ' ' . $this->enable_trigger['name'];
}
}
}
else if ($this->enable_trigger['type'] === e_database_trigger::NAME) {
if (is_string($this->enable_trigger['name'])) {
- $value = c_database_string::ENABLE_TRIGGER . ' ' . $this->enable_trigger['name'];
+ $value = c_database_string::ENABLE . ' ' . c_database_string::TRIGGER . ' ' . $this->enable_trigger['name'];
}
}
else if ($this->enable_trigger['type'] === e_database_trigger::ALL) {
- $value = c_database_string::ENABLE_TRIGGER . ' ' . c_database_string::ALL;
+ $value = c_database_string::ENABLE . ' ' . c_database_string::TRIGGER . ' ' . c_database_string::ALL;
}
else if ($this->enable_trigger['type'] === e_database_trigger::USER) {
- $value = c_database_string::ENABLE_TRIGGER . ' ' . c_database_string::USER;
+ $value = c_database_string::ENABLE . ' ' . c_database_string::TRIGGER . ' ' . c_database_string::USER;
}
return $value;
protected $for_role;
/**
- * Set the FOR ROLE value.
+ * Assign the settings.
*
* @param string|null $for_role
* Append a role name to the list.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_for_role() {
- return c_database_string::FOR_ROLE . ' ' . implode(', ', $this->for_role);
+ return c_database_string::FOR . ' ' . c_database_string::ROLE . ' ' . implode(', ', $this->for_role);
}
}
protected $function_action;
/**
- * Set the argument type settings.
+ * Assign the settings.
*
* @param int|null $function_action
* The function action code to assign.
$values = [];
foreach ($this->function_action as $function_action) {
if ($function_action['type'] === e_database_function_action::CALLED_ON_NULL_INPUT) {
- $values[] = c_database_string::CALLED_ON_NULL_INPUT;
+ $values[] = c_database_string::CALLED . ' ' . c_database_string::ON . ' ' . c_database_string::NULL . ' ' . c_database_string::INPUT;
}
else if ($function_action['type'] === e_database_function_action::COST) {
$values[] = c_database_string::COST . ' ' . $function_action['parameter_1'];
$values[] = c_database_string::LEAKPROOF;
}
else if ($function_action['type'] === e_database_function_action::NOT_LEAKPROOF) {
- $values[] = c_database_string::NOT_LEAKPROOF;
+ $values[] = c_database_string::NOT . ' ' . c_database_string::LEAKPROOF;
}
else if ($function_action['type'] === e_database_function_action::PARALLEL_RESTRICTED) {
$values[] = c_database_string::PARALLEL_RESTRICTED;
$values[] = c_database_string::RESET;
}
else if ($function_action['type'] === e_database_function_action::RESET_ALL) {
- $values[] = c_database_string::RESET_ALL;
+ $values[] = c_database_string::RESET . ' ' . c_database_string::ALL;
}
else if ($function_action['type'] === e_database_function_action::RETURNS_NULL_ON_NULL_INPUT) {
- $values[] = c_database_string::RETURNS_NULL_ON_NULL_INPUT;
+ $values[] = c_database_string::RETURNS . ' ' . c_database_string::NULL . ' ' . c_database_string::ON . ' ' . c_database_string::NULL . ' ' . c_database_string::INPUT;
}
else if ($function_action['type'] === e_database_function_action::ROWS) {
$values[] = c_database_string::ROWS . ' ' . $function_action['parameter_1'];
}
else if ($function_action['type'] === e_database_function_action::SECURITY_DEFINER) {
- $values[] = c_database_string::SECURITY_DEFINER;
+ $values[] = c_database_string::SECURITY . ' ' . c_database_string::DEFINER;
}
else if ($function_action['type'] === e_database_function_action::SECURITY_INVOKER) {
- $values[] = c_database_string::SECURITY_INVOKER;
+ $values[] = c_database_string::SECURITY . ' ' . c_database_string::INVOKER;
}
else if ($function_action['type'] === e_database_function_action::SET_EQUAL) {
$value = is_null($function_action['parameter_2']) ? c_database_string::DEFAULT : $function_action['parameter_2'];
unset($value);
}
else if ($function_action['type'] === e_database_function_action::SET_FROM) {
- $values[] = c_database_string::SET . ' ' . $function_action['parameter_1'] . ' ' . c_database_string::FROM_CURRENT;
+ $values[] = c_database_string::SET . ' ' . $function_action['parameter_1'] . ' ' . c_database_string::FROM . ' ' . c_database_string::CURRENT;
unset($value);
}
else if ($function_action['type'] === e_database_function_action::SET_TO) {
protected $grant;
/**
- * Set the GRANT settings.
+ * Assign the settings.
*
* @param int|null $grant
* The grant/revoke code to assign.
protected $grant_option_for;
/**
- * Set the GANT OPTION FOR value.
+ * Assign the settings.
*
* @param bool|null $grant_option_for
* Set to TRUE for GANT OPTION FOR.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_grant_option_for() {
- return $this->grant_option_for ? c_database_string::GRANT_OPTION_FOR : NULL;
+ return $this->grant_option_for ? c_database_string::GRANT . ' ' . c_database_string::OPTION . ' ' . c_database_string::FOR : NULL;
}
}
protected $group_by;
/**
- * Set the GROUP BY settings.
+ * Assign the settings.
*
* @param string|null $group_by
* The name to group by.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_group_by() {
- return c_database_string::GROUP_BY . implode(', ', $this->group_by);
+ return c_database_string::GROUP . ' ' . c_database_string::BY . implode(', ', $this->group_by);
}
}
protected $handler;
/**
- * Set the HANDLER settings.
+ * Assign the settings.
*
* @param int|null $handler
* The integer representing handler/no-handler.
}
}
else if ($this->handler['type'] === e_database_handler::NO_HANDLER) {
- $value .= c_database_string::NO_HANDLER;
+ $value .= c_database_string::NO . ' ' . c_database_string::HANDLER;
}
return $value;
protected $if_exists;
/**
- * Set the IF EXISTS value.
+ * Assign the settings.
*
* @param bool|null $if_exists
* Set to TRUE for 'IF EXISTS'.
protected $if_not_exists;
/**
- * Set the IF NOT EXISTS value.
+ * Assign the settings.
*
* @param bool|null $if_not_exists
* Set to TRUE for 'IF NOT EXISTS'.
protected $in_database;
/**
- * Set the IN DATABASE settings.
+ * Assign the settings.
*
* @param string|null $name
* The database name to use.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_in_database() {
- return c_database_string::IN_DATABASE . ' ' . $this->in_database;
+ return c_database_string::IN . ' ' . c_database_string::DATABASE . ' ' . $this->in_database;
}
}
protected $in_schema;
/**
- * Set the in schema, schema names.
+ * Assign the settings.
*
* @param string|null $schema_name
* The schema name to use.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_in_schema() {
- return c_database_string::IN_SCHEMA . ' ' . implode(', ', $this->in_schema);
+ return c_database_string::IN . ' ' . c_database_string::SCHEMA . ' ' . implode(', ', $this->in_schema);
}
}
protected $increment_by;
/**
- * Set the INCREMENT BY settings.
+ * Assign the settings.
*
* @param int|null $by
* A positive or negative number to increment by.
protected $inherit;
/**
- * Set the INHERIT settings.
+ * Assign the settings.
*
* @param string|null $name
* The table name to inherit from.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_inherit() {
- $value = $this->inherit['inherit'] ? c_database_string::INHERIT : c_database_string::NO_INHERIT;
+ $value = $this->inherit['inherit'] ? c_database_string::INHERIT : c_database_string::NO . ' ' . c_database_string::INHERIT;
$value .= ' ' . $this->inherit['name'];
return $value;
}
protected $max_value;
/**
- * Set the MAXVALUE data type settings.
+ * Assign the settings.
*
* @param int|false|null $value
* A number representing the max value.
protected $min_value;
/**
- * Set the MINVALUE data type settings.
+ * Assign the settings.
*
* @param int|false|null $value
* A number representing the min value.
protected $name;
/**
- * Set the NAME settings.
+ * Assign the settings.
*
* @param string|null $name
* The name to use.
protected $no_wait;
/**
- * Set the NOWAIT value.
+ * Assign the settings.
*
* @param bool|null $no_wait
* Set to TRUE for NOWAIT.
protected $oid;
/**
- * Set the OID settings.
+ * Assign the settings.
*
* @param string|null $oid
* The oid to use.
$value = NULL;
switch($this->on) {
case e_database_on::TABLES_TO:
- $value .= c_database_string::ON_TABLES_TO;
+ $value .= c_database_string::ON . ' ' . c_database_string::TABLES . ' ' . c_database_string::TO;
break;
case e_database_on::SEQUENCES:
- $value .= c_database_string::ON_SEQUENCES;
+ $value .= c_database_string::ON . ' ' . c_database_string::SEQUENCES;
break;
case e_database_on::FUNCTIONS:
- $value .= c_database_string::ON_FUNCTIONS;
+ $value .= c_database_string::ON . ' ' . c_database_string::FUNCTIONS;
break;
case e_database_on::TYPES:
- $value .= c_database_string::ON_TYPES;
+ $value .= c_database_string::ON . ' ' . c_database_string::TYPES;
break;
case e_database_on::SCHEMAS:
- $value .= c_database_string::ON_SCHEMAS;
+ $value .= c_database_string::ON . ' ' . c_database_string::SCHEMAS;
break;
}
protected $on_table;
/**
- * Set the ON TABLE settings.
+ * Assign the settings.
*
* @param string|null $name
* The table name to use.
protected $operand_left;
/**
- * Set the (left) operand settings.
+ * Assign the settings.
*
* @param int|string|null $type
* The operand to assign.
protected $operand_right;
/**
- * Set the (right) operand settings.
+ * Assign the settings.
*
* @param int|string|null $type
* The operand to assign.
protected $options;
/**
- * Set the in options.
+ * Assign the settings.
*
* @param string|null $type
* The option type to use.
protected $order_by;
/**
- * Set the GROUP BY settings.
+ * Assign the settings.
*
* @param string|null $order_by
* The name to group by.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_order_by() {
- return c_database_string::ORDER_BY . ' ' . implode(', ', $this->order_by);
+ return c_database_string::ORDER . ' ' . c_database_string::BY . ' ' . implode(', ', $this->order_by);
}
}
protected $owner_to;
/**
- * Set the OWNER TO settings.
+ * Assign the settings.
*
* @param int|null $owner_to
* The owner type to assign.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_owner_to() {
- return c_database_string::OWNER_TO . ' ' . $this->owner_to['value'];
+ return c_database_string::OWNER . ' ' . c_database_string::TO . ' ' . $this->owner_to['value'];
}
}
protected $procedural;
/**
- * Set the PROCEDURAL value.
+ * Assign the settings.
*
* @param bool|null $procedural
* Set to TRUE for PROCEDURAL.
protected $refresh_publication;
/**
- * Set the REFRESH PUBLICATION settings.
+ * Assign the settings.
*
* @param bool|null $refresh
* Set to TRUE to use REFRESH PUBLICATION.
*/
protected function p_do_build_refresh_publication() {
if ($this->refresh_publication) {
- return c_database_string::REFRESH_PUBLICATION;
+ return c_database_string::REFRESH . ' ' . c_database_string::PUBLICATION;
}
return NULL;
protected $rename_attribute;
/**
- * Set the RENAME ATTRIBUTE settings.
+ * Assign the settings.
*
* @param string|null $from
* The name to rename from.
protected $rename_column;
/**
- * Set the RENAME COLUMN settings.
+ * Assign the settings.
*
* @param string|null $from_name
* The column name to rename from.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_rename_column() {
- return c_database_string::RENAME_COLUMN . ' ' . $this->rename_column['from'] . ' ' . c_database_string::TO . ' ' . $this->rename_column['to'];
+ return c_database_string::RENAME . ' ' . c_database_string::COLUMN . ' ' . $this->rename_column['from'] . ' ' . c_database_string::TO . ' ' . $this->rename_column['to'];
}
}
protected $rename_constraint;
/**
- * Set the RENAME CONSTRAINT settings.
+ * Assign the settings.
*
* @param string|null $from_name
* The constraint name to rename from.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_rename_constraint() {
- return c_database_string::RENAME_CONSTRAINT . ' ' . $this->rename_constraint['from'] . ' ' . c_database_string::TO . ' ' . $this->rename_constraint['to'];
+ return c_database_string::RENAME . ' ' . c_database_string::CONSTRAINT . ' ' . $this->rename_constraint['from'] . ' ' . c_database_string::TO . ' ' . $this->rename_constraint['to'];
}
}
protected $rename_to;
/**
- * Set the RENAME TO settings.
+ * Assign the settings.
*
* @param string|null $rename_to
* The name to rename to.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_rename_to() {
- return c_database_string::RENAME_TO . ' ' . $this->rename_to;
+ return c_database_string::RENAME . ' ' . c_database_string::TO . ' ' . $this->rename_to;
}
}
protected $rename_value;
/**
- * Set the RENAME VALUE settings.
+ * Assign the settings.
*
* @param string|null $from
* The name to rename from.
protected $reset_configuration_parameter;
/**
- * Set the RESET configuration_parameter settings.
+ * Assign the settings.
*
* @param int|null $type
* The reset code to assign.
protected $reset_storage_parameter;
/**
- * Set the RESET (storage_parameter ...) settings.
+ * Assign the settings.
*
* @param int|null $storage_parameter
* The index storage_parameter code to assign.
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides traits for specific Postgesql Queries.
+ *
+ * @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/enumerations/database_view_option.php');
+
+require_once('common/database/classes/database_string.php');
+
+/**
+ * Provide the sql RESET view option functionality.
+ */
+trait t_database_reset_view_option {
+ protected $reset_view_option;
+
+ /**
+ * Assign the settings.
+ *
+ * @param int|null $type
+ * The view option type, one of e_database_view_option.
+ * Set to NULL to disable.
+ *
+ * @return c_base_return_status
+ * TRUE on success, FALSE otherwise.
+ * FALSE with the error bit set is returned on error.
+ */
+ public function set_reset_view_option($type) {
+ if (is_null($type)) {
+ $this->reset_view_option = NULL;
+ return new c_base_return_true();
+ }
+
+ switch ($type) {
+ case e_database_view_option::CHECK_OPTION:
+ case e_database_view_option::SECURITY_BARRIER:
+ break;
+ default:
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'value', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ if (!is_array($this->reset_view_option)) {
+ $this->reset_view_option = [];
+ }
+
+ $this->reset_view_option[] = [
+ 'type' => $type,
+ ];
+
+ return new c_base_return_true();
+ }
+
+ /**
+ * Get the currently assigned set configuration parameter settings.
+ *
+ * @return c_base_return_array|c_base_return_null
+ * An array containing the settings.
+ * NULL is returned if not set.
+ * NULL with the error bit set is returned on error.
+ */
+ public function get_reset_view_option() {
+ if (is_null($this->reset_view_option)) {
+ return new c_base_return_null();
+ }
+
+ if (is_array($this->reset_view_option)) {
+ return c_base_return_array::s_new($this->reset_view_option);
+ }
+
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'reset_view_option', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE);
+ return c_base_return_error::s_null($error);
+ }
+
+ /**
+ * Perform the common build process for this trait.
+ *
+ * As an internal trait method, the caller is expected to perform any appropriate validation.
+ *
+ * @return string|null
+ * A string is returned.
+ * NULL is returned if there is nothing to process or there is an error.
+ */
+ protected function p_do_build_reset_view_option() {
+ $values = [];
+ foreach ($this->reset_view_option as $value) {
+ if ($value['type'] === e_database_view_option::CHECK_OPTION) {
+ $values[] = c_database_string::CHECK_OPTION;
+ }
+ else if ($value['type'] === e_database_view_option::SECURITY_BARRIER) {
+ $values[] = c_database_string::SECURITY_BARRIER;
+ }
+ }
+
+ return c_database_string::RESET . ' (' . implode(', ', $values) . ')';
+ }
+}
protected $restart_with;
/**
- * Set the RESTART WITH settings.
+ * Assign the settings.
*
* @param int|null $value
* A number representing the start with value.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_restart_with() {
- return c_database_string::RESTART_WITH . ' ' . $this->restart_with;
+ return c_database_string::RESTART . ' ' . c_database_string::WITH . ' ' . $this->restart_with;
}
}
protected $restrict;
/**
- * Set the RESTRICT value.
+ * Assign the settings.
*
* @param bool|null $restrict
* Set to TRUE for RESTRICT.
protected $role_specification;
/**
- * Set the role specification.
+ * Assign the settings.
*
* @param int|string|null $name
* A string representing the role name to use.
protected $server_name;
/**
- * Set the SERVER settings.
+ * Assign the settings.
*
* @param string|null $name
* The server name to use.
protected $server_options;
/**
- * Set the OPTIONS (...) settings.
+ * Assign the settings.
*
* @param int|null $option
* The server option code to assign.
protected $set_configuration_parameter;
/**
- * Set the SET configuation parameter settings.
+ * Assign the settings.
*
* @param int|null $type
* The SET code to assign.
}
}
else if ($this->set_configuration_parameter['type'] == e_database_set::FROM_CURRENT) {
- $value = c_database_string::SET . ' ' . $this->set_configuration_parameter['parameter'] . ' = ' . c_database_string::FROM_CURRENT;
+ $value = c_database_string::SET . ' ' . $this->set_configuration_parameter['parameter'] . ' = ' . c_database_string::FROM . ' ' . c_database_string::CURRENT;
}
else if ($this->set_configuration_parameter['type'] == e_database_set::TO_DEFAULT) {
- $value = c_database_string::SET . ' ' . $this->set_configuration_parameter['parameter'] . ' ' . c_database_string::TO_DEFAULT;
+ $value = c_database_string::SET . ' ' . $this->set_configuration_parameter['parameter'] . ' ' . c_database_string::TO . ' ' . c_database_string::DEFAULT;
}
return $value;
protected $set_operator;
/**
- * Set the (operator) SET settings.
+ * Assign the settings.
*
* @param int|null $parameter
* The SET code to assign.
protected $set_publication_name;
/**
- * Set the SET PUBLICATION (name ...) settings.
+ * Assign the settings.
*
* @param string|null $name
* The publication name.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_set_publication_name() {
- return c_database_string::SET_PUBLICATION . ' ' . implode(', ', $this->set_publication_name);
+ return c_database_string::SET . ' ' . c_database_string::PUBLICATION . ' ' . implode(', ', $this->set_publication_name);
}
}
protected $set_publication_parameter;
/**
- * Set the SET (publication_parameter ...) settings.
+ * Assign the settings.
*
* @param int|null $parameter
* The publication parameter code to assign.
protected $set_schema;
/**
- * Set the SET SCHEMA settings.
+ * Assign the settings.
*
* @param string|null $name
* The schema name.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_set_schema() {
- return c_database_string::SET_SCHEMA . ' ' . $this->set_schema;
+ return c_database_string::SET . ' ' . c_database_string::SCHEMA . ' ' . $this->set_schema;
}
}
protected $set_storage_parameter;
/**
- * Set the SET index (storage_parameter ...) settings.
+ * Assign the settings.
*
* @param int|null $parameter
* The storage parameter code to assign.
protected $set_table;
/**
- * Set the SET TABLE settings.
+ * Assign the settings.
*
* @param string|null $name
* The table name.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_set_table() {
- $value = c_database_string::SET_TABLE;
+ $value = c_database_string::SET . ' ' . c_database_string::TABLE;
if ($this->set_table['only']) {
$value .= ' ' . c_database_string::ONLY;
protected $set_tablespace;
/**
- * Set the SET TABLESPACE settings.
+ * Assign the settings.
*
* @param string|null $name
* The tablespace name to set to.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_set_tablespace() {
- return c_database_string::SET_TABLESPACE . ' ' . $this->set_tablespace;
+ return c_database_string::SET . ' ' . c_database_string::TABLESPACE . ' ' . $this->set_tablespace;
}
}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides traits for specific Postgesql Queries.
+ *
+ * @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/enumerations/database_view_option.php');
+
+require_once('common/database/classes/database_string.php');
+
+/**
+ * Provide the sql SET view option functionality.
+ */
+trait t_database_set_view_option {
+ protected $set_view_option;
+
+ /**
+ * Assign the settings.
+ *
+ * @param int|null $type
+ * The view option type, one of e_database_view_option.
+ * Set to NULL to disable.
+ * @param string|bool|null $value
+ * (optional) The value to assign, if applicable.
+ * The $type defines the data type of this.
+ *
+ * @return c_base_return_status
+ * TRUE on success, FALSE otherwise.
+ * FALSE with the error bit set is returned on error.
+ */
+ public function set_set_view_option($type, $value = NULL) {
+ if (is_null($type)) {
+ $this->set_view_option = NULL;
+ return new c_base_return_true();
+ }
+
+ if ($type === e_database_view_option::CHECK_OPTION) {
+ if (!is_string($value)) {
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'value', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+ $placeholder_value = $this->add_placeholder($parameter);
+ if ($placeholder_value->has_error()) {
+ return c_base_return_error::s_false($placeholder_value->get_error());
+ }
+ }
+ else if ($type === e_database_view_option::SECURITY_BARRIER) {
+ if (!is_bool($value)) {
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'value', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $placeholder_value = $bool;
+ }
+ else {
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'type', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $set_view_option = [
+ 'type' => $type,
+ 'value' => $placeholder_value,
+ ];
+ unset($placeholder_value);
+
+ if (!is_array($this->set_view_option)) {
+ $this->set_view_option = [];
+ }
+
+ $this->set_view_option[] = $set_view_option;
+ unset($set_view_option);
+
+ return new c_base_return_true();
+ }
+
+ /**
+ * Get the currently assigned settings.
+ *
+ * @return c_base_return_array|c_base_return_null
+ * An array containing the settings.
+ * NULL is returned if not set.
+ * NULL with the error bit set is returned on error.
+ */
+ public function get_set_view_option() {
+ if (is_null($this->set_view_option)) {
+ return new c_base_return_null();
+ }
+
+ if (is_array($this->set_view_option)) {
+ return c_base_return_array::s_new($this->set_view_option);
+ }
+
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'set_view_option', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE);
+ return c_base_return_error::s_null($error);
+ }
+
+ /**
+ * Perform the common build process for this trait.
+ *
+ * As an internal trait method, the caller is expected to perform any appropriate validation.
+ *
+ * @return string|null
+ * A string is returned.
+ * NULL is returned if there is nothing to process or there is an error.
+ */
+ protected function p_do_build_set_view_option() {
+ $values = [];
+ foreach ($this->set_view_option as $value) {
+ if ($value['type'] === e_database_view_option::CHECK_OPTION) {
+ $values[] = c_database_string::CHECK_OPTION .' = ' . $value['value'];
+ }
+ else if ($value['type'] === e_database_view_option::SECURITY_BARRIER) {
+ $values[] = c_database_string::SECURITY_BARRIER;
+ }
+ }
+
+ return c_database_string::SET . ' (' . implode(', ', $values) . ')';
+ }
+}
protected $set_with_oids;
/**
- * Set the SET WITH OIDS value.
+ * Assign the settings.
*
* @param bool|null $set_with_oids
* Set to TRUE for SET WITH OIDS.
}
/**
- * Get the currently assigned set with oids status.
+ * Get the currently assigned settings.
*
* @return c_base_return_bool|c_base_return_null
* TRUE for SET WITH OIDS or FALSE for SET WITHOUT OIDS on success.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_set_with_oids() {
- return $this->set_with_oids ? c_database_string::SET_WITH_OIDS : c_database_string::SET_WITHOUT_OIDS;
+ return $this->set_with_oids ? c_database_string::SET . ' ' . c_database_string::WITH . ' ' . c_database_string::OIDS : c_database_string::SET . ' ' . c_database_string::WITHOUT . ' ' . c_database_string::OIDS;
}
}
protected $set_without_cluster;
/**
- * Set the SET WITHOUT CLUSTER value.
+ * Assign the settings.
*
* @param bool|null $set_without_cluster
* Set to TRUE for SET WITHOUT CLUSTER.
}
/**
- * Get the currently assigned with grant option value.
+ * Get the currently assigned settings.
*
* @return c_base_return_bool|c_base_return_null
* TRUE for SET WITHOUT CLUSTER on success.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_set_without_cluster() {
- return $this->set_without_cluster ? c_database_string::SET_WITHOUT_CLUSTER : NULL;
+ return $this->set_without_cluster ? c_database_string::SET . ' ' . c_database_string::WITHOUT . ' ' . c_database_string::CLUSTER : NULL;
}
}
protected $start_with;
/**
- * Set the START WITH settings.
+ * Assign the settings.
*
* @param int|null $value
* A number representing the start with value.
}
/**
- * Get the currently assigned start with value.
+ * Get the currently assigned settings.
*
* @return c_base_return_string|c_base_return_null
* A number representing the start with value.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_start_with() {
- return c_database_string::START_WITH . ' ' . $this->start_with;
+ return c_database_string::START . ' ' . c_database_string::WITH . ' ' . $this->start_with;
}
}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides traits for specific Postgesql Queries.
+ *
+ * @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');
+
+/**
+ * Provide the sql table name functionality.
+ */
+trait t_database_table_name {
+ protected $table_name;
+
+ /**
+ * Assign the settings.
+ *
+ * @param string|null $name
+ * The table name to use.
+ * Set to NULL to disable.
+ *
+ * @return c_base_return_status
+ * TRUE on success, FALSE otherwise.
+ * FALSE with the error bit set is returned on error.
+ */
+ public function set_table_name($name) {
+ if (is_null($name)) {
+ $this->table_name = NULL;
+ return new c_base_return_true();
+ }
+
+ if (is_string($name)) {
+ $placeholder = $this->add_placeholder($name);
+ if ($placeholder->has_error()) {
+ return c_base_return_error::s_false($placeholder->get_error());
+ }
+
+ $this->table_name = $placeholder;
+ unset($placeholder);
+
+ return new c_base_return_true();
+ }
+
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'name', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ /**
+ * Get the currently assigned settings.
+ *
+ * @return i_database_query_placeholder|c_base_return_null
+ * A name query placeholder on success.
+ * NULL is returned if not set.
+ * NULL with the error bit set is returned on error.
+ */
+ public function get_table_name() {
+ if (is_null($this->table_name)) {
+ return new c_base_return_null();
+ }
+
+ if (isset($this->table_name)) {
+ return clone($this->table_name);
+ }
+
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'table_name', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE);
+ return c_base_return_error::s_null($error);
+ }
+
+ /**
+ * Perform the common build process for this trait.
+ *
+ * As an internal trait method, the caller is expected to perform any appropriate validation.
+ *
+ * @return string|null
+ * A string is returned.
+ * NULL is returned if there is nothing to process or there is an error.
+ */
+ protected function p_do_build_table_name() {
+ return strval($this->table_name);
+ }
+}
protected $to_role;
/**
- * Set the in schema, to roles.
+ * Assign the settings.
*
* @param int|null $role_type
* The role type to use.
}
/**
- * Get the in schema, to roles.
+ * Get the currently assigned settings.
*
* @return c_base_return_array|c_base_return_null
* An array of to role arrays or NULL if not defined.
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides traits for specific Postgesql Queries.
+ *
+ * @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/enumerations/database_transaction_action.php');
+
+require_once('common/database/classes/database_string.php');
+
+/**
+ * Provide the sql transaction action functionality.
+ */
+trait t_database_transaction_action {
+ protected $transaction_action;
+
+ /**
+ * Assign the settings.
+ *
+ * @param int|null $action
+ * The action, one of e_database_transaction_action.
+ * Set to NULL to disable.
+ *
+ * @return c_base_return_status
+ * TRUE on success, FALSE otherwise.
+ * FALSE with the error bit set is returned on error.
+ */
+ public function set_transaction_action($action) {
+ if (is_null($action)) {
+ $this->transaction_action = NULL;
+ return new c_base_return_true();
+ }
+
+ switch ($action) {
+ case e_database_transaction_action::TRANSACTION:
+ case e_database_transaction_action::WORK:
+ break;
+
+ default:
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'action', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->transaction_action = $action;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Get the currently assigned settings.
+ *
+ * @return c_base_return_int|c_base_return_null
+ * A code representing the setting.
+ * NULL is returned if not set.
+ * NULL with the error bit set is returned on error.
+ */
+ public function get_transaction_action() {
+ if (is_null($this->transaction_action)) {
+ return new c_base_return_null();
+ }
+
+ if (is_int($this->transaction_action)) {
+ return c_base_return_int::s_new($this->transaction_action);
+ }
+
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'transaction_action', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE);
+ return c_base_return_error::s_null($error);
+ }
+
+ /**
+ * Perform the common build process for this trait.
+ *
+ * As an internal trait method, the caller is expected to perform any appropriate validation.
+ *
+ * @return string|null
+ * A string is returned.
+ * NULL is returned if there is nothing to process or there is an error.
+ */
+ protected function p_do_build_transaction_action() {
+ $value = NULL;
+
+ if ($this->transaction_action === e_database_transaction_action::TRANSACTION) {
+ $value = c_database_string::TRANSACTION;
+ }
+ else if ($this->transaction_action === e_database_transaction_action::WORK) {
+ $value = c_database_string::WORK;
+ }
+
+ return $value;
+ }
+}
--- /dev/null
+<?php
+/**
+ * @file
+ * Provides traits for specific Postgesql Queries.
+ *
+ * @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/enumerations/database_transaction_mode.php');
+
+require_once('common/database/classes/database_string.php');
+
+/**
+ * Provide the sql transaction action functionality.
+ */
+trait t_database_transaction_mode {
+ protected $transaction_mode;
+
+ /**
+ * Assign the settings.
+ *
+ * @param int|null $mode
+ * The mode, one of e_database_transaction_mode.
+ * Set to NULL to disable.
+ *
+ * @return c_base_return_status
+ * TRUE on success, FALSE otherwise.
+ * FALSE with the error bit set is returned on error.
+ */
+ public function set_transaction_mode($mode) {
+ if (is_null($action)) {
+ $this->transaction_mode = NULL;
+ return new c_base_return_true();
+ }
+
+ switch ($action) {
+ case e_database_transaction_mode::DEFERRABLE:
+ case e_database_transaction_mode::ISOLATION_LEVEL_REPEATABLE_READ:
+ case e_database_transaction_mode::ISOLATION_LEVEL_READ_COMMITTED:
+ case e_database_transaction_mode::ISOLATION_LEVEL_READ_UNCOMMITTED:
+ case e_database_transaction_mode::ISOLATION_LEVEL_SERIALIZABLE:
+ case e_database_transaction_mode::NOT_DEFERRABLE:
+ case e_database_transaction_mode::READ_WRITE:
+ case e_database_transaction_mode::READ_ONLY:
+ break;
+
+ default:
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{argument_name}' => 'action', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_ARGUMENT);
+ return c_base_return_error::s_false($error);
+ }
+
+ $this->transaction_mode = $action;
+ return new c_base_return_true();
+ }
+
+ /**
+ * Get the currently assigned settings.
+ *
+ * @return c_base_return_int|c_base_return_null
+ * A code representing the setting.
+ * NULL is returned if not set.
+ * NULL with the error bit set is returned on error.
+ */
+ public function get_transaction_mode() {
+ if (is_null($this->transaction_mode)) {
+ return new c_base_return_null();
+ }
+
+ if (is_int($this->transaction_mode)) {
+ return c_base_return_int::s_new($this->transaction_mode);
+ }
+
+ $error = c_base_error::s_log(NULL, ['arguments' => [':{variable_name}' => 'transaction_mode', ':{function_name}' => __CLASS__ . '->' . __FUNCTION__]], i_base_error_messages::INVALID_VARIABLE);
+ return c_base_return_error::s_null($error);
+ }
+
+ /**
+ * Perform the common build process for this trait.
+ *
+ * As an internal trait method, the caller is expected to perform any appropriate validation.
+ *
+ * @return string|null
+ * A string is returned.
+ * NULL is returned if there is nothing to process or there is an error.
+ */
+ protected function p_do_build_transaction_mode() {
+ $value = NULL;
+
+ if ($this->transaction_mode === e_database_transaction_mode::DEFERRABLE) {
+ $value = c_database_string::DEFERRABLE;
+ }
+ else if ($this->transaction_mode === e_database_transaction_mode::ISOLATION_LEVEL_REPEATABLE_READ) {
+ $value = c_database_string::ISOLATION . ' ' . c_database_string::LEVEL . ' ' . c_database_string::REPEATABLE . ' ' . c_database_string::READ;
+ }
+ else if ($this->transaction_mode === e_database_transaction_mode::ISOLATION_LEVEL_READ_COMMITTED) {
+ $value = c_database_string::ISOLATION . ' ' . c_database_string::LEVEL . ' ' . c_database_string::READ . ' ' . c_database_string::COMMITTED;
+ }
+ else if ($this->transaction_mode === e_database_transaction_mode::ISOLATION_LEVEL_READ_UNCOMMITTED) {
+ $value = c_database_string::ISOLATION . ' ' . c_database_string::LEVEL . ' ' . c_database_string::READ . ' ' . c_database_string::UNCOMMITTED;
+ }
+ else if ($this->transaction_mode === e_database_transaction_mode::ISOLATION_LEVEL_SERIALIZABLE) {
+ $value = c_database_string::ISOLATION . ' ' . c_database_string::LEVEL . ' ' . c_database_string::SERIALIZABLE;
+ }
+ else if ($this->transaction_mode === e_database_transaction_mode::NOT_DEFERRABLE) {
+ $value = c_database_string::NOT . ' ' . c_database_string::DEFERRABLE;
+ }
+ else if ($this->transaction_mode === e_database_transaction_mode::READ_WRITE) {
+ $value = c_database_string::READ . ' ' . c_database_string::WRITE;
+ }
+ else if ($this->transaction_mode === e_database_transaction_mode::READ_ONLY) {
+ $value = c_database_string::READ . ' ' . c_database_string::ONLY;
+ }
+ return $value;
+ }
+}
protected $type_action;
/**
- * Set the settings.
+ * Assign the settings.
*
* @param int|null $attribute
* The attribute type to use from e_database_attribute_action.
$value = NULL;
if ($this->type_action['attribute'] === e_database_attribute_action::ADD) {
- $value = c_database_string::ADD_ATTRIBUTE;
+ $value = c_database_string::ADD . ' ' . c_database_string::ATTRIBUTE;
$value .= ' ' . $this->type_action['name'];
$value .= ' ' . $this->type_action['data_type'];
}
}
else if ($this->type_action['attribute'] === e_database_attribute_action::ALTER) {
- $value = c_database_string::ALTER_ATTRIBUTE;
+ $value = c_database_string::ALTER . ' ' . c_database_string::ATTRIBUTE;
$value .= ' ' . $this->type_action['name'];
- $value .= ' ' . c_database_string::SET_DATA_TYPE;
+ $value .= ' ' . c_database_string::SET . ' ' . c_database_string::DATA . ' ' . c_database_string::TYPE;
$value .= ' ' . $this->type_action['data_type'];
if (isset($this->type_action['collation'])) {
}
}
else if ($this->type_action['attribute'] === e_database_attribute_action::DROP) {
- $value = c_database_string::DROP_ATTRIBUTE;
+ $value = c_database_string::DROP . ' ' . c_database_string::ATTRIBUTE;
if ($this->type_action['if_exists']) {
- $value .= ' ' . c_database_string::IF_EXISTS;
+ $value .= ' ' . c_database_string::IF . ' ' . c_database_string::EXISTS;
}
$value .= ' ' . $this->type_action['name'];
protected $user_name;
/**
- * Set the user name.
+ * Assign the settings.
*
* @param int|null $type
* The user name type to use, from e_database_user.
$value = NULL;
if ($this->user_name['type'] === e_database_user::CURRENT) {
- $value = c_database_string::CURRENT_USER;
+ $value = c_database_string::CURRENT . ' ' . c_database_string::USER;
}
else if ($this->user_name['type'] === e_database_user::PUBLIC) {
$value = c_database_string::PUBLIC;
}
else if ($this->user_name['type'] === e_database_user::SESSION) {
- $value = c_database_string::SESSION_USER;
+ $value = c_database_string::SESSION . ' ' . c_database_string::USER;
}
else if ($this->user_name['type'] === e_database_user::NAME) {
$value = $this->user_name['name'];
protected $using_expression;
/**
- * Set the USING expression settings.
+ * Assign the settings.
*
* @param string|null $sql_expression
* An SQL conditional expression.
protected $using_index_method;
/**
- * Set the USING settings.
+ * Assign the settings.
*
* @param string|null $using_index_method
* The using_index_method to use.
protected $validator;
/**
- * Set the VALIDATOR settings.
+ * Assign the settings.
*
* @param int|null $validator
* The integer representing validator/no-validator.
}
}
else if ($this->validator['type'] == e_database_validator::NO_VALIDATOR) {
- $value = c_database_string::NO_VALIDATOR;
+ $value = c_database_string::NO . ' ' . c_database_string::VALIDATOR;
}
return $value;
protected $version;
/**
- * Set the VERSION settings.
+ * Assign the settings.
*
* @param string|null $version
* The version to use.
protected $wildcard;
/**
- * Set the * value.
+ * Assign the settings.
*
* @param bool|null $wildcard
* Set to TRUE for '*'.
protected $with_check_expression;
/**
- * Set the WITH CHECK expression settings.
+ * Assign the settings.
*
* @param string|null $sql_expression
* An SQL conditional expression.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_with_check_expression() {
- return c_database_string::WITH_CHECK . ' ' . $this->with_check_expression;
+ return c_database_string::WITH . ' ' . c_database_string::CHECK . ' ' . $this->with_check_expression;
}
}
protected $with_dictionary;
/**
- * Set the WITH DICTIONARY settings.
+ * Assign the settings.
*
* @param string|null $name
* The dictionary name.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_with_dictionary() {
- return c_database_string::WITH_DICTIONARY . ' ' . $this->with_dictionary;
+ return c_database_string::WITH . ' ' . c_database_string::DICTIONARY . ' ' . $this->with_dictionary;
}
}
protected $with_grant_option;
/**
- * Set the WITH GRANT OPTION value.
+ * Assign the settings.
*
* @param bool|null $with_grant_option
* Set to TRUE for WITH GRANT OPTION.
* NULL is returned if there is nothing to process or there is an error.
*/
protected function p_do_build_with_grant_option() {
- return $this->with_grant_option ? c_database_string::WITH_GRANT_OPTION : NULL;
+ return $this->with_grant_option ? c_database_string::WITH . ' ' . c_database_string::GRANT . ' ' . c_database_string::OPTION : NULL;
}
}
protected $with_publication_option;
/**
- * Set the WITH (publication_option ...) settings.
+ * Assign the settings.
*
* @param int|null $option
* The publication option code to assign.
protected $with_refresh_option;
/**
- * Set the WITH (refresh_option ...) settings.
+ * Assign the settings.
*
* @param int|null $option
* The refresh option code to assign.
protected $with_role_option;
/**
- * Set the with role option.
+ * Assign the settings.
*
* @param int|null $type
* The option type from e_database_role_option.
$values[] = c_database_string::SUPERUSER;
}
else if ($role_option['type'] === e_database_role_option::CONNECTION_LIMIT) {
- $values[] = c_database_string::CONNECTION_LIMIT . ' ' . $role_option['value'];
+ $values[] = c_database_string::CONNECTION . ' ' . c_database_string::LIMIT . ' ' . $role_option['value'];
}
else if ($role_option['type'] === e_database_role_option::PASSWORD) {
$values[] = c_database_string::PASSWORD . ' ' . $role_option['value'];
}
else if ($role_option['type'] === e_database_role_option::PASSWORD_ENCRYPTED) {
- $values[] = c_database_string::PASSWORD_ENCRYPTED . ' ' . $role_option['value'];
+ $values[] = c_database_string::PASSWORD . ' ' . c_database_string::ENCRYPTED . ' ' . $role_option['value'];
}
else if ($role_option['type'] === e_database_role_option::VALID_UNTIL) {
- $values[] = c_database_string::VALID_UNTIL . ' ' . $role_option['value'];
+ $values[] = c_database_string::VALID . ' ' . c_database_string::UNTIL . ' ' . $role_option['value'];
}
}
unset($role_option);
protected $with_storage_parameter;
/**
- * Set the WITH index (storage_parameter ...) settings.
+ * Assign the settings.
*
* @param int|null $parameter
* The storage parameter code to assign.