View Full Version : Check if there are Database Tables In Use


Mike Thomson
09-07-2005, 12:43 AM
I have posted the following function for use by the Alpha Five community

Function Name: check_files_in_use()

This function will return True if there are any tables in use by any users in any sessions. This is instead of table.enum_open_files() which will only show shat files are in use for the current user. To use this function copy the attachment and save as a function called "Check_files_in_use" in your code tab.


if check_files_in_use then
ui_msg_box ("Notice","Ther are files in use"
end if

You may also call the function as follows

check_files_in_use ("Dialog Title")

Which will display the files which are in use as a dialog box with the title you have nominated as "Dialog Title")

eg: check_files_in_use ("These Tables are In Use")


Mike Thomson

Mike Thomson
09-07-2005, 01:42 AM

I introduced a problem when I pasted function
The first line of function should read:-

function Check_files_in_use as L (sOption="NOSHOW")


function Check_files_in_use as C (sOption="NOSHOW")

I have also added a new option to this script so you can pass it a message to appear within the dialog

eg: check_files_in_use ("FILES IN USE","Cannot Proceed!;Please have all users log out and try again;The following Files are In Use:-;")

Please note: The second option follows xdialog rules, so be sure to put a semi colon (;) after each message line

I have attached the upgrade function here


ken doucet
04-08-2006, 12:04 PM
The reason I am asking is that in my dos database world I could not do a backup of the database if files were in use and had to resort to a combination of creating a files open list and another list of ip addresses which we then used to find which user left database open.

Or, are open files not an issue in doing a backup in Alpha5?

04-09-2006, 10:17 AM

Your function is defined to return Character type, but in fact returns Logical type. Also there is a function

that is not an Alpha A5 function. Is there something else you wanted to include?:)

Mike Thomson
05-23-2006, 02:35 AM
Thanks Ian - I did not supply the correct file
Here it is
Please note: The compile_filename_in_use is a UDF , wrapped up with this function. Just save entire script with a file name of check_files_in_use

05-23-2006, 07:51 AM
Thanks Ian

Whose "Ian"?:)

Mike Wilson
05-23-2006, 11:57 AM
Whose "Ian"?:)


I swear I have read this Ian... whose Ian? before on the MB. Does this happen often to you, Ira?

Mike W

Mike Thomson
05-23-2006, 07:15 PM
My apologies for the typo, Ira

05-24-2006, 09:44 AM
Mike W. - More times than I'd think should happen. However there is no world-famous Ira to popularize the name!

Mike T. - Not a problem. I just didn't want to have to go to the courthouse and legally change my name to Ian or to "Alpha Developer formerly known as Ira":D