LiquidT has asked for the wisdom of the Perl Monks concerning the following question:
I have very little experience with Perl, and I am also new to this forum. I would greatly appreciate any direct or indirect help with a problem I am currently facing.
My program has several arrays which I intend to push into a pgSQL database. Each array represents a unique table in the database. I have used flat files as a medium for transport in the past, however the scale of data in this project requires more efficiency. After some research I have settled on using the COPY method of moving the data into the db.
So far, I have been able to find very few example of code using the pg_putcopydata method and those I have found I either do not understand or do not use a data structure much like the one I am using (arrays).
Each element in the array @ArrayInMemory will be a row in the db table with multiple columns delimited by /. This is what I image the code will be like:
@ArrayInMemory $dbh->do("COPY mytable(col1, col2, col3) FROM STDIN WITH DELIMITER '/' +"); foreach $row (@ArrayInMemory) { $dbh->pg_putcopydata($row); } $dbh->pg_putcopyend();
Again, thanks for any input on this topic and I hope we can generate a few quality examples for other users who are unfamiliar with the pg_putcopydata database handle method.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBD:Pg pg_putcopydata
by stefbv (Priest) on Jun 30, 2010 at 07:57 UTC | |
by Anonymous Monk on Jun 30, 2010 at 17:58 UTC | |
|
Re: DBD:Pg pg_putcopydata
by james2vegas (Chaplain) on Jun 30, 2010 at 18:56 UTC | |
by LiquidT (Initiate) on Jul 01, 2010 at 09:06 UTC | |
by james2vegas (Chaplain) on Jul 01, 2010 at 18:40 UTC | |
by LiquidT (Initiate) on Jul 02, 2010 at 07:39 UTC | |
|
Re: DBD::Pg pg_putcopydata
by erix (Prior) on Jul 01, 2010 at 11:02 UTC |