Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Index file corrupted
Message
From
27/03/2017 10:05:05
 
 
To
27/03/2017 09:43:40
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8
OS:
Windows 7
Miscellaneous
Thread ID:
01649371
Message ID:
01649382
Views:
55
>Hi Tore Bleken,
>
>Thank you for your reply.
>
>What do you mean by a bad index key expression may cause index problems, make sure that the index expression ALWAYS returns the same key length?
>
>On the other hand will the increment of the file size will increase the chances the index corrupted?
>
>how to prevent the index file corrupted issue? will the file reindex regularly can minimize the issue?
>
>Thank you

First of all, to prevent the index corruption you must fix whatever causes it. Running reindex regularly is like using a band aid to fix a broken arm; it may reduce the pain but it doesn't fix anything.

By my comment about index expression I mean that for every record the index "function" must return a value of the same length for every record. For instance an index expression like trim(firstname) will return a value of "Paul" for "Paul " and "Kusnardi" for "Kusnardi". Paul is 4 characters and Kusnardi is 8, so using trim(firstname) as an index expression will cause index corruption. Well, actually it won't necessarily cause any problem since VFP will tell you that this is an illegal index key,. But VFP can't always predict which index expressions are illegal, so it's possible to create illegal index expressions without getting any warning. And if your program allow Null values, you must be extra careful since a Null value will generate a key length of minimum 6 (".NULL.") which may be longer than the field length.

If you are uncertain, list the table structure and the index expressions you use for the table which gets corrupted, and we will try to spot the source of your problem.
Previous
Reply
Map
View

Click here to load this message in the networking platform