mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 17:23:03 +01:00
Improvement CORE-4923 - Add ability to track domains rename in DDL triggers.
This commit is contained in:
parent
e40817b59d
commit
64f82e1682
@ -89,6 +89,9 @@ Semantics:
|
|||||||
triggers are fired, AFTER triggers will not be fired.
|
triggers are fired, AFTER triggers will not be fired.
|
||||||
8) Packaged procedures and triggers do not fire individual {CREATE | ALTER | DROP} {PROCEDURE |
|
8) Packaged procedures and triggers do not fire individual {CREATE | ALTER | DROP} {PROCEDURE |
|
||||||
FUNCTION} triggers.
|
FUNCTION} triggers.
|
||||||
|
9) ALTER DOMAIN <old name> TO <new name> sets OLD_OBJECT_NAME and NEW_OBJECT_NAME in both BEFORE
|
||||||
|
and AFTER triggers. Note that for this command, OBJECT_NAME will have the old object name
|
||||||
|
in BEFORE triggers and the new object name in AFTER TRIGGERS.
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
1) COMMENT ON, GRANT, REVOKE and ALTER DATABASE do not fire DDL triggers.
|
1) COMMENT ON, GRANT, REVOKE and ALTER DATABASE do not fire DDL triggers.
|
||||||
@ -117,6 +120,8 @@ DDL_TRIGGER context namespace:
|
|||||||
- OBJECT_TYPE: object type (TABLE, VIEW, etc)
|
- OBJECT_TYPE: object type (TABLE, VIEW, etc)
|
||||||
- DDL_EVENT: event name (<ddl event item>), where <ddl_event_item> is EVENT_TYPE || ' ' || OBJECT_TYPE
|
- DDL_EVENT: event name (<ddl event item>), where <ddl_event_item> is EVENT_TYPE || ' ' || OBJECT_TYPE
|
||||||
- OBJECT_NAME: metadata object name
|
- OBJECT_NAME: metadata object name
|
||||||
|
- OLD_OBJECT_NAME: metadata object name before a rename
|
||||||
|
- NEW_OBJECT_NAME: metadata object name after a rename
|
||||||
- SQL_TEXT: sql statement text
|
- SQL_TEXT: sql statement text
|
||||||
|
|
||||||
|
|
||||||
@ -207,6 +212,8 @@ create table ddl_log (
|
|||||||
object_type varchar(25) not null,
|
object_type varchar(25) not null,
|
||||||
ddl_event varchar(25) not null,
|
ddl_event varchar(25) not null,
|
||||||
object_name varchar(31) not null,
|
object_name varchar(31) not null,
|
||||||
|
old_object_name varchar(31),
|
||||||
|
new_object_name varchar(31),
|
||||||
sql_text blob sub_type text not null,
|
sql_text blob sub_type text not null,
|
||||||
ok char(1) not null
|
ok char(1) not null
|
||||||
);
|
);
|
||||||
@ -222,12 +229,14 @@ begin
|
|||||||
in autonomous transaction do
|
in autonomous transaction do
|
||||||
begin
|
begin
|
||||||
insert into ddl_log (id, moment, user_name, event_type, object_type, ddl_event, object_name,
|
insert into ddl_log (id, moment, user_name, event_type, object_type, ddl_event, object_name,
|
||||||
sql_text, ok)
|
old_object_name, new_object_name, sql_text, ok)
|
||||||
values (next value for ddl_seq, current_timestamp, current_user,
|
values (next value for ddl_seq, current_timestamp, current_user,
|
||||||
rdb$get_context('DDL_TRIGGER', 'EVENT_TYPE'),
|
rdb$get_context('DDL_TRIGGER', 'EVENT_TYPE'),
|
||||||
rdb$get_context('DDL_TRIGGER', 'OBJECT_TYPE'),
|
rdb$get_context('DDL_TRIGGER', 'OBJECT_TYPE'),
|
||||||
rdb$get_context('DDL_TRIGGER', 'DDL_EVENT'),
|
rdb$get_context('DDL_TRIGGER', 'DDL_EVENT'),
|
||||||
rdb$get_context('DDL_TRIGGER', 'OBJECT_NAME'),
|
rdb$get_context('DDL_TRIGGER', 'OBJECT_NAME'),
|
||||||
|
rdb$get_context('DDL_TRIGGER', 'OLD_OBJECT_NAME'),
|
||||||
|
rdb$get_context('DDL_TRIGGER', 'NEW_OBJECT_NAME'),
|
||||||
rdb$get_context('DDL_TRIGGER', 'SQL_TEXT'),
|
rdb$get_context('DDL_TRIGGER', 'SQL_TEXT'),
|
||||||
'N')
|
'N')
|
||||||
returning id into id;
|
returning id into id;
|
||||||
@ -277,13 +286,17 @@ recreate table t1 (
|
|||||||
n integer
|
n integer
|
||||||
);
|
);
|
||||||
|
|
||||||
|
create domain dom1 as integer;
|
||||||
|
alter domain dom1 type bigint;
|
||||||
|
alter domain dom1 to dom2;
|
||||||
|
|
||||||
commit;
|
commit;
|
||||||
|
|
||||||
select id, ddl_event, object_name, sql_text, ok from ddl_log order by id;
|
select id, ddl_event, object_name, old_object_name, new_object_name, sql_text, ok from ddl_log order by id;
|
||||||
|
|
||||||
ID DDL_EVENT OBJECT_NAME SQL_TEXT OK
|
ID DDL_EVENT OBJECT_NAME OLD_OBJECT_NAME NEW_OBJECT_NAME SQL_TEXT OK
|
||||||
===================== ========================= =============================== ================= ======
|
===================== ========================= =============================== =============================== =============================== ================= ======
|
||||||
2 CREATE TABLE T1 80:3 Y
|
2 CREATE TABLE T1 <null> <null> 80:0 Y
|
||||||
==============================================================================
|
==============================================================================
|
||||||
SQL_TEXT:
|
SQL_TEXT:
|
||||||
recreate table t1 (
|
recreate table t1 (
|
||||||
@ -291,7 +304,7 @@ recreate table t1 (
|
|||||||
n2 integer
|
n2 integer
|
||||||
)
|
)
|
||||||
==============================================================================
|
==============================================================================
|
||||||
3 CREATE TABLE T1 80:2 N
|
3 CREATE TABLE T1 <null> <null> 80:1 N
|
||||||
==============================================================================
|
==============================================================================
|
||||||
SQL_TEXT:
|
SQL_TEXT:
|
||||||
create table t1 (
|
create table t1 (
|
||||||
@ -299,18 +312,33 @@ create table t1 (
|
|||||||
n2 integer
|
n2 integer
|
||||||
)
|
)
|
||||||
==============================================================================
|
==============================================================================
|
||||||
4 DROP TABLE T1 80:6 Y
|
4 DROP TABLE T1 <null> <null> 80:2 Y
|
||||||
==============================================================================
|
==============================================================================
|
||||||
SQL_TEXT:
|
SQL_TEXT:
|
||||||
recreate table t1 (
|
recreate table t1 (
|
||||||
n integer
|
n integer
|
||||||
)
|
)
|
||||||
==============================================================================
|
==============================================================================
|
||||||
5 CREATE TABLE T1 80:9 Y
|
5 CREATE TABLE T1 <null> <null> 80:3 Y
|
||||||
==============================================================================
|
==============================================================================
|
||||||
SQL_TEXT:
|
SQL_TEXT:
|
||||||
recreate table t1 (
|
recreate table t1 (
|
||||||
n integer
|
n integer
|
||||||
)
|
)
|
||||||
|
==============================================================================
|
||||||
|
6 CREATE DOMAIN DOM1 <null> <null> 80:4 Y
|
||||||
|
==============================================================================
|
||||||
|
SQL_TEXT:
|
||||||
|
create domain dom1 as integer
|
||||||
|
==============================================================================
|
||||||
|
7 ALTER DOMAIN DOM1 <null> <null> 80:5 Y
|
||||||
|
==============================================================================
|
||||||
|
SQL_TEXT:
|
||||||
|
alter domain dom1 type bigint
|
||||||
|
==============================================================================
|
||||||
|
8 ALTER DOMAIN DOM1 DOM1 DOM2 80:6 Y
|
||||||
|
==============================================================================
|
||||||
|
SQL_TEXT:
|
||||||
|
alter domain dom1 to dom2
|
||||||
==============================================================================
|
==============================================================================
|
||||||
|
|
||||||
|
@ -903,7 +903,7 @@ void DdlNode::storePrivileges(thread_db* tdbb, jrd_tra* transaction,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DdlNode::executeDdlTrigger(thread_db* tdbb, jrd_tra* transaction, DdlTriggerWhen when,
|
void DdlNode::executeDdlTrigger(thread_db* tdbb, jrd_tra* transaction, DdlTriggerWhen when,
|
||||||
int action, const MetaName& objectName, const string& sqlText)
|
int action, const MetaName& objectName, const MetaName& oldNewObjectName, const string& sqlText)
|
||||||
{
|
{
|
||||||
Attachment* const attachment = transaction->tra_attachment;
|
Attachment* const attachment = transaction->tra_attachment;
|
||||||
|
|
||||||
@ -918,6 +918,12 @@ void DdlNode::executeDdlTrigger(thread_db* tdbb, jrd_tra* transaction, DdlTrigge
|
|||||||
context.objectName = objectName;
|
context.objectName = objectName;
|
||||||
context.sqlText = sqlText;
|
context.sqlText = sqlText;
|
||||||
|
|
||||||
|
if (oldNewObjectName.hasData())
|
||||||
|
{
|
||||||
|
context.oldObjectName = when == DTW_BEFORE ? objectName : oldNewObjectName;
|
||||||
|
context.newObjectName = when == DTW_BEFORE ? oldNewObjectName : objectName;
|
||||||
|
}
|
||||||
|
|
||||||
Stack<DdlTriggerContext>::AutoPushPop autoContext(attachment->ddlTriggersContext, context);
|
Stack<DdlTriggerContext>::AutoPushPop autoContext(attachment->ddlTriggersContext, context);
|
||||||
AutoSavePoint savePoint(tdbb, transaction);
|
AutoSavePoint savePoint(tdbb, transaction);
|
||||||
|
|
||||||
@ -927,9 +933,10 @@ void DdlNode::executeDdlTrigger(thread_db* tdbb, jrd_tra* transaction, DdlTrigge
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DdlNode::executeDdlTrigger(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
void DdlNode::executeDdlTrigger(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
||||||
jrd_tra* transaction, DdlTriggerWhen when, int action, const MetaName& objectName)
|
jrd_tra* transaction, DdlTriggerWhen when, int action, const MetaName& objectName,
|
||||||
|
const MetaName& oldNewObjectName)
|
||||||
{
|
{
|
||||||
executeDdlTrigger(tdbb, transaction, when, action, objectName,
|
executeDdlTrigger(tdbb, transaction, when, action, objectName, oldNewObjectName,
|
||||||
*dsqlScratch->getStatement()->getSqlText());
|
*dsqlScratch->getStatement()->getSqlText());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1100,7 +1107,7 @@ void AlterCharSetNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch
|
|||||||
charSetFound = true;
|
charSetFound = true;
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_ALTER_CHARACTER_SET, charSet);
|
DDL_TRIGGER_ALTER_CHARACTER_SET, charSet, NULL);
|
||||||
|
|
||||||
AutoCacheRequest requestHandle2(tdbb, drq_l_collation, DYN_REQUESTS);
|
AutoCacheRequest requestHandle2(tdbb, drq_l_collation, DYN_REQUESTS);
|
||||||
|
|
||||||
@ -1133,7 +1140,7 @@ void AlterCharSetNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch
|
|||||||
}
|
}
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER,
|
||||||
DDL_TRIGGER_ALTER_CHARACTER_SET, charSet);
|
DDL_TRIGGER_ALTER_CHARACTER_SET, charSet, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1628,7 +1635,7 @@ void CreateAlterFunctionNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsql
|
|||||||
if (package.isEmpty())
|
if (package.isEmpty())
|
||||||
{
|
{
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER,
|
||||||
(altered ? DDL_TRIGGER_ALTER_FUNCTION : DDL_TRIGGER_CREATE_FUNCTION), name);
|
(altered ? DDL_TRIGGER_ALTER_FUNCTION : DDL_TRIGGER_CREATE_FUNCTION), name, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
savePoint.release(); // everything is ok
|
savePoint.release(); // everything is ok
|
||||||
@ -1650,7 +1657,7 @@ void CreateAlterFunctionNode::executeCreate(thread_db* tdbb, DsqlCompilerScratch
|
|||||||
if (package.isEmpty())
|
if (package.isEmpty())
|
||||||
{
|
{
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_CREATE_FUNCTION, name);
|
DDL_TRIGGER_CREATE_FUNCTION, name, NULL);
|
||||||
|
|
||||||
DYN_UTIL_check_unique_name(tdbb, transaction, name, obj_udf);
|
DYN_UTIL_check_unique_name(tdbb, transaction, name, obj_udf);
|
||||||
}
|
}
|
||||||
@ -1748,7 +1755,7 @@ bool CreateAlterFunctionNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch*
|
|||||||
if (!secondPass && runTriggers && package.isEmpty())
|
if (!secondPass && runTriggers && package.isEmpty())
|
||||||
{
|
{
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_ALTER_FUNCTION, name);
|
DDL_TRIGGER_ALTER_FUNCTION, name, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
MODIFY FUN
|
MODIFY FUN
|
||||||
@ -2246,7 +2253,8 @@ void AlterExternalFunctionNode::execute(thread_db* tdbb, DsqlCompilerScratch* ds
|
|||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_ALTER_FUNCTION, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_ALTER_FUNCTION,
|
||||||
|
name, NULL);
|
||||||
|
|
||||||
if (!FUN.RDB$ENGINE_NAME.NULL || !FUN.RDB$FUNCTION_BLR.NULL)
|
if (!FUN.RDB$ENGINE_NAME.NULL || !FUN.RDB$FUNCTION_BLR.NULL)
|
||||||
status_exception::raise(Arg::Gds(isc_dyn_newfc_oldsyntax) << name);
|
status_exception::raise(Arg::Gds(isc_dyn_newfc_oldsyntax) << name);
|
||||||
@ -2274,7 +2282,10 @@ void AlterExternalFunctionNode::execute(thread_db* tdbb, DsqlCompilerScratch* ds
|
|||||||
END_FOR
|
END_FOR
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_ALTER_FUNCTION, name);
|
{
|
||||||
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_ALTER_FUNCTION,
|
||||||
|
name, NULL);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// msg 41: "Function %s not found"
|
// msg 41: "Function %s not found"
|
||||||
@ -2372,7 +2383,10 @@ void DropFunctionNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (package.isEmpty())
|
if (package.isEmpty())
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_DROP_FUNCTION, name);
|
{
|
||||||
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_DROP_FUNCTION,
|
||||||
|
name, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
ERASE FUN;
|
ERASE FUN;
|
||||||
|
|
||||||
@ -2410,7 +2424,10 @@ void DropFunctionNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (found && package.isEmpty())
|
if (found && package.isEmpty())
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_FUNCTION, name);
|
{
|
||||||
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_FUNCTION,
|
||||||
|
name, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
savePoint.release(); // everything is ok
|
savePoint.release(); // everything is ok
|
||||||
|
|
||||||
@ -2582,7 +2599,7 @@ void CreateAlterProcedureNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsq
|
|||||||
if (package.isEmpty())
|
if (package.isEmpty())
|
||||||
{
|
{
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER,
|
||||||
(altered ? DDL_TRIGGER_ALTER_PROCEDURE : DDL_TRIGGER_CREATE_PROCEDURE), name);
|
(altered ? DDL_TRIGGER_ALTER_PROCEDURE : DDL_TRIGGER_CREATE_PROCEDURE), name, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
savePoint.release(); // everything is ok
|
savePoint.release(); // everything is ok
|
||||||
@ -2604,7 +2621,7 @@ void CreateAlterProcedureNode::executeCreate(thread_db* tdbb, DsqlCompilerScratc
|
|||||||
if (package.isEmpty())
|
if (package.isEmpty())
|
||||||
{
|
{
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_CREATE_PROCEDURE, name);
|
DDL_TRIGGER_CREATE_PROCEDURE, name, NULL);
|
||||||
|
|
||||||
DYN_UTIL_check_unique_name(tdbb, transaction, name, obj_procedure);
|
DYN_UTIL_check_unique_name(tdbb, transaction, name, obj_procedure);
|
||||||
}
|
}
|
||||||
@ -2694,7 +2711,7 @@ bool CreateAlterProcedureNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch
|
|||||||
if (!secondPass && runTriggers && package.isEmpty())
|
if (!secondPass && runTriggers && package.isEmpty())
|
||||||
{
|
{
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_ALTER_PROCEDURE, name);
|
DDL_TRIGGER_ALTER_PROCEDURE, name, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
MODIFY P
|
MODIFY P
|
||||||
@ -3134,7 +3151,7 @@ void DropProcedureNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratc
|
|||||||
if (package.isEmpty())
|
if (package.isEmpty())
|
||||||
{
|
{
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_DROP_PROCEDURE, name);
|
DDL_TRIGGER_DROP_PROCEDURE, name, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
ERASE PRC;
|
ERASE PRC;
|
||||||
@ -3173,7 +3190,10 @@ void DropProcedureNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratc
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (found && package.isEmpty())
|
if (found && package.isEmpty())
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_PROCEDURE, name);
|
{
|
||||||
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_PROCEDURE,
|
||||||
|
name, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
savePoint.release(); // everything is ok
|
savePoint.release(); // everything is ok
|
||||||
|
|
||||||
@ -3435,9 +3455,13 @@ void CreateAlterTriggerNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlS
|
|||||||
void CreateAlterTriggerNode::executeCreate(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
void CreateAlterTriggerNode::executeCreate(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
||||||
jrd_tra* transaction)
|
jrd_tra* transaction)
|
||||||
{
|
{
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_CREATE_TRIGGER, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_CREATE_TRIGGER,
|
||||||
|
name, NULL);
|
||||||
|
|
||||||
store(tdbb, dsqlScratch, transaction);
|
store(tdbb, dsqlScratch, transaction);
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_CREATE_TRIGGER, name);
|
|
||||||
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_CREATE_TRIGGER,
|
||||||
|
name, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CreateAlterTriggerNode::compile(thread_db* /*tdbb*/, DsqlCompilerScratch* dsqlScratch)
|
void CreateAlterTriggerNode::compile(thread_db* /*tdbb*/, DsqlCompilerScratch* dsqlScratch)
|
||||||
@ -3604,7 +3628,8 @@ void DropTriggerNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_DROP_TRIGGER, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_DROP_TRIGGER,
|
||||||
|
name, NULL);
|
||||||
|
|
||||||
relationName = X.RDB$RELATION_NAME;
|
relationName = X.RDB$RELATION_NAME;
|
||||||
ERASE X;
|
ERASE X;
|
||||||
@ -3670,7 +3695,10 @@ void DropTriggerNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_TRIGGER, name);
|
{
|
||||||
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_TRIGGER,
|
||||||
|
name, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
savePoint.release(); // everything is ok
|
savePoint.release(); // everything is ok
|
||||||
}
|
}
|
||||||
@ -3712,7 +3740,7 @@ void CreateCollationNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScra
|
|||||||
AutoSavePoint savePoint(tdbb, transaction);
|
AutoSavePoint savePoint(tdbb, transaction);
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_CREATE_COLLATION, name);
|
DDL_TRIGGER_CREATE_COLLATION, name, NULL);
|
||||||
|
|
||||||
AutoCacheRequest request(tdbb, drq_s_colls, DYN_REQUESTS);
|
AutoCacheRequest request(tdbb, drq_s_colls, DYN_REQUESTS);
|
||||||
|
|
||||||
@ -3861,7 +3889,7 @@ void CreateCollationNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScra
|
|||||||
storePrivileges(tdbb, transaction, name, obj_collation, USAGE_PRIVILEGES);
|
storePrivileges(tdbb, transaction, name, obj_collation, USAGE_PRIVILEGES);
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER,
|
||||||
DDL_TRIGGER_CREATE_COLLATION, name);
|
DDL_TRIGGER_CREATE_COLLATION, name, NULL);
|
||||||
|
|
||||||
savePoint.release(); // everything is ok
|
savePoint.release(); // everything is ok
|
||||||
|
|
||||||
@ -3937,7 +3965,7 @@ void DropCollationNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratc
|
|||||||
CS.RDB$CHARACTER_SET_ID EQ COLL.RDB$CHARACTER_SET_ID
|
CS.RDB$CHARACTER_SET_ID EQ COLL.RDB$CHARACTER_SET_ID
|
||||||
{
|
{
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_DROP_COLLATION, name);
|
DDL_TRIGGER_DROP_COLLATION, name, NULL);
|
||||||
|
|
||||||
if (COLL.RDB$SYSTEM_FLAG)
|
if (COLL.RDB$SYSTEM_FLAG)
|
||||||
status_exception::raise(Arg::Gds(isc_dyn_cannot_del_syscoll));
|
status_exception::raise(Arg::Gds(isc_dyn_cannot_del_syscoll));
|
||||||
@ -4045,7 +4073,10 @@ void DropCollationNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratc
|
|||||||
END_FOR
|
END_FOR
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_COLLATION, name);
|
{
|
||||||
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_COLLATION,
|
||||||
|
name, NULL);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
status_exception::raise(Arg::Gds(isc_dyn_collation_not_found) << Arg::Str(name));
|
status_exception::raise(Arg::Gds(isc_dyn_collation_not_found) << Arg::Str(name));
|
||||||
|
|
||||||
@ -4111,7 +4142,7 @@ void CreateDomainNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch
|
|||||||
AutoSavePoint savePoint(tdbb, transaction);
|
AutoSavePoint savePoint(tdbb, transaction);
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_CREATE_DOMAIN, nameType->name);
|
DDL_TRIGGER_CREATE_DOMAIN, nameType->name, NULL);
|
||||||
|
|
||||||
storeGlobalField(tdbb, transaction, nameType->name, type);
|
storeGlobalField(tdbb, transaction, nameType->name, type);
|
||||||
|
|
||||||
@ -4183,7 +4214,7 @@ void CreateDomainNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch
|
|||||||
}
|
}
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER,
|
||||||
DDL_TRIGGER_CREATE_DOMAIN, nameType->name);
|
DDL_TRIGGER_CREATE_DOMAIN, nameType->name, NULL);
|
||||||
|
|
||||||
savePoint.release(); // everything is ok
|
savePoint.release(); // everything is ok
|
||||||
}
|
}
|
||||||
@ -4655,7 +4686,7 @@ void AlterDomainNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
|||||||
found = true;
|
found = true;
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_ALTER_DOMAIN, name);
|
DDL_TRIGGER_ALTER_DOMAIN, name, renameTo);
|
||||||
|
|
||||||
if (FLD.RDB$SYSTEM_FLAG == fb_sysflag_system)
|
if (FLD.RDB$SYSTEM_FLAG == fb_sysflag_system)
|
||||||
{
|
{
|
||||||
@ -4905,7 +4936,9 @@ void AlterDomainNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
|||||||
status_exception::raise(Arg::PrivateDyn(89));
|
status_exception::raise(Arg::PrivateDyn(89));
|
||||||
}
|
}
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_ALTER_DOMAIN, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_ALTER_DOMAIN,
|
||||||
|
(renameTo.hasData() ? renameTo : name),
|
||||||
|
(renameTo.hasData() ? name : NULL));
|
||||||
|
|
||||||
savePoint.release(); // everything is ok
|
savePoint.release(); // everything is ok
|
||||||
}
|
}
|
||||||
@ -5007,7 +5040,7 @@ void DropDomainNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
|||||||
WITH X.RDB$FIELD_NAME EQ name.c_str()
|
WITH X.RDB$FIELD_NAME EQ name.c_str()
|
||||||
{
|
{
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_DROP_DOMAIN, name);
|
DDL_TRIGGER_DROP_DOMAIN, name, NULL);
|
||||||
|
|
||||||
check(tdbb, transaction);
|
check(tdbb, transaction);
|
||||||
deleteDimensionRecords(tdbb, transaction, name);
|
deleteDimensionRecords(tdbb, transaction, name);
|
||||||
@ -5033,7 +5066,10 @@ void DropDomainNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
|||||||
END_FOR
|
END_FOR
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_DOMAIN, name);
|
{
|
||||||
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_DOMAIN,
|
||||||
|
name, NULL);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// msg 89: "Domain not found"
|
// msg 89: "Domain not found"
|
||||||
@ -5162,7 +5198,7 @@ void CreateAlterExceptionNode::executeCreate(thread_db* tdbb, DsqlCompilerScratc
|
|||||||
const string& userName = attachment->att_user->usr_user_name;
|
const string& userName = attachment->att_user->usr_user_name;
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_CREATE_EXCEPTION, name);
|
DDL_TRIGGER_CREATE_EXCEPTION, name, NULL);
|
||||||
|
|
||||||
DYN_UTIL_check_unique_name(tdbb, transaction, name, obj_exception);
|
DYN_UTIL_check_unique_name(tdbb, transaction, name, obj_exception);
|
||||||
|
|
||||||
@ -5209,7 +5245,8 @@ void CreateAlterExceptionNode::executeCreate(thread_db* tdbb, DsqlCompilerScratc
|
|||||||
|
|
||||||
storePrivileges(tdbb, transaction, name, obj_exception, USAGE_PRIVILEGES);
|
storePrivileges(tdbb, transaction, name, obj_exception, USAGE_PRIVILEGES);
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_CREATE_EXCEPTION, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_CREATE_EXCEPTION,
|
||||||
|
name, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CreateAlterExceptionNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
bool CreateAlterExceptionNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
||||||
@ -5223,7 +5260,7 @@ bool CreateAlterExceptionNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch
|
|||||||
WITH X.RDB$EXCEPTION_NAME EQ name.c_str()
|
WITH X.RDB$EXCEPTION_NAME EQ name.c_str()
|
||||||
{
|
{
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_ALTER_EXCEPTION, name);
|
DDL_TRIGGER_ALTER_EXCEPTION, name, NULL);
|
||||||
|
|
||||||
MODIFY X
|
MODIFY X
|
||||||
strcpy(X.RDB$MESSAGE, message.c_str());
|
strcpy(X.RDB$MESSAGE, message.c_str());
|
||||||
@ -5234,7 +5271,10 @@ bool CreateAlterExceptionNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch
|
|||||||
END_FOR
|
END_FOR
|
||||||
|
|
||||||
if (modified)
|
if (modified)
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_ALTER_EXCEPTION, name);
|
{
|
||||||
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_ALTER_EXCEPTION,
|
||||||
|
name, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
return modified;
|
return modified;
|
||||||
}
|
}
|
||||||
@ -5273,7 +5313,7 @@ void DropExceptionNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratc
|
|||||||
WITH X.RDB$EXCEPTION_NAME EQ name.c_str()
|
WITH X.RDB$EXCEPTION_NAME EQ name.c_str()
|
||||||
{
|
{
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_DROP_EXCEPTION, name);
|
DDL_TRIGGER_DROP_EXCEPTION, name, NULL);
|
||||||
ERASE X;
|
ERASE X;
|
||||||
|
|
||||||
if (!X.RDB$SECURITY_CLASS.NULL)
|
if (!X.RDB$SECURITY_CLASS.NULL)
|
||||||
@ -5295,7 +5335,10 @@ void DropExceptionNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratc
|
|||||||
END_FOR
|
END_FOR
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_EXCEPTION, name);
|
{
|
||||||
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_EXCEPTION,
|
||||||
|
name, NULL);
|
||||||
|
}
|
||||||
else if (!silent)
|
else if (!silent)
|
||||||
{
|
{
|
||||||
// msg 144: "Exception not found"
|
// msg 144: "Exception not found"
|
||||||
@ -5389,7 +5432,8 @@ void CreateAlterSequenceNode::putErrorPrefix(Firebird::Arg::StatusVector& status
|
|||||||
void CreateAlterSequenceNode::executeCreate(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
void CreateAlterSequenceNode::executeCreate(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
||||||
jrd_tra* transaction)
|
jrd_tra* transaction)
|
||||||
{
|
{
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_CREATE_SEQUENCE, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_CREATE_SEQUENCE,
|
||||||
|
name, NULL);
|
||||||
|
|
||||||
const SINT64 val = value.specified ? value.value : 0;
|
const SINT64 val = value.specified ? value.value : 0;
|
||||||
SLONG initialStep = 1;
|
SLONG initialStep = 1;
|
||||||
@ -5401,7 +5445,8 @@ void CreateAlterSequenceNode::executeCreate(thread_db* tdbb, DsqlCompilerScratch
|
|||||||
}
|
}
|
||||||
store(tdbb, transaction, name, fb_sysflag_user, val, initialStep);
|
store(tdbb, transaction, name, fb_sysflag_user, val, initialStep);
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_CREATE_SEQUENCE, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_CREATE_SEQUENCE,
|
||||||
|
name, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CreateAlterSequenceNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
bool CreateAlterSequenceNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
||||||
@ -5425,7 +5470,8 @@ bool CreateAlterSequenceNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch*
|
|||||||
if (forbidden && !tdbb->getAttachment()->isRWGbak())
|
if (forbidden && !tdbb->getAttachment()->isRWGbak())
|
||||||
status_exception::raise(Arg::Gds(isc_dyn_cant_modify_sysobj) << "generator" << Arg::Str(name));
|
status_exception::raise(Arg::Gds(isc_dyn_cant_modify_sysobj) << "generator" << Arg::Str(name));
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_ALTER_SEQUENCE, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_ALTER_SEQUENCE,
|
||||||
|
name, NULL);
|
||||||
|
|
||||||
fb_assert(restartSpecified && value.specified);
|
fb_assert(restartSpecified && value.specified);
|
||||||
const SINT64 val = value.specified ? value.value : 0;
|
const SINT64 val = value.specified ? value.value : 0;
|
||||||
@ -5445,7 +5491,8 @@ bool CreateAlterSequenceNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch*
|
|||||||
desc.makeText((USHORT) name.length(), ttype_metadata, (UCHAR*) name.c_str());
|
desc.makeText((USHORT) name.length(), ttype_metadata, (UCHAR*) name.c_str());
|
||||||
DFW_post_work(transaction, dfw_set_generator, &desc, id);
|
DFW_post_work(transaction, dfw_set_generator, &desc, id);
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_ALTER_SEQUENCE, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_ALTER_SEQUENCE,
|
||||||
|
name, NULL);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -5458,7 +5505,8 @@ bool CreateAlterSequenceNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch*
|
|||||||
X IN RDB$GENERATORS
|
X IN RDB$GENERATORS
|
||||||
WITH X.RDB$GENERATOR_NAME EQ name.c_str()
|
WITH X.RDB$GENERATOR_NAME EQ name.c_str()
|
||||||
{
|
{
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_ALTER_SEQUENCE, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_ALTER_SEQUENCE,
|
||||||
|
name, NULL);
|
||||||
|
|
||||||
if (X.RDB$SYSTEM_FLAG == fb_sysflag_system)
|
if (X.RDB$SYSTEM_FLAG == fb_sysflag_system)
|
||||||
{
|
{
|
||||||
@ -5493,7 +5541,8 @@ bool CreateAlterSequenceNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch*
|
|||||||
desc.makeText((USHORT) name.length(), ttype_metadata, (UCHAR*) name.c_str());
|
desc.makeText((USHORT) name.length(), ttype_metadata, (UCHAR*) name.c_str());
|
||||||
DFW_post_work(transaction, dfw_set_generator, &desc, id);
|
DFW_post_work(transaction, dfw_set_generator, &desc, id);
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_ALTER_SEQUENCE, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_ALTER_SEQUENCE,
|
||||||
|
name, NULL);
|
||||||
|
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
@ -5607,7 +5656,7 @@ void DropSequenceNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch
|
|||||||
}
|
}
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_DROP_SEQUENCE, name);
|
DDL_TRIGGER_DROP_SEQUENCE, name, NULL);
|
||||||
|
|
||||||
ERASE GEN;
|
ERASE GEN;
|
||||||
|
|
||||||
@ -5630,7 +5679,10 @@ void DropSequenceNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch
|
|||||||
END_FOR
|
END_FOR
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_SEQUENCE, name);
|
{
|
||||||
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_SEQUENCE,
|
||||||
|
name, NULL);
|
||||||
|
}
|
||||||
else if (!silent)
|
else if (!silent)
|
||||||
status_exception::raise(Arg::Gds(isc_gennotdef) << Arg::Str(name));
|
status_exception::raise(Arg::Gds(isc_gennotdef) << Arg::Str(name));
|
||||||
|
|
||||||
@ -7046,7 +7098,8 @@ void CreateRelationNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScrat
|
|||||||
// run all statements under savepoint control
|
// run all statements under savepoint control
|
||||||
AutoSavePoint savePoint(tdbb, transaction);
|
AutoSavePoint savePoint(tdbb, transaction);
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_CREATE_TABLE, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_CREATE_TABLE,
|
||||||
|
name, NULL);
|
||||||
|
|
||||||
DYN_UTIL_check_unique_name(tdbb, transaction, name, obj_relation);
|
DYN_UTIL_check_unique_name(tdbb, transaction, name, obj_relation);
|
||||||
|
|
||||||
@ -7117,7 +7170,8 @@ void CreateRelationNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScrat
|
|||||||
|
|
||||||
dsqlScratch->relation->rel_flags &= ~REL_creating;
|
dsqlScratch->relation->rel_flags &= ~REL_creating;
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_CREATE_TABLE, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_CREATE_TABLE,
|
||||||
|
name, NULL);
|
||||||
|
|
||||||
savePoint.release(); // everything is ok
|
savePoint.release(); // everything is ok
|
||||||
|
|
||||||
@ -7200,7 +7254,8 @@ void AlterRelationNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratc
|
|||||||
// run all statements under savepoint control
|
// run all statements under savepoint control
|
||||||
AutoSavePoint savePoint(tdbb, transaction);
|
AutoSavePoint savePoint(tdbb, transaction);
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_ALTER_TABLE, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_ALTER_TABLE,
|
||||||
|
name, NULL);
|
||||||
|
|
||||||
ObjectsArray<Constraint> constraints;
|
ObjectsArray<Constraint> constraints;
|
||||||
|
|
||||||
@ -7410,7 +7465,8 @@ void AlterRelationNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratc
|
|||||||
defineConstraint(tdbb, dsqlScratch, transaction, *constraint);
|
defineConstraint(tdbb, dsqlScratch, transaction, *constraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_ALTER_TABLE, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_ALTER_TABLE,
|
||||||
|
name, NULL);
|
||||||
|
|
||||||
savePoint.release(); // everything is ok
|
savePoint.release(); // everything is ok
|
||||||
|
|
||||||
@ -7916,7 +7972,7 @@ void DropRelationNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch
|
|||||||
R IN RDB$RELATIONS
|
R IN RDB$RELATIONS
|
||||||
WITH R.RDB$RELATION_NAME EQ name.c_str()
|
WITH R.RDB$RELATION_NAME EQ name.c_str()
|
||||||
{
|
{
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, ddlTriggerAction, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, ddlTriggerAction, name, NULL);
|
||||||
found = true;
|
found = true;
|
||||||
}
|
}
|
||||||
END_FOR
|
END_FOR
|
||||||
@ -8073,7 +8129,7 @@ void DropRelationNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch
|
|||||||
END_FOR
|
END_FOR
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, ddlTriggerAction, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, ddlTriggerAction, name, NULL);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// msg 61: "Relation not found"
|
// msg 61: "Relation not found"
|
||||||
@ -8144,7 +8200,7 @@ void CreateAlterViewNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScra
|
|||||||
|
|
||||||
const int ddlTriggerAction = (modifyingView ? DDL_TRIGGER_ALTER_VIEW : DDL_TRIGGER_CREATE_VIEW);
|
const int ddlTriggerAction = (modifyingView ? DDL_TRIGGER_ALTER_VIEW : DDL_TRIGGER_CREATE_VIEW);
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, ddlTriggerAction, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, ddlTriggerAction, name, NULL);
|
||||||
|
|
||||||
if (!modifyingView)
|
if (!modifyingView)
|
||||||
DYN_UTIL_check_unique_name(tdbb, transaction, name, obj_relation);
|
DYN_UTIL_check_unique_name(tdbb, transaction, name, obj_relation);
|
||||||
@ -8670,7 +8726,7 @@ void CreateAlterViewNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScra
|
|||||||
|
|
||||||
dsqlScratch->resetContextStack();
|
dsqlScratch->resetContextStack();
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, ddlTriggerAction, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, ddlTriggerAction, name, NULL);
|
||||||
|
|
||||||
savePoint.release(); // everything is ok
|
savePoint.release(); // everything is ok
|
||||||
|
|
||||||
@ -9266,7 +9322,8 @@ void CreateIndexNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
|||||||
// run all statements under savepoint control
|
// run all statements under savepoint control
|
||||||
AutoSavePoint savePoint(tdbb, transaction);
|
AutoSavePoint savePoint(tdbb, transaction);
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_CREATE_INDEX, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_CREATE_INDEX,
|
||||||
|
name, NULL);
|
||||||
|
|
||||||
CreateIndexNode::Definition definition;
|
CreateIndexNode::Definition definition;
|
||||||
definition.type = isc_dyn_def_idx;
|
definition.type = isc_dyn_def_idx;
|
||||||
@ -9299,7 +9356,8 @@ void CreateIndexNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
|||||||
|
|
||||||
store(tdbb, transaction, name, definition);
|
store(tdbb, transaction, name, definition);
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_CREATE_INDEX, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_CREATE_INDEX,
|
||||||
|
name, NULL);
|
||||||
|
|
||||||
savePoint.release(); // everything is ok
|
savePoint.release(); // everything is ok
|
||||||
}
|
}
|
||||||
@ -9343,7 +9401,8 @@ void AlterIndexNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
|||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_ALTER_INDEX, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_ALTER_INDEX,
|
||||||
|
name, NULL);
|
||||||
|
|
||||||
MODIFY IDX
|
MODIFY IDX
|
||||||
IDX.RDB$INDEX_INACTIVE.NULL = FALSE;
|
IDX.RDB$INDEX_INACTIVE.NULL = FALSE;
|
||||||
@ -9353,7 +9412,10 @@ void AlterIndexNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
|||||||
END_FOR
|
END_FOR
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_ALTER_INDEX, name);
|
{
|
||||||
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_ALTER_INDEX,
|
||||||
|
name, NULL);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// msg 48: "Index not found"
|
// msg 48: "Index not found"
|
||||||
@ -9401,7 +9463,8 @@ void SetStatisticsNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratc
|
|||||||
{
|
{
|
||||||
found = true;
|
found = true;
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_ALTER_INDEX, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_ALTER_INDEX,
|
||||||
|
name, NULL);
|
||||||
|
|
||||||
MODIFY IDX
|
MODIFY IDX
|
||||||
// For V4 index selectivity can be set only to -1.
|
// For V4 index selectivity can be set only to -1.
|
||||||
@ -9412,7 +9475,10 @@ void SetStatisticsNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratc
|
|||||||
END_FOR
|
END_FOR
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_ALTER_INDEX, name);
|
{
|
||||||
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_ALTER_INDEX,
|
||||||
|
name, NULL);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// msg 48: "Index not found"
|
// msg 48: "Index not found"
|
||||||
@ -9477,7 +9543,7 @@ void DropIndexNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, j
|
|||||||
WITH IDX.RDB$INDEX_NAME EQ name.c_str()
|
WITH IDX.RDB$INDEX_NAME EQ name.c_str()
|
||||||
{
|
{
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_DROP_INDEX, name);
|
DDL_TRIGGER_DROP_INDEX, name, NULL);
|
||||||
|
|
||||||
ERASE IDX;
|
ERASE IDX;
|
||||||
|
|
||||||
@ -9492,7 +9558,10 @@ void DropIndexNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, j
|
|||||||
END_FOR
|
END_FOR
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_INDEX, name);
|
{
|
||||||
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_INDEX,
|
||||||
|
name, NULL);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// msg 48: "Index not found"
|
// msg 48: "Index not found"
|
||||||
@ -9533,7 +9602,10 @@ void CreateFilterNode::execute(thread_db* tdbb, DsqlCompilerScratch* /*dsqlScrat
|
|||||||
// run all statements under savepoint control
|
// run all statements under savepoint control
|
||||||
AutoSavePoint savePoint(tdbb, transaction);
|
AutoSavePoint savePoint(tdbb, transaction);
|
||||||
|
|
||||||
///executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_DECLARE_FILTER, name);
|
/***
|
||||||
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_DECLARE_FILTER,
|
||||||
|
name, NULL);
|
||||||
|
***/
|
||||||
|
|
||||||
AutoCacheRequest request(tdbb, drq_s_filters, DYN_REQUESTS);
|
AutoCacheRequest request(tdbb, drq_s_filters, DYN_REQUESTS);
|
||||||
|
|
||||||
@ -9576,7 +9648,10 @@ void CreateFilterNode::execute(thread_db* tdbb, DsqlCompilerScratch* /*dsqlScrat
|
|||||||
}
|
}
|
||||||
END_STORE
|
END_STORE
|
||||||
|
|
||||||
///executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DECLARE_FILTER, name);
|
/***
|
||||||
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DECLARE_FILTER,
|
||||||
|
name, NULL);
|
||||||
|
***/
|
||||||
|
|
||||||
savePoint.release(); // everything is ok
|
savePoint.release(); // everything is ok
|
||||||
}
|
}
|
||||||
@ -9765,7 +9840,7 @@ void CreateRoleNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
|||||||
AutoSavePoint savePoint(tdbb, transaction);
|
AutoSavePoint savePoint(tdbb, transaction);
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_CREATE_ROLE, name);
|
DDL_TRIGGER_CREATE_ROLE, name, NULL);
|
||||||
|
|
||||||
if (name == ownerName)
|
if (name == ownerName)
|
||||||
{
|
{
|
||||||
@ -9804,7 +9879,7 @@ void CreateRoleNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
|||||||
END_STORE
|
END_STORE
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER,
|
||||||
DDL_TRIGGER_CREATE_ROLE, name);
|
DDL_TRIGGER_CREATE_ROLE, name, NULL);
|
||||||
|
|
||||||
savePoint.release(); // everything is ok
|
savePoint.release(); // everything is ok
|
||||||
}
|
}
|
||||||
@ -10136,7 +10211,8 @@ void MappingNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd
|
|||||||
case MAP_MOD:
|
case MAP_MOD:
|
||||||
case MAP_RPL:
|
case MAP_RPL:
|
||||||
ddlTriggerAction = DDL_TRIGGER_ALTER_MAPPING;
|
ddlTriggerAction = DDL_TRIGGER_ALTER_MAPPING;
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, ddlTriggerAction, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, ddlTriggerAction,
|
||||||
|
name, NULL);
|
||||||
|
|
||||||
MODIFY M
|
MODIFY M
|
||||||
if (to)
|
if (to)
|
||||||
@ -10166,7 +10242,8 @@ void MappingNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd
|
|||||||
|
|
||||||
case MAP_DROP:
|
case MAP_DROP:
|
||||||
ddlTriggerAction = DDL_TRIGGER_DROP_MAPPING;
|
ddlTriggerAction = DDL_TRIGGER_DROP_MAPPING;
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, ddlTriggerAction, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, ddlTriggerAction,
|
||||||
|
name, NULL);
|
||||||
|
|
||||||
ERASE M;
|
ERASE M;
|
||||||
break;
|
break;
|
||||||
@ -10189,7 +10266,7 @@ void MappingNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
ddlTriggerAction = DDL_TRIGGER_CREATE_MAPPING;
|
ddlTriggerAction = DDL_TRIGGER_CREATE_MAPPING;
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, ddlTriggerAction, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, ddlTriggerAction, name, NULL);
|
||||||
|
|
||||||
STORE(REQUEST_HANDLE request2 TRANSACTION_HANDLE transaction)
|
STORE(REQUEST_HANDLE request2 TRANSACTION_HANDLE transaction)
|
||||||
M IN RDB$AUTH_MAPPING
|
M IN RDB$AUTH_MAPPING
|
||||||
@ -10233,7 +10310,7 @@ void MappingNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd
|
|||||||
|
|
||||||
fb_assert(ddlTriggerAction > 0);
|
fb_assert(ddlTriggerAction > 0);
|
||||||
if (ddlTriggerAction > 0)
|
if (ddlTriggerAction > 0)
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, ddlTriggerAction, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, ddlTriggerAction, name, NULL);
|
||||||
|
|
||||||
DFW_post_work(transaction, dfw_clear_mapping, NULL, 0);
|
DFW_post_work(transaction, dfw_clear_mapping, NULL, 0);
|
||||||
savePoint.release(); // everything is ok
|
savePoint.release(); // everything is ok
|
||||||
@ -10273,9 +10350,7 @@ void DropRoleNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jr
|
|||||||
WITH ROL.RDB$ROLE_NAME EQ name.c_str()
|
WITH ROL.RDB$ROLE_NAME EQ name.c_str()
|
||||||
{
|
{
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_DROP_ROLE, name);
|
DDL_TRIGGER_DROP_ROLE, name, NULL);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (ROL.RDB$SYSTEM_FLAG != 0)
|
if (ROL.RDB$SYSTEM_FLAG != 0)
|
||||||
{
|
{
|
||||||
@ -10283,7 +10358,6 @@ void DropRoleNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jr
|
|||||||
status_exception::raise(Arg::PrivateDyn(284) << name);
|
status_exception::raise(Arg::PrivateDyn(284) << name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AutoCacheRequest request2(tdbb, drq_del_role_1, DYN_REQUESTS);
|
AutoCacheRequest request2(tdbb, drq_del_role_1, DYN_REQUESTS);
|
||||||
|
|
||||||
// The first OR clause finds all members of the role.
|
// The first OR clause finds all members of the role.
|
||||||
@ -10314,7 +10388,10 @@ void DropRoleNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jr
|
|||||||
END_FOR
|
END_FOR
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_ROLE, name);
|
{
|
||||||
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_ROLE,
|
||||||
|
name, NULL);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// msg 155: "Role %s not found"
|
// msg 155: "Role %s not found"
|
||||||
@ -10481,12 +10558,14 @@ void CreateAlterUserNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScra
|
|||||||
|
|
||||||
const int ddlAction = mode == USER_ADD ? DDL_TRIGGER_CREATE_USER : DDL_TRIGGER_ALTER_USER;
|
const int ddlAction = mode == USER_ADD ? DDL_TRIGGER_CREATE_USER : DDL_TRIGGER_ALTER_USER;
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, ddlAction, userData->user.get());
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, ddlAction,
|
||||||
|
userData->user.get(), NULL);
|
||||||
|
|
||||||
const USHORT id = transaction->getUserManagement()->put(userData);
|
const USHORT id = transaction->getUserManagement()->put(userData);
|
||||||
DFW_post_work(transaction, dfw_user_management, NULL, id);
|
DFW_post_work(transaction, dfw_user_management, NULL, id);
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, ddlAction, userData->user.get());
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, ddlAction,
|
||||||
|
userData->user.get(), NULL);
|
||||||
|
|
||||||
savePoint.release(); // everything is ok
|
savePoint.release(); // everything is ok
|
||||||
}
|
}
|
||||||
@ -10530,13 +10609,13 @@ void DropUserNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jr
|
|||||||
check(&statusWrapper);
|
check(&statusWrapper);
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_DROP_USER,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE, DDL_TRIGGER_DROP_USER,
|
||||||
userData->user.get());
|
userData->user.get(), NULL);
|
||||||
|
|
||||||
const USHORT id = transaction->getUserManagement()->put(userData);
|
const USHORT id = transaction->getUserManagement()->put(userData);
|
||||||
DFW_post_work(transaction, dfw_user_management, NULL, id);
|
DFW_post_work(transaction, dfw_user_management, NULL, id);
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_USER,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_USER,
|
||||||
userData->user.get());
|
userData->user.get(), NULL);
|
||||||
|
|
||||||
savePoint.release(); // everything is ok
|
savePoint.release(); // everything is ok
|
||||||
}
|
}
|
||||||
|
@ -641,7 +641,7 @@ protected:
|
|||||||
if (alter)
|
if (alter)
|
||||||
{
|
{
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_ALTER_TRIGGER, name);
|
DDL_TRIGGER_ALTER_TRIGGER, name, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -650,7 +650,7 @@ protected:
|
|||||||
if (alter)
|
if (alter)
|
||||||
{
|
{
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER,
|
||||||
DDL_TRIGGER_ALTER_TRIGGER, name);
|
DDL_TRIGGER_ALTER_TRIGGER, name, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ public:
|
|||||||
|
|
||||||
static void executeDdlTrigger(thread_db* tdbb, jrd_tra* transaction,
|
static void executeDdlTrigger(thread_db* tdbb, jrd_tra* transaction,
|
||||||
DdlTriggerWhen when, int action, const Firebird::MetaName& objectName,
|
DdlTriggerWhen when, int action, const Firebird::MetaName& objectName,
|
||||||
const Firebird::string& sqlText);
|
const Firebird::MetaName& oldNewObjectName, const Firebird::string& sqlText);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef Firebird::Pair<Firebird::Left<Firebird::MetaName, bid> > MetaNameBidPair;
|
typedef Firebird::Pair<Firebird::Left<Firebird::MetaName, bid> > MetaNameBidPair;
|
||||||
@ -250,7 +250,8 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void executeDdlTrigger(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd_tra* transaction,
|
void executeDdlTrigger(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch, jrd_tra* transaction,
|
||||||
DdlTriggerWhen when, int action, const Firebird::MetaName& objectName);
|
DdlTriggerWhen when, int action, const Firebird::MetaName& objectName,
|
||||||
|
const Firebird::MetaName& oldNewObjectName);
|
||||||
void storeGlobalField(thread_db* tdbb, jrd_tra* transaction, Firebird::MetaName& name,
|
void storeGlobalField(thread_db* tdbb, jrd_tra* transaction, Firebird::MetaName& name,
|
||||||
const TypeClause* field,
|
const TypeClause* field,
|
||||||
const Firebird::string& computedSource = "",
|
const Firebird::string& computedSource = "",
|
||||||
|
@ -494,7 +494,7 @@ void CreateAlterPackageNode::executeCreate(thread_db* tdbb, DsqlCompilerScratch*
|
|||||||
const string& userName = attachment->att_user->usr_user_name;
|
const string& userName = attachment->att_user->usr_user_name;
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_CREATE_PACKAGE, name);
|
DDL_TRIGGER_CREATE_PACKAGE, name, NULL);
|
||||||
|
|
||||||
AutoCacheRequest requestHandle(tdbb, drq_s_pkg, DYN_REQUESTS);
|
AutoCacheRequest requestHandle(tdbb, drq_s_pkg, DYN_REQUESTS);
|
||||||
|
|
||||||
@ -521,7 +521,8 @@ void CreateAlterPackageNode::executeCreate(thread_db* tdbb, DsqlCompilerScratch*
|
|||||||
|
|
||||||
executeItems(tdbb, dsqlScratch, transaction);
|
executeItems(tdbb, dsqlScratch, transaction);
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_CREATE_PACKAGE, name);
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_CREATE_PACKAGE,
|
||||||
|
name, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -539,7 +540,7 @@ bool CreateAlterPackageNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch*
|
|||||||
modified = true;
|
modified = true;
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_ALTER_PACKAGE, name);
|
DDL_TRIGGER_ALTER_PACKAGE, name, NULL);
|
||||||
|
|
||||||
SortedObjectsArray<Signature> existingFuncs(getPool());
|
SortedObjectsArray<Signature> existingFuncs(getPool());
|
||||||
SortedObjectsArray<Signature> existingProcs(getPool());
|
SortedObjectsArray<Signature> existingProcs(getPool());
|
||||||
@ -592,7 +593,7 @@ bool CreateAlterPackageNode::executeAlter(thread_db* tdbb, DsqlCompilerScratch*
|
|||||||
executeItems(tdbb, dsqlScratch, transaction);
|
executeItems(tdbb, dsqlScratch, transaction);
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction,
|
||||||
DTW_AFTER, DDL_TRIGGER_ALTER_PACKAGE, name);
|
DTW_AFTER, DDL_TRIGGER_ALTER_PACKAGE, name, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
return modified;
|
return modified;
|
||||||
@ -659,7 +660,7 @@ void DropPackageNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
|||||||
found = true;
|
found = true;
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_DROP_PACKAGE, name);
|
DDL_TRIGGER_DROP_PACKAGE, name, NULL);
|
||||||
|
|
||||||
ERASE PKG;
|
ERASE PKG;
|
||||||
|
|
||||||
@ -715,7 +716,10 @@ void DropPackageNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
|||||||
END_FOR
|
END_FOR
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_PACKAGE, name);
|
{
|
||||||
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER, DDL_TRIGGER_DROP_PACKAGE,
|
||||||
|
name, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
savePoint.release(); // everything is ok
|
savePoint.release(); // everything is ok
|
||||||
}
|
}
|
||||||
@ -852,7 +856,7 @@ void CreatePackageBodyNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlSc
|
|||||||
}
|
}
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_CREATE_PACKAGE_BODY, name);
|
DDL_TRIGGER_CREATE_PACKAGE_BODY, name, NULL);
|
||||||
|
|
||||||
MODIFY PKG
|
MODIFY PKG
|
||||||
PKG.RDB$VALID_BODY_FLAG.NULL = FALSE;
|
PKG.RDB$VALID_BODY_FLAG.NULL = FALSE;
|
||||||
@ -1039,7 +1043,7 @@ void CreatePackageBodyNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlSc
|
|||||||
END_FOR
|
END_FOR
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER,
|
||||||
DDL_TRIGGER_CREATE_PACKAGE_BODY, name);
|
DDL_TRIGGER_CREATE_PACKAGE_BODY, name, NULL);
|
||||||
|
|
||||||
savePoint.release(); // everything is ok
|
savePoint.release(); // everything is ok
|
||||||
}
|
}
|
||||||
@ -1084,7 +1088,7 @@ void DropPackageBodyNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScra
|
|||||||
found = true;
|
found = true;
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_BEFORE,
|
||||||
DDL_TRIGGER_DROP_PACKAGE_BODY, name);
|
DDL_TRIGGER_DROP_PACKAGE_BODY, name, NULL);
|
||||||
|
|
||||||
MODIFY PKG
|
MODIFY PKG
|
||||||
PKG.RDB$VALID_BODY_FLAG.NULL = TRUE;
|
PKG.RDB$VALID_BODY_FLAG.NULL = TRUE;
|
||||||
@ -1159,7 +1163,7 @@ void DropPackageBodyNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScra
|
|||||||
END_FOR
|
END_FOR
|
||||||
|
|
||||||
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER,
|
executeDdlTrigger(tdbb, dsqlScratch, transaction, DTW_AFTER,
|
||||||
DDL_TRIGGER_DROP_PACKAGE_BODY, name);
|
DDL_TRIGGER_DROP_PACKAGE_BODY, name, NULL);
|
||||||
|
|
||||||
savePoint.release(); // everything is ok
|
savePoint.release(); // everything is ok
|
||||||
}
|
}
|
||||||
|
@ -7534,13 +7534,13 @@ const StmtNode* SetGeneratorNode::execute(thread_db* tdbb, jrd_req* request, Exe
|
|||||||
jrd_tra* const transaction = request->req_transaction;
|
jrd_tra* const transaction = request->req_transaction;
|
||||||
|
|
||||||
DdlNode::executeDdlTrigger(tdbb, transaction, DdlNode::DTW_BEFORE,
|
DdlNode::executeDdlTrigger(tdbb, transaction, DdlNode::DTW_BEFORE,
|
||||||
DDL_TRIGGER_ALTER_SEQUENCE, generator.name, *request->getStatement()->sqlText);
|
DDL_TRIGGER_ALTER_SEQUENCE, generator.name, NULL, *request->getStatement()->sqlText);
|
||||||
|
|
||||||
dsc* const desc = EVL_expr(tdbb, request, value);
|
dsc* const desc = EVL_expr(tdbb, request, value);
|
||||||
DPM_gen_id(tdbb, generator.id, true, MOV_get_int64(desc, 0));
|
DPM_gen_id(tdbb, generator.id, true, MOV_get_int64(desc, 0));
|
||||||
|
|
||||||
DdlNode::executeDdlTrigger(tdbb, transaction, DdlNode::DTW_AFTER,
|
DdlNode::executeDdlTrigger(tdbb, transaction, DdlNode::DTW_AFTER,
|
||||||
DDL_TRIGGER_ALTER_SEQUENCE, generator.name, *request->getStatement()->sqlText);
|
DDL_TRIGGER_ALTER_SEQUENCE, generator.name, NULL, *request->getStatement()->sqlText);
|
||||||
|
|
||||||
request->req_operation = jrd_req::req_return;
|
request->req_operation = jrd_req::req_return;
|
||||||
}
|
}
|
||||||
|
@ -99,6 +99,8 @@ struct DdlTriggerContext
|
|||||||
: eventType(*getDefaultMemoryPool()),
|
: eventType(*getDefaultMemoryPool()),
|
||||||
objectType(*getDefaultMemoryPool()),
|
objectType(*getDefaultMemoryPool()),
|
||||||
objectName(*getDefaultMemoryPool()),
|
objectName(*getDefaultMemoryPool()),
|
||||||
|
oldObjectName(*getDefaultMemoryPool()),
|
||||||
|
newObjectName(*getDefaultMemoryPool()),
|
||||||
sqlText(*getDefaultMemoryPool())
|
sqlText(*getDefaultMemoryPool())
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -106,6 +108,8 @@ struct DdlTriggerContext
|
|||||||
Firebird::string eventType;
|
Firebird::string eventType;
|
||||||
Firebird::string objectType;
|
Firebird::string objectType;
|
||||||
Firebird::MetaName objectName;
|
Firebird::MetaName objectName;
|
||||||
|
Firebird::MetaName oldObjectName;
|
||||||
|
Firebird::MetaName newObjectName;
|
||||||
Firebird::string sqlText;
|
Firebird::string sqlText;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -223,6 +223,8 @@ const char
|
|||||||
DDL_EVENT_NAME[] = "DDL_EVENT",
|
DDL_EVENT_NAME[] = "DDL_EVENT",
|
||||||
EVENT_TYPE_NAME[] = "EVENT_TYPE",
|
EVENT_TYPE_NAME[] = "EVENT_TYPE",
|
||||||
OBJECT_NAME[] = "OBJECT_NAME",
|
OBJECT_NAME[] = "OBJECT_NAME",
|
||||||
|
OLD_OBJECT_NAME[] = "OLD_OBJECT_NAME",
|
||||||
|
NEW_OBJECT_NAME[] = "NEW_OBJECT_NAME",
|
||||||
OBJECT_TYPE_NAME[] = "OBJECT_TYPE",
|
OBJECT_TYPE_NAME[] = "OBJECT_TYPE",
|
||||||
SQL_TEXT_NAME[] = "SQL_TEXT";
|
SQL_TEXT_NAME[] = "SQL_TEXT";
|
||||||
|
|
||||||
@ -2246,6 +2248,22 @@ dsc* evlGetContext(thread_db* tdbb, const SysFunction*, const NestValueArray& ar
|
|||||||
resultStr = context.objectName.c_str();
|
resultStr = context.objectName.c_str();
|
||||||
resultType = ttype_metadata;
|
resultType = ttype_metadata;
|
||||||
}
|
}
|
||||||
|
else if (nameStr == OLD_OBJECT_NAME)
|
||||||
|
{
|
||||||
|
if (context.oldObjectName.isEmpty())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
resultStr = context.oldObjectName.c_str();
|
||||||
|
resultType = ttype_metadata;
|
||||||
|
}
|
||||||
|
else if (nameStr == NEW_OBJECT_NAME)
|
||||||
|
{
|
||||||
|
if (context.newObjectName.isEmpty())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
resultStr = context.newObjectName.c_str();
|
||||||
|
resultType = ttype_metadata;
|
||||||
|
}
|
||||||
else if (nameStr == SQL_TEXT_NAME)
|
else if (nameStr == SQL_TEXT_NAME)
|
||||||
{
|
{
|
||||||
if (context.sqlText.isEmpty())
|
if (context.sqlText.isEmpty())
|
||||||
|
Loading…
Reference in New Issue
Block a user