Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Pessimistic Row Buffering vs No Buffering
Message
 
 
À
17/09/2000 21:07:02
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00417335
Message ID:
00417591
Vues:
21
>Was stuck for a bit on finding the number of fields in the table without hardcoding it. Ended up with
>
>mnTotFields=Len(SUBSTR(GETFLDSTATE(-1,"Students"),2))

Hmm, why not use 'FCOUNT()' function?

>FOR mnHitPoint=1 to mnTotFields &&Check Each Field
> SELECT students
> fieldname=field(mnHitPoint)
> IF &fieldname==OLDVAL(FIELD(mnHitPoint)) &&This user hasn't changed it

Use 'evaluate()' function instead of '&', it is twise more quick. For example:
mnTotFields = FCOUNT("students")
* SELECT students && put it outside of loop - speed up
* Finally, we don't need it at all
FOR mnHitPoint=1 to mnTotFields  &&Check Each Field
	fieldname = field(mnHitPoint,"students")
        fvalue = evaluate("students."+fieldname)
        if vartype(fvalue) == 'G'
            loop && skip general fields - not comparable
        endif
        foldvalue = OLDVAL(fieldname)
	IF !(IsNull(fvalue) AND !IsNull(foldvalue) OR ;
            !IsNull(fvalue) and IsNull(foldvalue) ) AND ;
            fvalue == foldvalue &&This user hasn't changed it
        ....
        endif
endfor


The most quick way, however, is put fields list into array (afields function) and put buffered field values into array ('copy to array'). Buth above way will work fine too even for large tables with many fields.

>And so on! I have a customer that will be very happy.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform