Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
INSERT not as maintainable?
Message
From
26/07/2006 16:34:45
 
 
To
26/07/2006 16:19:48
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01140411
Message ID:
01140445
Views:
17
>>>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?
>>
>>Mike,
>>I prefer insert over append blank/replace.
>>-Append blank would insert a blank record which rarely is just what I don't want to happen.
>>-With insert I can safely insert one or multiple rows at once. With append blank/replace approach there is a chance I'm replacing 'over' another user's data.
>
>I prefer insert over append normally too. However I'm augmenting some inserts with new fields in the middle and it's not as easy. Of course I could do them at the end.
>
>Buffering the table removes all of these concerns.
>
>>-From my POV insert syntax is better. You can't get the list out of sync if you don't do that on purpose.
>
>It is easy to make mistakes. Humans are taught to read English Left to Right and Top to Bottom. INSERT separates the fields from the values breaking the reading pattern and increasing the mistakes.
>
>Agreed?

INSERT implies no specific order to the fields. All you need to maintain is that if you add a new field to the insert field list (could be at the end of the list), that you add the corresponding new value in the same location. Trying to keep them in order may be more difficult than just always adding them to the ends of the lists.
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Previous
Reply
Map
View

Click here to load this message in the networking platform