return new c_base_return_false();
}
- // @fixme: use a local variable fo value before assigning.
- $this->value = static::pr_QUERY_COMMAND;
- $this->value .= ' ' . $this->name;
-
$aggregate_signatures = NULL;
if (!is_array($this->aggregate_modes) || empty($this->aggregate_modes)) {
$aggregate_signatures = ' *';
unset($order_by_signatures);
}
+ $value = NULL;
if (is_string($this->rename_to)) {
- $this->value .= ' ' . $aggregate_signatures . ' ' . $this->p_do_build_rename_to();
+ $action = $aggregate_signatures . ' ' . $this->p_do_build_rename_to();
}
else if (is_string($this->owner_to)) {
- $this->value .= ' ' . $aggregate_signatures . ' ' . $this->p_do_build_owner_to();
+ $action = $aggregate_signatures . ' ' . $this->p_do_build_owner_to();
}
else if (is_string($this->set_schema)) {
- $this->value .= ' ' . $aggregate_signatures . ' ' . $this->p_do_build_set_schema();
+ $action = $aggregate_signatures . ' ' . $this->p_do_build_set_schema();
}
else {
unset($aggregate_signatures);
-
- $this->value = NULL;
+ unset($action);
return new c_base_return_false();
}
unset($aggregate_signatures);
+ $this->value = static::pr_QUERY_COMMAND;
+ $this->value .= ' ' . $this->name;
+ $this->value .= ' ' . $action;
+ unset($action);
+
return new c_base_return_true();
}
}
return new c_base_return_false();
}
- // @fixme: use a local variable for value before returning.
- $this->value = static::pr_QUERY_COMMAND;
- $this->value .= ' ' . $this->name;
-
+ $action = NULL;
if (is_bool($this->refresh_version)) {
if ($this->refresh_version) {
- $this->value .= ' ' . c_database_string::REFRESH_VERSION;
+ $action = c_database_string::REFRESH_VERSION;
}
}
else if (is_string($this->rename_to)) {
- $this->value .= ' ' . $this->p_do_build_rename_to();
+ $action = $this->p_do_build_rename_to();
}
else if (is_string($this->owner_to)) {
- $this->value .= ' ' . $this->p_do_build_owner_to();
+ $action = $this->p_do_build_owner_to();
}
else if (is_string($this->set_schema)) {
- $this->value .= ' ' . $this->p_do_build_set_schema();
+ $action = $this->p_do_build_set_schema();
}
else {
- $this->value = NULL;
+ unset($action);
return new c_base_return_false();
}
+ $this->value = static::pr_QUERY_COMMAND;
+ $this->value .= ' ' . $this->name;
+ $this->value .= ' ' . $action;
+ unset($action);
+
return new c_base_return_true();
}
}
return new c_base_return_false();
}
- // @fixme: use a local variable for value.
- $this->value = static::pr_QUERY_COMMAND;
- $this->value .= ' ' . $this->name;
-
+ $action = NULL;
if (is_string($this->rename_to)) {
- $this->value .= ' ' . $this->p_do_build_rename_to();
+ $action = $this->p_do_build_rename_to();
}
else if (is_string($this->owner_to)) {
- $this->value .= ' ' . $this->p_do_build_owner_to();
+ $action = $this->p_do_build_owner_to();
}
else if (is_string($this->set_schema)) {
- $this->value .= ' ' . $this->p_do_build_set_schema();
+ $action = $this->p_do_build_set_schema();
}
else {
- $this->value = NULL;
+ unset($action);
return new c_base_return_false();
}
+ $this->value = static::pr_QUERY_COMMAND;
+ $this->value .= ' ' . $this->name;
+ $this->value .= ' ' . $action;
+ unset($action);
+
return new c_base_return_true();
}
}
return new c_base_return_false();
}
- $this->value = static::pr_QUERY_COMMAND;
- $this->value .= ' ' . $this->name;
-
+ $action = NULL;
if ($this->option instanceof c_database_argument_database_option) {
$this->option->do_build_argument();
- $this->value .= ' ' . $this->option->get_value_exact();
+ $action = $this->option->get_value_exact();
}
else if (is_string($this->rename_to)) {
- $this->value .= ' ' . $this->p_do_build_rename_to();
+ $action = $this->p_do_build_rename_to();
}
else if (is_string($this->owner_to)) {
- $this->value .= ' ' . $this->p_do_build_owner_to();
+ $action = $this->p_do_build_owner_to();
}
else if (is_string($this->set_tablespace)) {
- $this->value .= ' ' . $this->p_do_build_set_tablespace();
+ $action = $this->p_do_build_set_tablespace();
}
else if (is_array($this->set)) {
- $this->value .= ' ' . $this->p_do_build_set();
+ $action = $this->p_do_build_set();
}
else if (is_array($this->reset)) {
- $this->value .= ' ' . $this->p_do_build_reset();
+ $action = $this->p_do_build_reset();
+ }
+ else {
+ unset($action);
+ return new c_base_return_false();
}
+ $this->value = static::pr_QUERY_COMMAND;
+ $this->value .= ' ' . $this->name;
+ $this->value .= ' ' . $action;
+ unset($action);
+
return new c_base_return_true();
}
}
return new c_base_return_false();
}
- // @fixme: use a local variable and only assign value once at the end after any potential error cases.
- $this->value = static::pr_QUERY_COMMAND;
-
// [ FOR ROLE target_role [, ... ] ]
+ $action = NULL;
if (is_array($this->for_role_targets) && !empty($this->for_role_targets)) {
- $this->value .= ' ' . c_database_string::FOR . ' ' . c_database_string::ROLE;
-
- $names = NULL;
- foreach ($this->for_role_targets as $schema_name) {
- $names .= ', ' . $schema_name;
- }
-
- $this->value .= ltrim($names, ',');
- unset($names);
+ $action = c_database_string::FOR . ' ' . c_database_string::ROLE;
+ $action .= ' ' . implode(', ', $this->for_role_targets);
}
// [ IN SCHEMA schema_name [, ... ] ]
if (is_array($this->in_schema) && !empty($this->in_schema)) {
- $this->value .= $this->p_do_build_in_schema();
+ $action .= is_null($action) ? '' : ' ';
+ $action .= $this->p_do_build_in_schema();
}
if ($this->action === e_database_action::ACTION_GRANT) {
- $this->value .= ' ' . c_database_string::GRANT;
+ $action .= is_null($action) ? '' : ' ';
+ $action .= c_database_string::GRANT;
}
else if ($this->action === e_database_action::ACTION_REVOKE) {
- $this->value .= ' ' . c_database_string::REVOKE;
+ $action .= is_null($action) ? '' : ' ';
+ $action .= c_database_string::REVOKE;
if ($this->option_grant) {
- $this->value .= ' ' . c_database_string::GRANT_OPTION_FOR;
+ $action .= ' ' . c_database_string::GRANT_OPTION_FOR;
}
}
}
}
- $this->value .= ltrim($privileges, ',');
+ $action .= is_null($action) ? '' : ' ';
+ $action .= ltrim($privileges, ', ');
unset($privileges);
// ON ...
switch($this->on) {
case e_database_on::TABLES_TO:
- $this->value .= ' ' . c_database_string::ON_TABLES_TO;
+ $action .= ' ' . c_database_string::ON_TABLES_TO;
break;
case e_database_on::SEQUENCES:
- $this->value .= ' ' . c_database_string::ON_SEQUENCES;
+ $action .= ' ' . c_database_string::ON_SEQUENCES;
break;
case e_database_on::FUNCTIONS:
- $this->value .= ' ' . c_database_string::ON_FUNCTIONS;
+ $action .= ' ' . c_database_string::ON_FUNCTIONS;
break;
case e_database_on::TYPES:
- $this->value .= ' ' . c_database_string::ON_TYPES;
+ $action .= ' ' . c_database_string::ON_TYPES;
break;
case e_database_on::SCHEMAS:
- $this->value .= ' ' . c_database_string::ON_SCHEMAS;
+ $action .= ' ' . c_database_string::ON_SCHEMAS;
break;
}
// [ TO | FROM ] ... role names ...
if ($this->action === e_database_action::GRANT) {
- $this->value .= ' ' . c_database_string::TO;
+ $action .= ' ' . c_database_string::TO;
}
else if ($this->action === e_database_action::REVOKE) {
- $this->value .= ' ' . c_database_string::FROM;
+ $action .= ' ' . c_database_string::FROM;
}
foreach ($this->role_names as $role_name) {
}
$role_name->do_build_argument();
- $this->value .= ' ' . $role_name->get_value_exact();
+ $action .= ' ' . $role_name->get_value_exact();
}
unset($role_name);
if ($this->action === e_database_action::GRANT) {
// [ WITH GRANT OPTION ]
if ($this->option_grant) {
- $this->value .= ' ' . c_database_string::WITH_GRANT_OPTION;
+ $action .= ' ' . c_database_string::WITH_GRANT_OPTION;
}
}
else if ($this->action === e_database_action::REVOKE) {
// [ CASCADE | RESTRICT ]
$option = $this->p_do_build_option();
if (is_string($option)) {
- $this->value .= ' ' . $option;
+ $action .= ' ' . $option;
}
unset($option);
}
+ $this->value = static::pr_QUERY_COMMAND;
+ $this->value .= ' ' . $this->name;
+ $this->value .= ' ' . $action;
+ unset($action);
+
return new c_base_return_true();
}
}
$this->value = static::pr_QUERY_COMMAND;
$this->value .= ' ' . $this->name;
$this->value .= ' ' . $action;
+ unset($action);
return new c_base_return_true();
}
unset($action);
return new c_base_return_false();
}
+ unset($action);
+ $this->value = $action;
return new c_base_return_true();
}
}
return new c_base_return_false();
}
- $this->value = '';
+ $value = '';
if ($this->argument_mode === static::QUERY_ARGUMENT_MODE_PUBLIC) {
- $this->value .= ' ' . c_database_string::PUBLIC;
+ $value .= ' ' . c_database_string::PUBLIC;
}
else if ($this->argument_mode === static::QUERY_ARGUMENT_MODE_NAME) {
if (is_string($this->argument_name)) {
- $this->value .= ' ' . $this->argument_name;
+ $value .= ' ' . $this->argument_name;
}
}
else if ($this->argument_mode === static::QUERY_ARGUMENT_MODE_GROUP) {
- $this->value .= ' ' . c_database_string::GROUP;
+ $value .= ' ' . c_database_string::GROUP;
if (is_string($this->argument_name)) {
- $this->value .= ' ' . $this->argument_name;
+ $value .= ' ' . $this->argument_name;
}
}
else {
+ unset($value);
return new c_base_return_false();
}
+ $this->value = $value;
return new c_base_return_true();
}