begin transaction;
alter table tblObject rename to realTblObject;
create view tblObject as select * from realTblObject where title not like '[%' and cdsTitlePath not like '%\[%';
/* what to do when insert, update, delete are invoked for tblObject view ... */
create trigger tblObjectInsert instead of insert on tblObject
begin
insert into realTblObject values
(NEW.objectID, NEW.cdsTitlePath, NEW.mediaID, NEW.parentID,
NEW.restricted, NEW.childCount, NEW.creator, NEW.title,
NEW.class, NEW.searchable, NEW.searchClass, NEW.createClass,
NEW.writeStatus, NEW.refID, NEW.volatility, NEW.sfmType,
NEW.protection, NEW.itemType, NEW.dlnaManaged);
end;
create trigger tblObjectUpdate instead of update on tblObject
begin
update realTblObject set objectID = NEW.objectID,
cdsTitlePath = NEW.cdsTitlePath, mediaID = NEW.mediaID,
parentID = NEW.parentID, restricted = NEW.restricted,
childCount = NEW.childCount, creator = NEW.creator,
title = NEW.title, class = NEW.class,
searchable = NEW.searchable, searchClass = NEW.searchClass,
createClass = NEW.createClass, writeStatus = NEW.writeStatus,
refID = NEW.refID, volatility = NEW.volatility,
sfmType = NEW.sfmType, protection = NEW.protection,
itemType = NEW.itemType, dlnaManaged = NEW.dlnaManaged;
end;
create trigger tblObjectDelete instead of delete on tblObject
begin
delete from realTblObject where objectID = OLD.objectID;
end;
commit;