|
From: <di...@us...> - 2012-01-08 18:34:06
|
Revision: 53820
http://firebird.svn.sourceforge.net/firebird/?rev=53820&view=rev
Author: dimitr
Date: 2012-01-08 18:33:59 +0000 (Sun, 08 Jan 2012)
Log Message:
-----------
Refactored CREATE/ALTER USER. Untested at runtime.
Modified Paths:
--------------
firebird/trunk/lang_helpers/gds_codes.ftn
firebird/trunk/lang_helpers/gds_codes.pas
firebird/trunk/src/dsql/DdlNodes.epp
firebird/trunk/src/dsql/DdlNodes.h
firebird/trunk/src/dsql/ddl.cpp
firebird/trunk/src/dsql/node.h
firebird/trunk/src/dsql/parse.y
firebird/trunk/src/dsql/pass1.cpp
firebird/trunk/src/include/gen/codetext.h
firebird/trunk/src/include/gen/iberror.h
firebird/trunk/src/include/gen/msgs.h
firebird/trunk/src/include/gen/sql_code.h
firebird/trunk/src/include/gen/sql_state.h
firebird/trunk/src/jrd/dyn.epp
firebird/trunk/src/msgs/facilities2.sql
firebird/trunk/src/msgs/messages2.sql
firebird/trunk/src/msgs/system_errors2.sql
Modified: firebird/trunk/lang_helpers/gds_codes.ftn
===================================================================
--- firebird/trunk/lang_helpers/gds_codes.ftn 2012-01-08 14:05:29 UTC (rev 53819)
+++ firebird/trunk/lang_helpers/gds_codes.ftn 2012-01-08 18:33:59 UTC (rev 53820)
@@ -1724,6 +1724,8 @@
PARAMETER (GDS__dyn_coll_used_function = 336068889)
INTEGER*4 GDS__dyn_domain_used_function
PARAMETER (GDS__dyn_domain_used_function = 336068890)
+ INTEGER*4 GDS__dyn_alter_user_no_clause
+ PARAMETER (GDS__dyn_alter_user_no_clause = 336068891)
INTEGER*4 GDS__gbak_unknown_switch
PARAMETER (GDS__gbak_unknown_switch = 336330753)
INTEGER*4 GDS__gbak_page_size_missing
@@ -2144,6 +2146,10 @@
PARAMETER (GDS__dsql_create_filter_failed = 336397315)
INTEGER*4 GDS__dsql_create_index_failed
PARAMETER (GDS__dsql_create_index_failed = 336397316)
+ INTEGER*4 GDS__dsql_create_user_failed
+ PARAMETER (GDS__dsql_create_user_failed = 336397317)
+ INTEGER*4 GDS__dsql_alter_user_failed
+ PARAMETER (GDS__dsql_alter_user_failed = 336397318)
INTEGER*4 GDS__gsec_cant_open_db
PARAMETER (GDS__gsec_cant_open_db = 336723983)
INTEGER*4 GDS__gsec_switches_error
Modified: firebird/trunk/lang_helpers/gds_codes.pas
===================================================================
--- firebird/trunk/lang_helpers/gds_codes.pas 2012-01-08 14:05:29 UTC (rev 53819)
+++ firebird/trunk/lang_helpers/gds_codes.pas 2012-01-08 18:33:59 UTC (rev 53820)
@@ -869,6 +869,7 @@
gds_dyn_routine_param_ambiguous = 336068888;
gds_dyn_coll_used_function = 336068889;
gds_dyn_domain_used_function = 336068890;
+ gds_dyn_alter_user_no_clause = 336068891;
gds_gbak_unknown_switch = 336330753;
gds_gbak_page_size_missing = 336330754;
gds_gbak_page_size_toobig = 336330755;
@@ -1079,6 +1080,8 @@
gds_dsql_create_shadow_failed = 336397314;
gds_dsql_create_filter_failed = 336397315;
gds_dsql_create_index_failed = 336397316;
+ gds_dsql_create_user_failed = 336397317;
+ gds_dsql_alter_user_failed = 336397318;
gds_gsec_cant_open_db = 336723983;
gds_gsec_switches_error = 336723984;
gds_gsec_no_op_spec = 336723985;
Modified: firebird/trunk/src/dsql/DdlNodes.epp
===================================================================
--- firebird/trunk/src/dsql/DdlNodes.epp 2012-01-08 14:05:29 UTC (rev 53819)
+++ firebird/trunk/src/dsql/DdlNodes.epp 2012-01-08 18:33:59 UTC (rev 53820)
@@ -9647,6 +9647,110 @@
//----------------------
+void CreateAlterUserNode::print(string& text, Array<dsql_nod*>& /*nodes*/) const
+{
+ text.printf(
+ "CreateAlterUserNode\n"
+ " name: '%s'\n",
+ name.c_str());
+}
+
+void CreateAlterUserNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd_tra* transaction)
+{
+ if (!isCreating && !password && !firstName && !middleName && !lastName && !adminRole.specified)
+ {
+ // 283: ALTER USER requires at least one clause to be specified
+ status_exception::raise(Arg::Gds(ENCODE_ISC_MSG(283, DYN_MSG_FAC)));
+ }
+
+ // run all statements under savepoint control
+ AutoSavePoint savePoint(tdbb, transaction);
+
+ DynamicUserData* userData = FB_NEW(*transaction->tra_pool) DynamicUserData;
+
+ string text = name.c_str();
+ text.upper();
+
+ userData->op = isCreating ? ADD_OPER : MOD_OPER;
+ userData->user.set(text.c_str());
+ userData->user.setEntered(1);
+
+ if (password)
+ {
+ if (password->isEmpty())
+ {
+ // 250: Password should not be empty string
+ status_exception::raise(Arg::Gds(ENCODE_ISC_MSG(250, DYN_MSG_FAC)));
+ }
+
+ userData->pass.set(password->c_str());
+ userData->pass.setEntered(1);
+ }
+
+ if (firstName)
+ {
+ if (firstName->hasData())
+ {
+ userData->first.set(firstName->c_str());
+ userData->first.setEntered(1);
+ }
+ else
+ {
+ userData->first.setEntered(0);
+ userData->first.setSpecified(1);
+ }
+ }
+
+ if (middleName)
+ {
+ if (middleName->hasData())
+ {
+ userData->first.set(middleName->c_str());
+ userData->first.setEntered(1);
+ }
+ else
+ {
+ userData->first.setEntered(0);
+ userData->first.setSpecified(1);
+ }
+ }
+
+ if (lastName)
+ {
+ if (lastName->hasData())
+ {
+ userData->first.set(lastName->c_str());
+ userData->first.setEntered(1);
+ }
+ else
+ {
+ userData->first.setEntered(0);
+ userData->first.setSpecified(1);
+ }
+ }
+
+ if (adminRole.specified)
+ {
+ userData->adm.set(adminRole.value);
+ userData->adm.setEntered(1);
+ }
+
+ const int ddlAction = isCreating ? DDL_TRIGGER_CREATE_USER : DDL_TRIGGER_ALTER_USER;
+
+ executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, ddlAction, userData->user.get());
+
+ const USHORT id = transaction->getUserManagement()->put(userData);
+ DFW_post_work(transaction, dfw_user_management, NULL, id);
+
+ executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, ddlAction, userData->user.get());
+
+ savePoint.release(); // everything is ok
+}
+
+
+//----------------------
+
+
void DropUserNode::print(string& text, Array<dsql_nod*>& /*nodes*/) const
{
text.printf(
@@ -9672,7 +9776,7 @@
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_DROP_USER,
userData->user.get());
- USHORT id = transaction->getUserManagement()->put(userData);
+ const USHORT id = transaction->getUserManagement()->put(userData);
DFW_post_work(transaction, dfw_user_management, NULL, id);
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_USER,
Modified: firebird/trunk/src/dsql/DdlNodes.h
===================================================================
--- firebird/trunk/src/dsql/DdlNodes.h 2012-01-08 14:05:29 UTC (rev 53819)
+++ firebird/trunk/src/dsql/DdlNodes.h 2012-01-08 18:33:59 UTC (rev 53820)
@@ -1607,6 +1607,38 @@
};
+class CreateAlterUserNode : public DdlNode
+{
+public:
+ CreateAlterUserNode(MemoryPool& p, bool creating, const Firebird::MetaName& aName)
+ : DdlNode(p),
+ isCreating(creating),
+ name(p, aName)
+ {
+ }
+
+public:
+ virtual void print(Firebird::string& text, Firebird::Array<dsql_nod*>& nodes) const;
+ virtual void execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd_tra* transaction);
+
+protected:
+ virtual void putErrorPrefix(Firebird::Arg::StatusVector& statusVector)
+ {
+ statusVector << Firebird::Arg::Gds(isCreating ?
+ isc_dsql_create_user_failed : isc_dsql_alter_user_failed) << name;
+ }
+
+public:
+ const bool isCreating;
+ const Firebird::MetaName name;
+ const Firebird::string* password;
+ const Firebird::string* firstName;
+ const Firebird::string* middleName;
+ const Firebird::string* lastName;
+ Nullable<int> adminRole;
+};
+
+
class DropUserNode : public DdlNode
{
public:
Modified: firebird/trunk/src/dsql/ddl.cpp
===================================================================
--- firebird/trunk/src/dsql/ddl.cpp 2012-01-08 14:05:29 UTC (rev 53819)
+++ firebird/trunk/src/dsql/ddl.cpp 2012-01-08 18:33:59 UTC (rev 53820)
@@ -124,7 +124,6 @@
static char modify_privileges(DsqlCompilerScratch*, NOD_TYPE, SSHORT, const dsql_nod*,
const dsql_nod*, const dsql_nod*, const dsql_nod*);
static void process_role_nm_list(DsqlCompilerScratch*, SSHORT, const dsql_nod*, const dsql_nod*, NOD_TYPE, const dsql_nod*);
-static void define_user(DsqlCompilerScratch*, UCHAR);
static void put_grantor(DsqlCompilerScratch* dsqlScratch, const dsql_nod* grantor);
static void post_607(const Arg::StatusVector& v);
static void put_user_grant(DsqlCompilerScratch* dsqlScratch, const dsql_nod* user);
@@ -603,14 +602,6 @@
grant_revoke(dsqlScratch);
break;
- case nod_add_user:
- define_user(dsqlScratch, isc_dyn_user_add);
- break;
-
- case nod_mod_user:
- define_user(dsqlScratch, isc_dyn_user_mod);
- break;
-
default: // CVC: Shouldn't we complain here?
break;
}
@@ -930,73 +921,6 @@
}
-// *********************
-// d e f i n e _ u s e r
-// *********************
-// Support SQL operator create/alter/drop user
-static void define_user(DsqlCompilerScratch* dsqlScratch, UCHAR op)
-{
- DsqlCompiledStatement* statement = dsqlScratch->getStatement();
-
- dsqlScratch->appendUChar(isc_dyn_user);
-
- const dsql_nod* node = statement->getDdlNode();
- int argCount = 0;
-
- for (int i = 0; i < node->nod_count; ++i)
- {
- const dsql_str* ds = (dsql_str*) node->nod_arg[i];
- if (! ds)
- {
- if (i == e_user_name || (i == e_user_passwd && op == isc_dyn_user_add))
- {
- ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
- // Unexpected end of command
- Arg::Gds(isc_command_end_err2) << Arg::Num(node->nod_line) <<
- Arg::Num(node->nod_column));
- }
-
- continue;
- }
-
- ++argCount;
-
- switch (i)
- {
- case e_user_name:
- dsqlScratch->appendNullString(op, ds->str_data);
- break;
- case e_user_passwd:
- dsqlScratch->appendNullString(isc_dyn_user_passwd, ds->str_data);
- break;
- case e_user_first:
- dsqlScratch->appendNullString(isc_dyn_user_first, ds->str_data);
- break;
- case e_user_middle:
- dsqlScratch->appendNullString(isc_dyn_user_middle, ds->str_data);
- break;
- case e_user_last:
- dsqlScratch->appendNullString(isc_dyn_user_last, ds->str_data);
- break;
- case e_user_admin:
- dsqlScratch->appendNullString(isc_dyn_user_admin, ds->str_data);
- break;
- }
- }
-
- if (argCount < 2)
- {
- ERRD_post(Arg::Gds(isc_sqlerr) << Arg::Num(-104) <<
- // Unexpected end of command
- Arg::Gds(isc_command_end_err2) << Arg::Num(node->nod_line) <<
- Arg::Num(node->nod_column));
- }
-
- dsqlScratch->appendUChar(isc_user_end);
- dsqlScratch->appendUChar(isc_dyn_end);
-}
-
-
static void process_role_nm_list(DsqlCompilerScratch* dsqlScratch,
SSHORT option,
const dsql_nod* user_ptr,
Modified: firebird/trunk/src/dsql/node.h
===================================================================
--- firebird/trunk/src/dsql/node.h 2012-01-08 14:05:29 UTC (rev 53819)
+++ firebird/trunk/src/dsql/node.h 2012-01-08 18:33:59 UTC (rev 53820)
@@ -126,8 +126,6 @@
nod_tra_misc,
nod_lock_timeout,
nod_with,
- nod_add_user,
- nod_mod_user,
nod_class_stmtnode,
nod_class_exprnode,
nod_package_name,
Modified: firebird/trunk/src/dsql/parse.y
===================================================================
--- firebird/trunk/src/dsql/parse.y 2012-01-08 14:05:29 UTC (rev 53819)
+++ firebird/trunk/src/dsql/parse.y 2012-01-08 18:33:59 UTC (rev 53820)
@@ -634,6 +634,7 @@
Firebird::Array<Jrd::dsql_nod*>* legacyArray;
Jrd::ReturningClause* returningClause;
Firebird::PathName* pathNamePtr;
+ Firebird::string* stringPtr;
TEXT* textPtr;
Jrd::DbFileClause* dbFileClause;
Firebird::Array<Jrd::DbFileClause*>* dbFilesClause;
@@ -679,7 +680,7 @@
%type <legacyNode> alter_data_type_or_domain
%type <legacyNode> alter_op alter_ops
%type <stmtNode> alter_sequence_clause
-%type <legacyNode> alter_user_clause
+%type <ddlNode> alter_user_clause
%type <legacyNode> array_element array_range
%type <ddlNode> alter_exception_clause alter_index_clause alter_role_clause alter_udf_clause
%type <ddlNode> alter_view_clause
@@ -691,7 +692,7 @@
%type <legacyNode> array_spec array_type
%type <stmtNode> assignment
%type <compoundStmtNode> assignments
-%type <legacyStr> admin_opt
+%type <nullableIntVal> admin_opt
%type <legacyNode> blob_io blob_segsize blob_subtype blob_subtype_io
%type <filterNameNumber> blob_filter_subtype
@@ -715,7 +716,8 @@
%type <legacyNode> computed_by computed_clause constant constraint_index_opt
%type <boolVal> conditional
%type <legacyNode> constraint_name_opt correlation_name create
-%type <legacyNode> create_clause create_user_clause cross_join
+%type <ddlNode> create_user_clause
+%type <legacyNode> create_clause cross_join
%type <legacyNode> cursor_clause cursor_def
%type <ddlNode> create_or_alter
%type <stmtNode> cursor_declaration_item continue cursor_statement
@@ -758,7 +760,7 @@
%type <legacyNode> from_list
%type <ddlNode> filter_decl_clause
%type <stmtNode> for_select full_proc_block full_proc_block_body
-%type <legacyStr> firstname_opt
+%type <stringPtr> firstname_opt
%type file_clause(<dbFileClause>) file_desc(<dbFileClause>) file_desc1(<dbFileClause>)
%type fetch_scroll(<cursorStmtNode>)
%type <int32Val> first_file_length
@@ -767,7 +769,7 @@
%type <legacyNode> generated_always_clause grant grant_option granted_by granted_by_text grantee grantee_list
%type <legacyNode> grantor group_by_item group_by_list group_clause
%type <ddlNode> gtt_recreate_clause
-%type <legacyStr> grant_admin grant_admin_opt
+%type <nullableIntVal> grant_admin grant_admin_opt
%type <legacyNode> having_clause
@@ -789,7 +791,7 @@
%type <stmtNode> local_declaration local_declaration_item
%type <compoundStmtNode> local_declaration_list local_declarations
%type <legacyNode> lock_clause lock_mode lock_type lock_wait
-%type <legacyStr> lastname_opt
+%type <stringPtr> lastname_opt
%type <int32Val> long_integer
%type <boolVal> manual_auto
@@ -797,7 +799,8 @@
%type merge_insert_specification(<mergeNode>) merge_update_specification(<mergeNode>)
%type merge_when_clause(<mergeNode>) merge_when_matched_clause(<mergeNode>)
%type merge_when_not_matched_clause(<mergeNode>)
-%type <legacyStr> middlename_opt module_op
+%type <stringPtr> middlename_opt
+%type <legacyStr> module_op
%type <legacyNode> named_columns_join national_character_keyword
%type <legacyNode> national_character_type natural_join
@@ -825,7 +828,7 @@
%type <legacyArray> proc_outputs_opt
%type <stmtNode> post_event proc_block proc_statement
%type <compoundStmtNode> proc_statements
-%type <legacyStr> passwd_clause passwd_opt
+%type <stringPtr> passwd_clause passwd_opt
%type <int32Val> pos_short_integer precision_opt
%type <legacyNode> qualified_join query_spec query_term
@@ -843,7 +846,7 @@
%type <legacyNode> role_name role_name_list rollback rows_clause
%type <ddlNode> role_clause rtable_clause
%type <ddlNode> rview_clause
-%type <legacyStr> revoke_admin
+%type <nullableIntVal> revoke_admin
%type <legacyNode> savepoint scroll_opt search_condition searched_case
%type <valueIfNode> searched_when_clause
@@ -1363,7 +1366,7 @@
| COLLATION collation_clause
{ $$ = makeClassNode($2); }
| USER create_user_clause
- { $$ = $2; }
+ { $$ = makeClassNode($2); }
| PACKAGE package_clause
{ $$ = makeClassNode($2); }
| PACKAGE BODY package_body_clause
@@ -3261,7 +3264,7 @@
| ROLE alter_role_clause
{ $$ = makeClassNode($2); }
| USER alter_user_clause
- { $$ = $2; }
+ { $$ = makeClassNode($2); }
| CHARACTER SET alter_charset_clause
{ $$ = makeClassNode($3); }
;
@@ -5386,57 +5389,88 @@
create_user_clause
: symbol_user_name passwd_clause firstname_opt middlename_opt lastname_opt grant_admin_opt
- { $$ = make_node(nod_add_user, (int) e_user_count, $1, $2, $3, $4, $5, $6); }
+ {
+ CreateAlterUserNode* node = newNode<CreateAlterUserNode>(true, toName($1));
+ node->password = $2;
+ node->firstName = $3;
+ node->middleName = $4;
+ node->lastName = $5;
+ node->adminRole = $6;
+ $$ = node;
+ }
;
alter_user_clause
- : symbol_user_name passwd_opt firstname_opt middlename_opt lastname_opt admin_opt
- { $$ = make_node(nod_mod_user, (int) e_user_count, $1, $2, $3, $4, $5, $6); }
- | symbol_user_name SET passwd_opt firstname_opt middlename_opt lastname_opt admin_opt
- { $$ = make_node(nod_mod_user, (int) e_user_count, $1, $3, $4, $5, $6, $7); }
+ : symbol_user_name set_noise passwd_opt firstname_opt middlename_opt lastname_opt admin_opt
+ {
+ CreateAlterUserNode* node = newNode<CreateAlterUserNode>(false, toName($1));
+ node->password = $3;
+ node->firstName = $4;
+ node->middleName = $5;
+ node->lastName = $6;
+ node->adminRole = $7;
+ $$ = node;
+ }
;
passwd_clause
- : PASSWORD sql_string { $$ = $2; }
+ : PASSWORD sql_string
+ { $$ = newNode<string>($2->str_data, $2->str_length); }
;
+set_noise
+ : // nothing
+ | SET
+ ;
+
passwd_opt
- : /* nothing */ { $$ = NULL; }
- | passwd_clause { $$ = $1; }
+ : // nothing
+ { $$ = NULL; }
+ | passwd_clause
;
firstname_opt
- : /* nothing */ { $$ = NULL; }
- | FIRSTNAME sql_string { $$ = $2; }
+ : // nothing
+ { $$ = NULL; }
+ | FIRSTNAME sql_string
+ { $$ = newNode<string>($2->str_data, $2->str_length); }
;
middlename_opt
- : /* nothing */ { $$ = NULL; }
- | MIDDLENAME sql_string { $$ = $2; }
+ : // nothing
+ { $$ = NULL; }
+ | MIDDLENAME sql_string
+ { $$ = newNode<string>($2->str_data, $2->str_length); }
;
lastname_opt
- : /* nothing */ { $$ = NULL; }
- | LASTNAME sql_string { $$ = $2; }
+ : // nothing
+ { $$ = NULL; }
+ | LASTNAME sql_string
+ { $$ = newNode<string>($2->str_data, $2->str_length); }
;
admin_opt
- : /* nothing */ { $$ = NULL; }
+ : // nothing
+ { $$ = Nullable<int>::empty(); }
| revoke_admin
| grant_admin
;
grant_admin_opt
- : /* nothing */ { $$ = NULL; }
- | grant_admin { $$ = $1; }
+ : // nothing
+ { $$ = Nullable<int>::empty(); }
+ | grant_admin
;
revoke_admin
- : REVOKE ADMIN ROLE { $$ = MAKE_cstring("0"); }
+ : REVOKE ADMIN ROLE
+ { $$ = Nullable<int>::val(0); }
;
grant_admin
- : GRANT ADMIN ROLE { $$ = MAKE_cstring("1"); }
+ : GRANT ADMIN ROLE
+ { $$ = Nullable<int>::val(1); }
;
// value types
Modified: firebird/trunk/src/dsql/pass1.cpp
===================================================================
--- firebird/trunk/src/dsql/pass1.cpp 2012-01-08 14:05:29 UTC (rev 53819)
+++ firebird/trunk/src/dsql/pass1.cpp 2012-01-08 18:33:59 UTC (rev 53820)
@@ -896,8 +896,6 @@
case nod_grant:
case nod_revoke:
case nod_def_domain:
- case nod_add_user:
- case nod_mod_user:
dsqlScratch->getStatement()->setType(DsqlCompiledStatement::TYPE_DDL);
return input;
@@ -4969,14 +4967,6 @@
verb = "with";
break;
- case nod_add_user:
- verb = "add_user";
- break;
-
- case nod_mod_user:
- verb = "mod_user";
- break;
-
case nod_class_exprnode:
case nod_class_stmtnode:
reinterpret_cast<Node*>(node->nod_arg[0])->print(verb, subNodes);
Modified: firebird/trunk/src/include/gen/codetext.h
===================================================================
--- firebird/trunk/src/include/gen/codetext.h 2012-01-08 14:05:29 UTC (rev 53819)
+++ firebird/trunk/src/include/gen/codetext.h 2012-01-08 18:33:59 UTC (rev 53820)
@@ -858,6 +858,7 @@
{"dyn_routine_param_ambiguous", 336068888},
{"dyn_coll_used_function", 336068889},
{"dyn_domain_used_function", 336068890},
+ {"dyn_alter_user_no_clause", 336068891},
{"gbak_unknown_switch", 336330753},
{"gbak_page_size_missing", 336330754},
{"gbak_page_size_toobig", 336330755},
@@ -1068,6 +1069,8 @@
{"dsql_create_shadow_failed", 336397314},
{"dsql_create_filter_failed", 336397315},
{"dsql_create_index_failed", 336397316},
+ {"dsql_create_user_failed", 336397317},
+ {"dsql_alter_user_failed", 336397318},
{"gsec_cant_open_db", 336723983},
{"gsec_switches_error", 336723984},
{"gsec_no_op_spec", 336723985},
Modified: firebird/trunk/src/include/gen/iberror.h
===================================================================
--- firebird/trunk/src/include/gen/iberror.h 2012-01-08 14:05:29 UTC (rev 53819)
+++ firebird/trunk/src/include/gen/iberror.h 2012-01-08 18:33:59 UTC (rev 53820)
@@ -892,6 +892,7 @@
const ISC_STATUS isc_dyn_routine_param_ambiguous = 336068888L;
const ISC_STATUS isc_dyn_coll_used_function = 336068889L;
const ISC_STATUS isc_dyn_domain_used_function = 336068890L;
+const ISC_STATUS isc_dyn_alter_user_no_clause = 336068891L;
const ISC_STATUS isc_gbak_unknown_switch = 336330753L;
const ISC_STATUS isc_gbak_page_size_missing = 336330754L;
const ISC_STATUS isc_gbak_page_size_toobig = 336330755L;
@@ -1102,6 +1103,8 @@
const ISC_STATUS isc_dsql_create_shadow_failed = 336397314L;
const ISC_STATUS isc_dsql_create_filter_failed = 336397315L;
const ISC_STATUS isc_dsql_create_index_failed = 336397316L;
+const ISC_STATUS isc_dsql_create_user_failed = 336397317L;
+const ISC_STATUS isc_dsql_alter_user_failed = 336397318L;
const ISC_STATUS isc_gsec_cant_open_db = 336723983L;
const ISC_STATUS isc_gsec_switches_error = 336723984L;
const ISC_STATUS isc_gsec_no_op_spec = 336723985L;
@@ -1203,7 +1206,7 @@
const ISC_STATUS isc_trace_switch_param_miss = 337182758L;
const ISC_STATUS isc_trace_param_act_notcompat = 337182759L;
const ISC_STATUS isc_trace_mandatory_switch_miss = 337182760L;
-const ISC_STATUS isc_err_max = 1147;
+const ISC_STATUS isc_err_max = 1150;
#else /* c definitions */
@@ -2065,6 +2068,7 @@
#define isc_dyn_routine_param_ambiguous 336068888L
#define isc_dyn_coll_used_function 336068889L
#define isc_dyn_domain_used_function 336068890L
+#define isc_dyn_alter_user_no_clause 336068891L
#define isc_gbak_unknown_switch 336330753L
#define isc_gbak_page_size_missing 336330754L
#define isc_gbak_page_size_toobig 336330755L
@@ -2275,6 +2279,8 @@
#define isc_dsql_create_shadow_failed 336397314L
#define isc_dsql_create_filter_failed 336397315L
#define isc_dsql_create_index_failed 336397316L
+#define isc_dsql_create_user_failed 336397317L
+#define isc_dsql_alter_user_failed 336397318L
#define isc_gsec_cant_open_db 336723983L
#define isc_gsec_switches_error 336723984L
#define isc_gsec_no_op_spec 336723985L
@@ -2376,7 +2382,7 @@
#define isc_trace_switch_param_miss 337182758L
#define isc_trace_param_act_notcompat 337182759L
#define isc_trace_mandatory_switch_miss 337182760L
-#define isc_err_max 1147
+#define isc_err_max 1150
#endif
Modified: firebird/trunk/src/include/gen/msgs.h
===================================================================
--- firebird/trunk/src/include/gen/msgs.h 2012-01-08 14:05:29 UTC (rev 53819)
+++ firebird/trunk/src/include/gen/msgs.h 2012-01-08 18:33:59 UTC (rev 53820)
@@ -861,6 +861,7 @@
{336068888, "Parameter @1 of routine @2 is ambiguous (found in both procedures and functions). Use a specifier keyword."}, /* dyn_routine_param_ambiguous */
{336068889, "Collation @1 is used in function @2 (parameter name @3) and cannot be dropped"}, /* dyn_coll_used_function */
{336068890, "Domain @1 is used in function @2 (parameter name @3) and cannot be dropped"}, /* dyn_domain_used_function */
+ {336068891, "ALTER USER requires at least one clause to be specified"}, /* dyn_alter_user_no_clause */
{336330753, "found unknown switch"}, /* gbak_unknown_switch */
{336330754, "page size parameter missing"}, /* gbak_page_size_missing */
{336330755, "Page size specified (@1) greater than limit (16384 bytes)"}, /* gbak_page_size_toobig */
@@ -1071,6 +1072,8 @@
{336397314, "CREATE SHADOW @1 failed"}, /* dsql_create_shadow_failed */
{336397315, "DECLARE FILTER @1 failed"}, /* dsql_create_filter_failed */
{336397316, "CREATE INDEX @1 failed"}, /* dsql_create_index_failed */
+ {336397317, "CREATE USER @1 failed"}, /* dsql_create_user_failed */
+ {336397318, "ALTER USER @1 failed"}, /* dsql_alter_user_failed */
{336723983, "unable to open database"}, /* gsec_cant_open_db */
{336723984, "error in switch specifications"}, /* gsec_switches_error */
{336723985, "no operation specified"}, /* gsec_no_op_spec */
Modified: firebird/trunk/src/include/gen/sql_code.h
===================================================================
--- firebird/trunk/src/include/gen/sql_code.h 2012-01-08 14:05:29 UTC (rev 53819)
+++ firebird/trunk/src/include/gen/sql_code.h 2012-01-08 18:33:59 UTC (rev 53820)
@@ -857,6 +857,7 @@
{336068888, -901}, /* 280 dyn_routine_param_ambiguous */
{336068889, -901}, /* 281 dyn_coll_used_function */
{336068890, -901}, /* 282 dyn_domain_used_function */
+ {336068891, -901}, /* 283 dyn_alter_user_no_clause */
{336330753, -901}, /* 1 gbak_unknown_switch */
{336330754, -901}, /* 2 gbak_page_size_missing */
{336330755, -901}, /* 3 gbak_page_size_toobig */
@@ -1067,6 +1068,8 @@
{336397314, -901}, /* 1026 dsql_create_shadow_failed */
{336397315, -901}, /* 1027 dsql_create_filter_failed */
{336397316, -901}, /* 1028 dsql_create_index_failed */
+ {336397317, -901}, /* 1029 dsql_create_user_failed */
+ {336397318, -901}, /* 1030 dsql_alter_user_failed */
{336723983, -901}, /* 15 gsec_cant_open_db */
{336723984, -901}, /* 16 gsec_switches_error */
{336723985, -901}, /* 17 gsec_no_op_spec */
Modified: firebird/trunk/src/include/gen/sql_state.h
===================================================================
--- firebird/trunk/src/include/gen/sql_state.h 2012-01-08 14:05:29 UTC (rev 53819)
+++ firebird/trunk/src/include/gen/sql_state.h 2012-01-08 18:33:59 UTC (rev 53820)
@@ -857,6 +857,7 @@
{336068888, "42000"}, // 280 dyn_routine_param_ambiguous
{336068889, "HY000"}, // 281 dyn_coll_used_function
{336068890, "HY000"}, // 282 dyn_domain_used_function
+ {336068891, "42000"}, // 283 dyn_alter_user_no_clause
{336330753, "00000"}, // 1 gbak_unknown_switch
{336330754, "00000"}, // 2 gbak_page_size_missing
{336330755, "00000"}, // 3 gbak_page_size_toobig
@@ -1067,6 +1068,8 @@
{336397314, "42000"}, // 1026 dsql_create_shadow_failed
{336397315, "42000"}, // 1027 dsql_create_filter_failed
{336397316, "42000"}, // 1028 dsql_create_index_failed
+ {336397317, "42000"}, // 1029 dsql_create_user_failed
+ {336397318, "42000"}, // 1030 dsql_alter_user_failed
{336723983, "00000"}, // 15 gsec_cant_open_db
{336723984, "00000"}, // 16 gsec_switches_error
{336723985, "00000"}, // 17 gsec_no_op_spec
Modified: firebird/trunk/src/jrd/dyn.epp
===================================================================
--- firebird/trunk/src/jrd/dyn.epp 2012-01-08 14:05:29 UTC (rev 53819)
+++ firebird/trunk/src/jrd/dyn.epp 2012-01-08 18:33:59 UTC (rev 53820)
@@ -95,7 +95,6 @@
static void store_privilege(Global*, const MetaName&, const MetaName&, const MetaName&,
const TEXT*, SSHORT, SSHORT, int, const MetaName&);
static void set_field_class_name(Global*, const MetaName&, const MetaName&);
-static void dyn_user(Global*, const UCHAR**);
void DYN_ddl(jrd_tra* transaction, ULONG length, const UCHAR* ddl, const string& sqlText)
@@ -367,16 +366,6 @@
revoke_all(gbl, ptr);
break;
- /***
- case isc_dyn_def_role:
- create_role (gbl, ptr);
- break;
- ***/
-
- case isc_dyn_user:
- dyn_user(gbl, ptr);
- break;
-
default:
DYN_unsupported_verb();
break;
@@ -1747,157 +1736,3 @@
// msg 79: "STORE RDB$USER_PRIVILEGES failed in grant"
}
}
-
-
-static void dyn_user(Global* gbl, const UCHAR** ptr)
-{
-/**************************************
- *
- * d y n _ u s e r
- *
- **************************************
- *
- * Functional description
- * Implements CREATE/ALTER USER
- *
- **************************************/
- thread_db* tdbb = JRD_get_thread_data();
- jrd_tra* const tra = tdbb->getTransaction();
-
- ISC_STATUS_ARRAY status;
- try
- {
- class DynamicUserData : public Firebird::VersionedIface<Auth::UserData, FB_AUTH_USER_VERSION>
- {
- public:
-
-#ifdef DEBUG_GDS_ALLOC
- void* operator new(size_t size, Firebird::MemoryPool& pool, const char* fileName, int line)
- {
- return pool.allocate(size, fileName, line);
- }
-#else // DEBUG_GDS_ALLOC
- void* operator new(size_t size, Firebird::MemoryPool& pool)
- {
- return pool.allocate(size);
- }
-#endif // DEBUG_GDS_ALLOC
- };
-
- DynamicUserData* userData = FB_NEW(*tra->tra_pool) DynamicUserData;
- UCHAR verb;
- while ((verb = *(*ptr)++) != isc_user_end)
- {
- string text;
- GET_STRING(ptr, text);
-
- switch (verb)
- {
- case isc_dyn_user_add:
- text.upper();
- userData->op = ADD_OPER;
- userData->user.set(text.c_str());
- userData->user.setEntered(1);
- break;
-
- case isc_dyn_user_mod:
- text.upper();
- userData->op = MOD_OPER;
- userData->user.set(text.c_str());
- userData->user.setEntered(1);
- break;
-
- case isc_dyn_user_passwd:
- if (text.isEmpty())
- {
- // 250: Password should not be empty string
- status_exception::raise(Arg::Gds(ENCODE_ISC_MSG(250, DYN_MSG_FAC)));
- }
- userData->pass.set(text.c_str());
- userData->pass.setEntered(1);
- break;
-
- case isc_dyn_user_first:
- if (text.hasData())
- {
- userData->first.set(text.c_str());
- userData->first.setEntered(1);
- }
- else
- {
- userData->first.setEntered(0);
- userData->first.setSpecified(1);
- }
- break;
-
- case isc_dyn_user_middle:
- if (text.hasData())
- {
- userData->middle.set(text.c_str());
- userData->middle.setEntered(1);
- }
- else
- {
- userData->middle.setEntered(0);
- userData->middle.setSpecified(1);
- }
- break;
-
- case isc_dyn_user_last:
- if (text.hasData())
- {
- userData->last.set(text.c_str());
- userData->last.setEntered(1);
- }
- else
- {
- userData->last.setEntered(0);
- userData->last.setSpecified(1);
- }
- break;
-
- case isc_dyn_user_admin:
- fb_assert(text.hasData());
- userData->adm.set(text[0] - '0');
- userData->adm.setEntered(1);
- break;
- }
- }
-
- int ddlAction = 0;
-
- switch (userData->op)
- {
- case ADD_OPER:
- ddlAction = DDL_TRIGGER_CREATE_USER;
- break;
-
- case MOD_OPER:
- ddlAction = DDL_TRIGGER_ALTER_USER;
- break;
- }
-
- if (ddlAction != 0)
- {
- DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_BEFORE,
- ddlAction, userData->user.get(), gbl->sqlText);
- }
-
- USHORT id = tra->getUserManagement()->put(userData);
- DFW_post_work(tra, dfw_user_management, NULL, id);
-
- if (ddlAction != 0)
- {
- DdlNode::executeDdlTrigger(tdbb, gbl->gbl_transaction, DdlNode::DTW_AFTER,
- ddlAction, userData->user.get(), gbl->sqlText);
- }
- }
- catch (const Exception& e)
- {
- e.stuff_exception(status);
- memmove(&status[2], &status[0], sizeof(status) - 2 * sizeof(status[0]));
- status[0] = isc_arg_gds;
- status[1] = isc_no_meta_update;
- status_exception::raise(status);
- }
-}
Modified: firebird/trunk/src/msgs/facilities2.sql
===================================================================
--- firebird/trunk/src/msgs/facilities2.sql 2012-01-08 14:05:29 UTC (rev 53819)
+++ firebird/trunk/src/msgs/facilities2.sql 2012-01-08 18:33:59 UTC (rev 53820)
@@ -3,35 +3,18 @@
--
('2011-12-22 18:36:31', 'JRD', 0, 710)
('2010-03-15 06:59:09', 'QLI', 1, 531)
---
---('2008-11-28 20:27:04', 'GDEF', 2, 346)
---
('2009-07-16 05:26:11', 'GFIX', 3, 121)
('1996-11-07 13:39:40', 'GPRE', 4, 1)
---
---('1996-11-07 13:39:40', 'GLTJ', 5, 1)
---('1996-11-07 13:39:40', 'GRST', 6, 1)
---
('2005-11-05 13:09:00', 'DSQL', 7, 32)
-('2011-07-15 12:08:00', 'DYN', 8, 283)
---
---('1996-11-07 13:39:40', 'FRED', 9, 1)
---
+('2011-07-15 12:08:00', 'DYN', 8, 284)
('1996-11-07 13:39:40', 'INSTALL', 10, 1)
('1996-11-07 13:38:41', 'TEST', 11, 4)
('2011-06-01 12:57:44', 'GBAK', 12, 351)
-('2010-11-27 13:05:00', 'SQLERR', 13, 1029)
+('2010-11-27 13:05:00', 'SQLERR', 13, 1031)
('1996-11-07 13:38:42', 'SQLWARN', 14, 613)
('2006-09-10 03:04:31', 'JRD_BUGCHK', 15, 307)
---
---('1996-11-07 13:38:43', 'GJRN', 16, 241)
---
('2009-12-21 04:00:05', 'ISQL', 17, 173)
('2010-07-10 10:50:30', 'GSEC', 18, 105)
---
---('2002-03-05 02:30:12', 'LICENSE', 19, 60)
---('2002-03-05 02:31:54', 'DOS', 20, 74)
---
('2009-12-26 14:22:00', 'GSTAT', 21, 50)
('2009-12-18 19:33:34', 'FBSVCMGR', 22, 57)
('2009-07-18 12:12:12', 'UTL', 23, 2)
Modified: firebird/trunk/src/msgs/messages2.sql
===================================================================
--- firebird/trunk/src/msgs/messages2.sql 2012-01-08 14:05:29 UTC (rev 53819)
+++ firebird/trunk/src/msgs/messages2.sql 2012-01-08 18:33:59 UTC (rev 53820)
@@ -1858,6 +1858,7 @@
('dyn_routine_param_ambiguous', 'OnCommentNode::execute', 'DdlNodes.epp', NULL, 8, 280, NULL, 'Parameter @1 of routine @2 is ambiguous (found in both procedures and functions). Use a specifier keyword.', NULL, NULL);
('dyn_coll_used_function', 'DropCollationNode::execute', 'DdlNodes.epp', NULL, 8, 281, NULL, 'Collation @1 is used in function @2 (parameter name @3) and cannot be dropped', NULL, NULL);
('dyn_domain_used_function', 'DropDomainNode', 'DdlNodes.epp', NULL, 8, 282, NULL, 'Domain @1 is used in function @2 (parameter name @3) and cannot be dropped', NULL, NULL);
+('dyn_alter_user_no_clause', 'CreateAlterUserNode', 'DdlNodes.epp', NULL, 8, 283, NULL, 'ALTER USER requires at least one clause to be specified', NULL, NULL);
COMMIT WORK;
-- TEST
(NULL, 'main', 'test.c', NULL, 11, 0, NULL, 'This is a modified text message', NULL, NULL);
@@ -2497,6 +2498,8 @@
('dsql_create_shadow_failed', 'getMainErrorCode', 'DdlNodes.h', NULL, 13, 1026, NULL, 'CREATE SHADOW @1 failed', NULL, NULL);
('dsql_create_filter_failed', 'getMainErrorCode', 'DdlNodes.h', NULL, 13, 1027, NULL, 'DECLARE FILTER @1 failed', NULL, NULL);
('dsql_create_index_failed', 'getMainErrorCode', 'DdlNodes.h', NULL, 13, 1028, NULL, 'CREATE INDEX @1 failed', NULL, NULL);
+('dsql_create_user_failed', 'getMainErrorCode', 'DdlNodes.h', NULL, 13, 1029, NULL, 'CREATE USER @1 failed', NULL, NULL);
+('dsql_alter_user_failed', 'getMainErrorCode', 'DdlNodes.h', NULL, 13, 1030, NULL, 'ALTER USER @1 failed', NULL, NULL);
-- SQLWARN
(NULL, NULL, NULL, NULL, 14, 100, NULL, 'Row not found for fetch, update or delete, or the result of a query is an empty table.', NULL, NULL);
(NULL, NULL, NULL, NULL, 14, 101, NULL, 'segment buffer length shorter than expected', NULL, NULL);
Modified: firebird/trunk/src/msgs/system_errors2.sql
===================================================================
--- firebird/trunk/src/msgs/system_errors2.sql 2012-01-08 14:05:29 UTC (rev 53819)
+++ firebird/trunk/src/msgs/system_errors2.sql 2012-01-08 18:33:59 UTC (rev 53820)
@@ -845,6 +845,7 @@
(-901, '42', '000', 8, 280, 'dyn_routine_param_ambiguous', NULL, NULL)
(-901, 'HY', '000', 8, 281, 'dyn_coll_used_function', NULL, NULL)
(-901, 'HY', '000', 8, 282, 'dyn_domain_used_function', NULL, NULL)
+(-901, '42', '000', 8, 283, 'dyn_alter_user_no_clause', NULL, NULL)
-- GBAK
(-901, '00', '000', 12, 1, 'gbak_unknown_switch', NULL, NULL)
(-901, '00', '000', 12, 2, 'gbak_page_size_missing', NULL, NULL)
@@ -1060,6 +1061,8 @@
(-901, '42', '000', 13, 1026, 'dsql_create_shadow_failed', NULL, NULL);
(-901, '42', '000', 13, 1027, 'dsql_create_filter_failed', NULL, NULL);
(-901, '42', '000', 13, 1028, 'dsql_create_index_failed', NULL, NULL);
+(-901, '42', '000', 13, 1029, 'dsql_create_user_failed', NULL, NULL);
+(-901, '42', '000', 13, 1030, 'dsql_alter_user_failed', NULL, NULL);
-- GSEC
(-901, '00', '000', 18, 15, 'gsec_cant_open_db', NULL, NULL)
(-901, '00', '000', 18, 16, 'gsec_switches_error', NULL, NULL)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|