On 22-05-2014 09:32, Martijn Tonies (Upscene Productions) wrote:
> Hi all,
>  
> How can I get the type of the DDL trigger (eg “create procedure”)?
>  
> I’ve noticed RDB$TYPES doesn’t hold any values for it and using
> ANY, it seems like it’s a bit mask.
>  
> Any clues?
>  

Yes, it's a bit mask. See the constants:

const unsigned TRIGGER_TYPE_SHIFT                       = 13;
const FB_UINT64 TRIGGER_TYPE_MASK                       = (QUADCONST(3) << 
TRIGGER_TYPE_SHIFT);

const FB_UINT64 TRIGGER_TYPE_DML                        = (QUADCONST(0) << 
TRIGGER_TYPE_SHIFT);
const FB_UINT64 TRIGGER_TYPE_DB                         = (QUADCONST(1) << 
TRIGGER_TYPE_SHIFT);
const FB_UINT64 TRIGGER_TYPE_DDL                        = (QUADCONST(2) << 
TRIGGER_TYPE_SHIFT);


const int DDL_TRIGGER_BEFORE    = 0;
const int DDL_TRIGGER_AFTER             = 1;

const FB_UINT64 DDL_TRIGGER_ANY                                 = 
0x7FFFFFFFFFFFFFFFULL &
~(FB_UINT64) TRIGGER_TYPE_MASK & ~1ULL;

const int DDL_TRIGGER_CREATE_TABLE                              = 1;
const int DDL_TRIGGER_ALTER_TABLE                               = 2;
const int DDL_TRIGGER_DROP_TABLE                                = 3;
const int DDL_TRIGGER_CREATE_PROCEDURE                  = 4;
const int DDL_TRIGGER_ALTER_PROCEDURE                   = 5;
const int DDL_TRIGGER_DROP_PROCEDURE                    = 6;
const int DDL_TRIGGER_CREATE_FUNCTION                   = 7;
const int DDL_TRIGGER_ALTER_FUNCTION                    = 8;
const int DDL_TRIGGER_DROP_FUNCTION                             = 9;
const int DDL_TRIGGER_CREATE_TRIGGER                    = 10;
const int DDL_TRIGGER_ALTER_TRIGGER                             = 11;
const int DDL_TRIGGER_DROP_TRIGGER                              = 12;
// gap for TRIGGER_TYPE_MASK - 3 bits
const int DDL_TRIGGER_CREATE_EXCEPTION                  = 16;
const int DDL_TRIGGER_ALTER_EXCEPTION                   = 17;
const int DDL_TRIGGER_DROP_EXCEPTION                    = 18;
const int DDL_TRIGGER_CREATE_VIEW                               = 19;
const int DDL_TRIGGER_ALTER_VIEW                                = 20;
const int DDL_TRIGGER_DROP_VIEW                                 = 21;
const int DDL_TRIGGER_CREATE_DOMAIN                             = 22;
const int DDL_TRIGGER_ALTER_DOMAIN                              = 23;
const int DDL_TRIGGER_DROP_DOMAIN                               = 24;
const int DDL_TRIGGER_CREATE_ROLE                               = 25;
const int DDL_TRIGGER_ALTER_ROLE                                = 26;
const int DDL_TRIGGER_DROP_ROLE                                 = 27;
const int DDL_TRIGGER_CREATE_INDEX                              = 28;
const int DDL_TRIGGER_ALTER_INDEX                               = 29;
const int DDL_TRIGGER_DROP_INDEX                                = 30;
const int DDL_TRIGGER_CREATE_SEQUENCE                   = 31;
const int DDL_TRIGGER_ALTER_SEQUENCE                    = 32;
const int DDL_TRIGGER_DROP_SEQUENCE                             = 33;
const int DDL_TRIGGER_CREATE_USER                               = 34;
const int DDL_TRIGGER_ALTER_USER                                = 35;
const int DDL_TRIGGER_DROP_USER                                 = 36;
const int DDL_TRIGGER_CREATE_COLLATION                  = 37;
const int DDL_TRIGGER_DROP_COLLATION                    = 38;
const int DDL_TRIGGER_ALTER_CHARACTER_SET               = 39;
const int DDL_TRIGGER_CREATE_PACKAGE                    = 40;
const int DDL_TRIGGER_ALTER_PACKAGE                             = 41;
const int DDL_TRIGGER_DROP_PACKAGE                              = 42;
const int DDL_TRIGGER_CREATE_PACKAGE_BODY               = 43;
const int DDL_TRIGGER_DROP_PACKAGE_BODY                 = 44;
const int DDL_TRIGGER_CREATE_MAPPING                    = 45;
const int DDL_TRIGGER_ALTER_MAPPING                             = 46;
const int DDL_TRIGGER_DROP_MAPPING                              = 47;

// that's how database trigger action types are encoded
//    (TRIGGER_TYPE_DB | type)

// that's how DDL trigger action types are encoded
//    (TRIGGER_TYPE_DDL | DDL_TRIGGER_{AFTER | BEFORE} [ |
DDL_TRIGGER_??? ...])


Adriano

------------------------------------------------------------------------------
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to