tags:

views:

50

answers:

2

I am working on a program to allow a user to edit data from either a MySQL DB table, or an uploaded CSV file.

I am curious as to what format i can bring the two data types into where i can code a singular presentation model to present the data to the user. Should i convert the SQL to CSV, or try to go through both types and do something else?

+2  A: 

I'm not sure I fully understand this, but it seems to me that the CSV / SQL issue is one of rendering. I think you need an object representing the data that is independent of it's final form.

That is, I would maintain a model (a 2 dimensional array?), and allow the user to handle that (read/write data etc.). When you need to generate your data, you should be able to render this as SQL or CVS (or any other format), and perform the appropriate conversions at that point.

Brian Agnew
+1  A: 

You could use this to load the CSV into mysql to have all the data in one common place

LOAD DATA LOCAL INFILE 'C:\\Documents and Settings\\path\\to\\the_file.CSV'
INTO TABLE table_name
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(field1, field2, field3, field4, etc);
Phill Pafford