Normal Topic Locking databases (Read 897 times)
Rod Weston
Member
*
Offline



Posts: 25
Joined: Aug 22nd, 2016
Locking databases
Sep 16th, 2016 at 11:30pm
Print Post Print Post  
I am encountering locked databases frequently. I am using XResultSetClose after I obtain a result set, but that doesn't seem to help. Is there a step or steps that I am missing to prevent leaving a database locked after I access it?
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Locking databases
Reply #1 - Sep 19th, 2016 at 6:24pm
Print Post Print Post  
Hello,

Closing the result set unlocks the individual record that is the current record(similar to closing the form which closes the result set of that form), but does not close the application. To close the application you will want to use UnloadApplication().

The syntax is UnloadApplication(filename as string).

Note: If you unload after each X command, that also means that each X command has to load the application again which slows them up.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Rod Weston
Member
*
Offline



Posts: 25
Joined: Aug 22nd, 2016
Re: Locking databases
Reply #2 - Sep 19th, 2016 at 10:42pm
Print Post Print Post  
In that case, using a series of UnloadApplication() commands on a form exit for all the files I have accessed seems to be a more efficient approach, but I am looking for a 'best practices' approach.
« Last Edit: Sep 19th, 2016 at 11:42pm by Rod Weston »  
Back to top
 
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Locking databases
Reply #3 - Sep 20th, 2016 at 1:25pm
Print Post Print Post  
"Best" depends on circumstance. For example, if the lookup application is especially large or used constantly, it should be loaded/unloaded as rarely as possible. If it is small or looked up rarely, it may be better to let it load/unload frequently. It also depends on your resources. If the application is large and uses a lot of memory that would often be better used by other parts of the application-as-a-whole, your may want to put up with some load / unload time.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: Locking databases
Reply #4 - Sep 20th, 2016 at 4:47pm
Print Post Print Post  
If you are designing for a Client/Server environment there is no need to unload the applications after an X command as other clients to that same Server will be able to access the files without receiving a locked error message.

If you are designing for a standalone environment, you may want to merge all your applications together into one larger application, so that a user can be in say both sales and inventory at the same time and X commands still work perfectly.

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged