Is a Dat File Empty

Forums for specific tips, techniques and example code
ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Is a Dat File Empty

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:58 pm

by Torrie Moore >> Mon, 17 Dec 2007 4:14:59 GMT

Hi

Does anyone have a way of determining whether a dat file is empty? We have a system for which has had the PersistenDB.OpenAllFilesOnDbOpen flag set to true and I'd like to remove the empty dat files. I can tell their size and free space but can't easily see a way to determine whether they are empty of data or not.

Thanks

Torrie Moore

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Is a Dat File Empty

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:58 pm

by cnwjhp1 >> Mon, 17 Dec 2007 4:30:56 GMT

Wouldn't a jdbutil compact or a certify give you a list of objects?

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Is a Dat File Empty

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:58 pm

by Alan >> Mon, 17 Dec 2007 8:06:02 GMT

the attached script will produce a list, however, be aware that if the map file does not exist this script will create it
Attachments
5150.wrk
(1.13 KiB) Downloaded 250 times
Last edited by ConvertFromOldNGs on Fri Aug 07, 2009 4:27 pm, edited 1 time in total.

ConvertFromOldNGs
Posts: 5321
Joined: Wed Aug 05, 2009 5:19 pm

Re: Is a Dat File Empty

Postby ConvertFromOldNGs » Fri Aug 07, 2009 2:58 pm

by Torrie Moore >> Tue, 18 Dec 2007 1:44:40 GMT

Thanks for the script Alan.

I compared the script with the output from compressing the files and there were some dat files that the script reported as not being empty that were. I discovered it is due to the Class::instancesExist method returning true if the there are instances of a class or its subclasses. Changing it to check to

class.firstInstance <> null

Gave the right result.

Torrie


Return to “Tips and Techniques”

Who is online

Users browsing this forum: No registered users and 16 guests