Importing CSV to PostgreSQL

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

 



Can someone lend some guidance or point me to some docs on how to import
an uploaded CSV file into a PostgreSQL table? I will need to evaluate
the imcoming data line by line and set different columns to values
depending on the evaluations. I would like to do this in a transaction
so that if anything fails, all fails. Right now, I am looking to read
each line with 'fopen, fgets, etc.' and split the CSV's into an array
and use pg_copy_from to insert records. Not sure how I can put that into
a transaction or if that is actually the easiest or most effcient way to
do it. Since this is the first time doing anything like this, looking
for anyone with this experience to offer some guidance?

--
Robert

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


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux