Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
INSERT not as maintainable?
Message
 
À
26/07/2006 15:56:08
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01140411
Message ID:
01140423
Vues:
25
>Is it just me or is
>
>REPLACE ;
> field1 with expression1, ;
> field2 with expression2 ;
> field3 with expression3 ;
> IN alias
>
>You can't get the fields out of synch with the values.
>
>Easier to read/maintain/modify than:
>
>INSERT INTO alias ;
> (field1, ;
> field2, ;
> field3) ;
> VALUES ;
> (expression1, ;
> expression2, ;
> expression3)
>
>If the field list gets out of synch with the values, that's going to be messy. Not only that, but with a longer list of fields, the chances of error goes up.
>
>Besides the advantages of doing the equivalent of an append blank and a replace all at the same time AND SQL compatibility, what other benefits are there to INSERT in VFP?

In addition to Cetin:
You could easily violate some PK. Try following situation:
CREATE CURSOR Test (Fld1 int, Fld2 C(20))
INDEX ON Fld1 TAG Test CANDIDATE
APPEND BLANK
*** Something happens here and the user quit the application

*** Next time S/He needs to insetr new record:
APPEND BLANK && BOOOOOOOOOOOOOOOOOOOOOOM


*** But with this:
CREATE CURSOR Test (Fld1 int, Fld2 C(20))
INDEX ON Fld1 TAG Test CANDIDATE
INSERT INTO Test VALUES (2,-2) && BOOOOOOM, but no record is inserted
INSERT INTO Test VALUES (2,[asasa])


*** Also:
CREATE CURSOR Test (Fld1 int, Fld2 C(20))
INDEX ON Fld1 TAG Test CANDIDATE
APPEND BLANK
INSERT INTO Test VALUES (2,[asasa])
BROW NORMAL
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform