|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Sat Dec 22, 2007 1:48 am
[2.18] Problem with %dbkeys |
#var tester %null
#addkey tester one 1
#addkey tester two 2
#addkey tester three 3
#delkey tester two
#say Keys: %dbkeys( @tester) Number: %numitems( %dbkeys( @tester))
#delkey tester one
#say Keys: %dbkeys( @tester) Number: %numitems( %dbkeys( @tester))
Result I get is:
Keys: one| Number: 2
Keys: Number: 0
Error: Where is "three" when %dbkeys prints the names of the keys after the first delete?
What is happening after the second delete? There should still be one item in the database record. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sat Dec 22, 2007 11:57 am |
Confirmed. How bizarre.
|
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Jan 07, 2008 11:23 pm |
Added to bug list.
|
|
|
|
ReedN Wizard
Joined: 04 Jan 2006 Posts: 1279 Location: Portland, Oregon
|
Posted: Wed Jan 09, 2008 12:39 am |
Also, I was just curious - when the variable get corrupted in my example you can cause an AV by going to the variable in the editor and trying to delete all the lines manually. It will pop up an AV before you can delete all the lines.
This isn't the first time I've come across corrupted variables that behave strangely. What I'm curious about is what is actually happening to those variables and how can I fix them? I've had code problems where some random variable was corrupted and wasn't able to be updated and therefore I had an infinite loop executing because the counter wouldn't update. Does anyone know what is happening to these variables and how to detect and fix them? I hate finding them by spending an hour debugging a lock up back to a variable that isn't allowing itself to be updated. |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Wed Jan 09, 2008 8:55 pm |
What is happening is that the internal hash table for the variable is getting screwed up. There really isn't any way to detect this without getting the AV that you mentioned. I haven't had a chance to look at the code yet to see what is causing this bug, so I can't really give any more info on it yet.
|
|
|
|
|
|