Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Which approach is better?
Message
From
10/07/2003 00:12:06
Rene Lovino
Bigfoot Global Solutions, Inc
Cebu, Philippines
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00808727
Message ID:
00808737
Views:
13
Reygie,

The difference between the two approach are the following:

Approach 1 is copying all data from all source table to the destination table.
This approach will will not commit all transaction if in case there is a problem such as power failure or an error.


Approach 2 is copying data from one table to the distination table then commit the transaction.



If the requirements of your program is to commit only if there is no error of copying record from all of your
data source to the destination table, then approach 1 is your choice.

But if your program will only require to copy the data as long as there is no error on transaction,
the approach 2 is your choice. To elaborate more of what I mean,
for example: after copying the data from table1 and you're not concern that there is a possible problem of
copying record of the next table.


On approach 1: if your program finish copying data from Table1 up to Table40 and something happen such as
power failure or error, all of the data copied will not be save to the destination table. You need to start to it again.


On Approach 2: After copying the records from Table1 then save it to the destination table.
Then copy the records from Table2 and so on. For example your program already processing table40
and there is an error or other problem data copied from Table1 to Table39 is not affected.
Only the data from Table40 is not save.


Base on the situation that I have illustrate its up to you to select.
It depends upon the requirements of your system.



Additional:
I have notice that you are using VFP8. As what I have seen on your code you're using:
sele table1
scan
insert into servertable1 from memvar
endscan


why not use this code since your using VFP8:
insert into servertable1 (field1, field2, field3, ....) ;
select field1, field2, field3, .... from table1

or if your table source and destination table have the same number of fields, use:
insert into servertable1 ;
select * from table1




Regards,

Rene

















i have a program that send records to the server in batch
my code looks like this. it it assumed the tables ( table1 ... table50) contains only the transactionof the day.
i want to know hick approach is better


approach 1:
begin trans
sele table1
scan
insert into servertable1 from memvar
endsca
.
.
sele table50
scan
insert into servertable50 from memvar
endsca
end trans

approach 2:
or i have to break this down one transaction per table

begin trans
sele table1
scan
insert into servertable1 from memvar
endsca
end trans
.......

begin trans
sele table50
scan
insert into servertable50 from memvar
endsca
end trans

thanks for the advise!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform