Dodgy keys (OpenInsight Specific)
At 16 DEC 1999 08:57:43PM Paul Rule wrote:
Its possible to create keys that have @fm delimeters in them but how do you retrieve them via a select. (So I can delete them) Select returns each part of the key separated by @fm as a separate key so you can't delete it because you don't have the full key. The problem keys can be created as below:
key=AAA":@fm:"BBB"
data=testing"
open "TEMP" to handle else debug
write data to handle,key else debug
Can also be deleted by using DELETE HANDLE,KEY
but how can you retrieve these keys from a file programatically?
At 17 DEC 1999 06:16AM Oystein Reigem wrote:
Paul,
Let's say your table has two rows with keys "AAA":@FM:"BBB" and "CCC". If you do a select/readnext loop, readnext will get you three "keys"
"AAA"
"BBB"
"CCC"
This is your problem, right?
My suggestion is: Do a read on each key from readnext. If a row doesn't exist, that must be because the key isn't a key after all but the first part of a key with a @FM. So bring the key with you into the next loop pass and concatenate with a @FM between. E.g a read on "AAA" discovers there is no key "AAA", so next loop pass you try not just "BBB" but "AAA":@FM:"BBB".
You can easily handle the case with keys containing more than one @FM.
But you've got problems if your table has e.g both keys "AAA" and "AAA":@FM:"BBB". Then working backwards might be better. Unless you have both "BBB" and "AAA":@FM:"BBB". There's not a general solution that covers all possible cases.
- Oystein -
At 18 DEC 1999 05:10PM akaplan@sprezzatura.com - [url=http://www.sprezzatura.com]Sprezzatura Group[/url] wrote:
Assuming in this situation one knows the number of @FMs, it's a simple matter of always reading a 2 or 3 'part' key until one is found.
Alternatively, one could copy the table, delete all the records and visually inspect those that are left.
akaplan@sprezzatura.com
[/i]World leaders in all things RevSoft[/i]
At 21 DEC 1999 10:43AM Matt Sorrell wrote:
Paul,
I had this problem in an ARev table once, and this is how I fixed the problem.
I executed an RBasic select on the table (not an RList). Then I go into a readnext loop. At least in ARev 3.12, the readnext loop did not "explode" the keys based on the delims. I would then do a fieldcount on the key using @FM, @VM, and @SVM (just to be safe). Obviously, if any of these counts is greater than 1, then you have an embedded delimeter. At this point, I would write the key out to a log file and then either delete the record or copy it to a temp table with a sequential counter key so that I could visually inspect it.
Obviously, you can improve the logging by writing out both the bad key and the new seq key you used.
I've used this approach successfully on several tables of vastly different sizes. It helps to have everyone out of the system while this is running.
Matt Sorrell
msorrel@greyhound.com
At 21 DEC 1999 04:37PM Paul Rule wrote:
Matt,
Thats pretty much what I'm trying to do. I've created a utility to search and delete suspect records. I can delete records with null keys ok, as well as keys with @vm @svm @tm etc but I can't read the ones with @fm. I don't know what they are up front as this is a generic sort of routine. I've tried the SELECT file.handle method. Its interesting that this worked in Arev but not in OI. Bugger!