How to remove the source code for triggers, procedures and views?


You can do it by setting the RDB$...SOURCE column to NULL. Database will keep working as the compiled source is kept in BLR column. Here are the statements that remove the code (and also make sure they only do it for user objects - not to damage the system ones):

UPDATE RDB$TRIGGERS SET RDB$TRIGGER_SOURCE = NULL
WHERE RDB$SYSTEM_FLAG IS NULL OR RDB$SYSTEM_FLAG=0;

UPDATE RDB$PROCEDURES SET RDB$PROCEDURE_SOURCE = NULL
WHERE RDB$SYSTEM_FLAG IS NULL OR RDB$SYSTEM_FLAG=0;

UPDATE RDB$RELATIONS SET RDB$VIEW_SOURCE = NULL
WHERE (RDB$SYSTEM_FLAG IS NULL OR RDB$SYSTEM_FLAG=0)
AND RDB$VIEW_BLR IS NOT NULL;

If your aim is to protect your metadata from users, take a look at FAQ #32 as well.


Do you find this FAQ incorrect or incomplete? Please e-mail us what needs to be changed. To ensure quality, each change is checked by our editors (and often tested on live Firebird databases), before it enters the main FAQ database. If you desire so, the changes will be credited to your name. To learn more, visit our add content page.



All contents are copyright © 2007-2024 FirebirdFAQ.org unless otherwise stated in the text.


Links   Firebird   News   FlameRobin   Powered by FB: Home Inventory   Euchre  
Add content   About  

Categories
 Newbies
 SQL
 Installation and setup
 Backup and restore
 Performance
 Security
 Connectivity and API
 HOWTOs
 Errors and error codes
 Miscellaneous