Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 4 of 4 total |
How to programmatically detect temporary tables |
Sun, May 31 2009 11:30 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | I've just added repair & optimisation into the app I'm working on. I'm zapping the .olds (that's easy) but I bombed the process a few times in the IDE and I have a slew of temporary tables. I could go through and check each one against Tables in Information but I'm hoping there's a better way.
Roy Lambert |
Tue, Jun 2 2009 11:12 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | This is my cleanup code. Can anyone spot anything I've missed that might be dangerous? The idea is to get rid of any junk left in there from optimising or just user sillyness.
procedure DoDBCleanup; var sr: TSearchRec; fNam: string; fExtn: string; begin if FindFirst(HHCommons.DBPath + '*.*', faAnyFile, sr) = 0 then begin repeat fNam := ExtractFileName(sr.Name); fExtn := LowerCase(ExtractFileExt(fNam)); fNam := Copy(fNam, 1, LastDelimiter('.', fNam) - 1); if fExtn = '.old' then DeleteFile(HHCommons.DBPath + sr.Name) else if fExtn = LowerCase(dm.TfRSession.LocalTableExtension) then begin if dm.DB.Execute('SELECT * FROM Information.Tables') = 0 then begin DeleteFile(HHCommons.DBPath + fNam + dm.TfRSession.LocalTableExtension); DeleteFile(HHCommons.DBPath + fNam + dm.TfRSession.LocalTableBlobExtension); DeleteFile(HHCommons.DBPath + fNam + dm.TfRSession.LocalTableIndexExtension); end; end else begin if (fExtn <> LowerCase(dm.TfRSession.LocalTableExtension)) and (fExtn <> LowerCase(dm.TfRSession.LocalTableBlobExtension)) and (fExtn <> LowerCase(dm.TfRSession.LocalTableIndexExtension)) and (fExtn <> LowerCase(dm.TfRSession.LocalBackupExtension)) and (LowerCase(sr.Name) <> LowerCase(dm.TfRSession.LocalCatalogName + dm.TfRSession.LocalCatalogExtension)) and (LowerCase(sr.Name) <> LowerCase(dm.TfRSession.LocalCatalogName + dm.TfRSession.LocalLockExtension)) and (LowerCase(sr.Name) <> LowerCase(dm.TfRSession.LocalConfigName + dm.TfRSession.LocalExtensionExtension)) and (LowerCase(sr.Name) <> LowerCase(dm.TfRSession.LocalConfigName + dm.TfRSession.LocalLockExtension)) then DeleteFile(HHCommons.DBPath + sr.Name); end; until FindNext(sr) <> 0; FindClose(sr); end; end; Roy Lambert |
Tue, Jun 2 2009 3:23 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
<< This is my cleanup code. Can anyone spot anything I've missed that might be dangerous? The idea is to get rid of any junk left in there from optimising or just user sillyness. >> I think you're missing a WHERE clause for your SELECT statement from Information.Tables. -- Tim Young Elevate Software www.elevatesoft.com |
Wed, Jun 3 2009 2:58 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
>I think you're missing a WHERE clause for your SELECT statement from >Information.Tables. Not any more - thanks. The one good point is it failed safe Roy Lambert |
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |