Aaron:
 
You are correct. Current_DB() actually combines the operations:
 
EData = Current_EDB();
Data = "Lock_EDB(EData);
 
It is actually the old method of getting a locked database, and has been entirely superceded by the above code in all Geosoft GXs.
You should replace your own usage with the above, and remember to "Unlock" the database using
 
UnLock_EDB(EData);
 
You also should have no need to call Destroy_DB, because "Data" above is an existing handle, not an object that you create.
 
In summary, you would use:
 
EDB EData;
DB Data;
 
for (i=0; i<3; i++)    {
  EData = "Current_EDB();
  Data = "Lock_EDB(EData);
   ....
   ....
   ....
   UnLock_EDB(EData);
}
 
 
The following four functions are effectively obsolete, and, although supported, should be replaced by the equivalent EDB functions:
 
// Destroy_DB         Closes a Database (obsolete).  (No current equivalent)
// Destruct_DB        Destructs a Database Object (obsolete).  (No current equivalent)
// Current_DB         Returns the Current Database Handle (obsolete).   (Current_EDB, Lock_EDB)
// SetCurrent_DB      Sets the current database to this database (obsolete). (MakeCurrent_EDB, Lock_EDB)
 
I have just updated the db.gxh file to note this, so other users will not be mislead...
 
Stephen Cheesman
 

_______________
Geosoft Inc.
Stephen Cheesman
[EMAIL PROTECTED]
(905) 315-8207

Software and services for effective earth science decision-making.
Free Oasis montaj interface now available at http://www.geosoft.com
 

 
 
-----Original Message-----
From: skyhunter [mailto:[EMAIL PROTECTED]]
Sent: December 13, 2001 5:31 PM
To: GXNET
Subject: [gxnet]: Database locks

Hi evderyone,
 
I've just come across something that I don't fully understand. I wrote a GX and the flow of operation of the relevant portion of the GX is,
 
for (i=0; i<3; i++)    {
   Data1 = Current_DB();
   ....
   ....
   ....
   Destroy_DB();
}
 
I kept getting a 'cannot lock database twice error'. To do some tests to track down the error, I put an Abort_SYS("EXIT") command between the destroy statement and the closing } of the loop. The GX worked exactly how I expected it to. I then added another Data="Current_DB()" statement after the existing destroy command and the Abort_SYS command. Upon running, I got the error again. So my conclusion is that the Current_DB() command locks the database. Can anyone tell me if this is a correct conclusion? If so, how do I unlock the database when I do not have an EDB object.
 
I know the simple thing would just be to create an EDB object, but I stumbled upon something I don't understand here and I would like to figure it out if possible.
 
 
 
 
 
Aaron Balasch
Sky Hunter Technologies Inc.
Suite 101, 1725 10th Avenue S.W.
Calgary, Alberta T3C 0K1
email: [EMAIL PROTECTED]
phone: 403-228-2175
fax: 403-244-7955

Reply via email to