Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
fixing old code w/ len(tablename.fieldname)
Message
De
08/03/2001 18:50:05
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
fixing old code w/ len(tablename.fieldname)
Divers
Thread ID:
00483363
Message ID:
00483363
Vues:
44
I attempted the following code:

alter table surveyans add column cresponse c (len(responses.cresponse))

responses.cresponse had a null value. The code failed. I guess then, that VFP is evaluating the expression itself, not the length of the field in the table, which makes sense. I never realized this would fail with null values.

First, as a workaround, i positioned the record pointer at eof(), and then evaluated len(). Then I realized that I can just use fsize(). This is fine going forward for new apps.

But Is there any kind of workaround for this to fix existing code that breaks as a result of this problem, short of doing mass replaces/hunts for all occurrences of len() in an existing app ?. I guess someone some kind of trap could be added to the error handler ?

This led me to another question. I have a notion, that may or not be correct, that under Clipper, one could redefine existing built in functions. Can the same be done with Fox. My understanding is that it can't.

I tried:

=len()


function len

wait wind 'new len function'
return .t.

but VFP didn't recognize my new len function.

I wish there was a 'SET USE_YOUR_OWN_UDFS ON' COMMAND !

VFP 7 ?



TIA
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform