On Sun, 25 Mar 2001, David Jacobowitz wrote:

> I have stored our web visitors input in a flat file. My form has 7 fields.
> Each field values are stored in new line and at the end of the record I
> simply printed end-of-user-record.
>
> I have constructed a table in MySQL and would like to upload these data in
> my database. But there are many records, I need to convert each records into
> rows.  Can any one tell me if there is any magic perl code that will convert
> my flat file data records into rows.

There are DBI drivers available for handling file-based databases where
you can query the file with SQL.  DBD::CSV is one that comes to mind -- it
handles standard character delimited text files (comma-delimited, text
delimited, etc.)  It's easy enough to query text files this way and then
massage and insert into a relational database system like MySQL,
PostgreSQL, etc.

Otherwise, you will need to write your own script to read the data file
(it sounds like a simple enough format)  and then make insertions via
DBD::mysql.

-- Brett
                                   http://www.chapelperilous.net/btfwk/
------------------------------------------------------------------------
A computer lets you make more mistakes faster than any other invention,
with the possible exceptions of handguns and Tequilla.
        -- Mitch Ratcliffe

Reply via email to