Re: Generating MySQL Tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 4 Oct 2004 22:32:40 +0200, Pete <cgrp@xxxxxxxxxxxx> wrote:
> 
> Is MySQL off topic for this list?  If so, I apologise.

There is a php-db list that is more on-topic than php-general, but so
long as your already here :)

> I am supplied with various text (CSV, etc) data files, which I need to
> manually massage before I import into the main database.  I feel that I
> can deal with them better by turning them into SQL tables first.  I know
> about LOAD DATA INFILE, but this requires a table to exist, and I don't
> know the format of the table until I receive the text file.

Most csv files I have dealt with contained a header row.  You can
parse that out and make a create table query with it using text
fields.  You could then insert the data and have MySQL analyze and
suggest better optimal fields than the text fields.  Kind of a kludge
but if you need to be general this way woudl work although it's pretty
inefficient compared to knowing the data up front.

You might want to check out the PEAR File package, it does a lot of
the same things you will be doing:

http://pear.php.net/package/File


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux