T
T
tester_toster2016-11-17 15:42:32
Data transfer
tester_toster, 2016-11-17 15:42:32

How to write goods import correctly?

Greetings.
There is a task: to write the import of goods from a file into the database.
My solution is straight forward: I upload a file, parse it, put the data in a temporary table.
Then, using ajax, I make a request to the script, which selects values ​​from the temporary table and inserts them into the table, or replaces them if necessary, adds new providers and properties if they are not there. The script has a condition - the maximum execution time (in my case, 1 second), and a check for the presence of data for import, when one of the conditions is met, the script returns a response to the client, and there it is already decided - a new request or the end of work, plus a progress bar.
Interested in whether the logic is correct and how it can be improved?
Is it better to do a lot of queries or unload tables at a time - change values, load back?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Viktor, 2016-11-17
@master2016

I would do it a little differently. I would fill the temporary table with data as much as possible, then give it to a person for viewing. With checkboxes and confirm button. By pressing which the data would already be transferred to a permanent table.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question