>>did you know that you can create an index using your own functions. Example: index on MYFUNCTION(vfp_expression) tag mytag
>>
>>where MYFUNCTION is a function you create. Or did y'all already know this.
>
>Dean,
>
>Yes y9ou can do that. However, you cannot ever open that table if tyhe UDF is not visible to VFP as it will cuase an error that will prevent the table from opening. Also, you must insure that the UDF always returns a value of the same type and length or else the index will become corrupt.
>
>This is one of those things that "can be done" but "shouldn't be done". Like shooting yourself in the head, of course you can shoot yourself, but it isn't a very good idea to do it.
Shouldn't be done, ever? What if you have a very common search or sort expression that uses a UDF? No index, no rushmore, right? In my case, I have a table whose records are identified by a string of letters and numbers that are sorted using mysort(field1, field2, field3) or whatever. In my case, I denormalized, storing mysort(field1 etc) in a field so I wouldn't have long reindexing (since the function executes slowly). Since this function is in constant use, bugs tend to be worked out. If the function ever doesn't work, nothing else will work anyway. This function, by the way, is used both for sorting reports and for selecting values that are BETWEEN() two other values.
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement