Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
INSERT not as maintainable?
Message
 
 
À
26/07/2006 16:23:36
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01140411
Message ID:
01140531
Vues:
14
>>mine is a specific reason why i've started using insert more than replace.
>>
>>What I have found with doing an audit trail is that each replace command adds a row to my audit table, which if i'm replacing a number of fields at one time (say for example with a "save" button on a form), i get a number of rows in my table for the same "save" command. with the insert command, i get only one row which makes it much much easier for me to track changes made to my tables.
>
>Does this happen if you buffer the record and do a tableupdate?

Here is a little handy function I use to get field list for inserts, CA, etc.:
********************************************************************
*  Description.......: FieldsToString - creates a string with fields in a table
*  Calling Samples...:
*  Parameter List....: tlAddTypes, tlAddAlias
*  Created by........: Nadya Nosonovsky 04/21/2005
*  Modified by.......: *-- CHANGE - NN - August 10, 2005 - 15:10:45
********************************************************************
function FieldsToString
lparameters tlAddTypes, tlAddAlias

local lcStr, lnI, lnFields, laFields[1], lcType
lnFields = afields(laFields)
lcStr = ""

for lnI = 1 to m.lnFields
	lcType = laFields[m.lnI,2]
	lcStr = m.lcStr + ", " + iif(m.tlAddAlias,alias() + ".", "") + ;
		lower(left(laFields[m.lnI, 1],1)) + ;
		proper(substr(laFields[m.lnI, 1],2)) + ;
		iif(m.tlAddTypes, " " + m.lcType + ;
		iif(not inlist(m.lcType, "D","T","I","G","M","Y"), "(" + transform(laFields[m.lnI,3]) + ;
		iif(laFields[m.lnI,4] > 0, ", " + transform(laFields[m.lnI,4]),"") + ")",""),"")
next
_cliptext = substr(m.lcStr, 3)
*******************************************************************************
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform