Information générale
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
fixing old code w/ len(tablename.fieldname)
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
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