CSV file - parsing multiple times

#1
[eluser]JonoB[/eluser]
Part of my application allows users to upload a csv file. The steps in the process are as follows:

1. User uploads a file, and it gets parsed to check for validity
2. If the file is valid, the parsed information is displayed, along with options for the user to match columns from the csv file to database columns
3. Import the data - final stage where the csv data is actually imported into the database

So, the problem that I have at this point is that the same csv file gets parsed in each of the above 3 steps - so that means 3 parses for each import.

Given that there can be up to 500 rows per csv file, then this doesn't strike me as particularly efficient.

Should I rather temporarily store the imported information in a database table after step 1? If so, I would obviously run clear up routines to keep the table as clean as possible. The one downside is that the csv imports can contain between 2 and 10 columns - so I'd have to make a database table of at least 11 columns (with an ID field)...which would be somewhat redundant in most cases.

Or should I just stick with the csv parsing? Up to 500 rows is not that big really.

Or perhaps there is another better alternative?

#2
[eluser]Unknown[/eluser]
can you please post the code.,,. i have common problem,,


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.