|
There's no problem, just my curiosity at work. I've
just been doing some playing around and have come up with a few things on how
the GX language works and would just like to confirm these things if someone
else out there knows the answers. I've included a portion of code below. I've
stuck in a few trivial DisplayMessage_SYS() commands to track were i'm at in the
program operation.
1. EData1 =
Current_EDB();
2.
Data1=Lock_EDB(EData1);
3. CreateSymb_DB(Data1,
"c2hp15kbl", DB_SYMB_CHAN,
DB_OWNER_SHARED, DB_SYMB_SHARED_LONG);
4. IStrcpy_STR(sExp,
"c2hp15kbl=c2r_2passave_1-c21_hp15k", 64);
5. SetString_SYS("Math", "Exp",
sExp);
6. iRunGX_SYS("math.gx");
7. EData1 =
Current_EDB();
8.
Data1=Lock_EDB(EData1);
9 DisplayMessage_SYS("hi",
"hi");
10.
UnLock_EDB(EData1);
//Unlock the edited database.
11. DisplayMessage_SYS("hi",
"hi1");
12. EData1 =
Current_EDB();
13. Data1=Lock_EDB(EData1);
14.
Commit_DB(Data1);
15. DisplayMessage_SYS("hi",
"hi2");
16.
UnLock_EDB(EData1);
//Unlock the edited database.
17.
UnLoad_EDB(sDbin);
//Close the edited database.
Abort_SYS("DONE");
}
My first finding is that if I comment out lines 7
and 8, I get the first DisplayMessage command but not the second. I
assume that this is because the GX hangs up at the Unlock_EDB command.
I'm guessing this is because Edata1 is no longer a valid handle. I conclude that
this is because when I run the math.gx, Edata1 is somehow unlocked and
destroyed. Since the math.gx does uses Edata, not Edata1 as the handle, the only
thing I can conclude is the when math.gx Unlocks Edata, it also Unlocks all
other EDB handles including Edata1. Can anyone tell me if this is
right?
My second finding is that if I comment out lines 7,8,10,12,13,14,16(all the lines dealing with locking&unlocking the database and the commit statement), I get to the "hi2" display message immediately before th Unload_EDB command but the Database does not unload and I don't get to the Abort_SYS("DONE"); command. I don't really no what's going on here.
Aaron Balasch |
- RE: [gxnet]: Locking and unlocking databases Ian MacLeod
- Aaron Balasch
