Show pageOld revisionsBacklinksExport to PDFFold/unfold allBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. ====== pears.DBCleanupOrphanBlobstore ====== <WRAP center round info> Generated schema reference. Regenerate this page from the SQL unload; keep hand-maintained business notes in the narrative namespace. </WRAP> ===== Original SQL ===== <code sql> COMMENT TO PRESERVE FORMAT ON PROCEDURE "pears"."DBCleanupOrphanBlobstore" IS {create function DBCleanupOrphanBlobstore /* Application Maintained Function / Procedure - DO NOT EDIT*/ (in countordo char(1)) returns integer begin declare @RC integer; set @RC = 0; if countordo = 'C' then select count(*) into @RC from Blobstore where ( (((class = 'V') or(class = 'J')) and not exists(select * from person where personid = Blobstore.id)) or ((class = 'O') and not exists(select * from OLEDocument where OLEDocumentid = Blobstore.id)) or ((class = 'L') and not exists(select * from Contactevent where Contacteventid = Blobstore.id)) or ((class = 'M') and not exists(select * from MailMerge where MailMergeid = Blobstore.id)) or ((class = 'T') and not exists(select * from TemplateStore where Templateid = Blobstore.id)) ); return @RC end if; delete from Blobstore where((class = 'V') or(class = 'J')) and not exists(select * from person where personid = Blobstore.id); set @RC = @RC + (select @@rowcount); delete from Blobstore where(class = 'O') and not exists(select * from OLEDocument where OLEDocumentid = Blobstore.id); set @RC = @RC + (select @@rowcount); delete from Blobstore where(class = 'L') and not exists(select * from ContactEvent where Contacteventid = Blobstore.id); set @RC = @RC + (select @@rowcount); delete from Blobstore where(class = 'M') and not exists(select * from MailMerge where MailMergeid = Blobstore.id); set @RC = @RC + (select @@rowcount); delete from Blobstore where(class = 'T') and not exists(select * from TemplateStore where Templateid = Blobstore.id); set @RC = @RC + (select @@rowcount); call AuditLog('CLEANUP',null,string(@RC,' Unattached Blobstore Records deleted '),null,null); return @RC; end } </code> database/procedures/pears_dbcleanuporphanblobstore.txt Last modified: 2026/08/07 19:24by 127.0.0.1