By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,541 Members | 1,476 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,541 IT Pros & Developers. It's quick & easy.

COPY command with PHP

P: n/a
I have a PHP script that was having problems using the COPY command with
files around 1500 lines in size. The script will build the copy data
from incoming CSV file into a temp file, then start a COPY command and
loop through the copy data using pg_put_line to insert and then
pg_end_copy after posting the last line as '\.'. Worked well under that
1500 line area. What I found was if I issue a pg_connection_busy($dbh)
before the pg_put_line(...) in the while statement processing the lines
of the temp file handle, it works. Don't ask me why, that is what I'd
like to know. If I report back if busy is true, I get nothing. Maybe it
is just giving a millisecond to breathe or something while checking to
see if the connection is busy? One thing though, don't know if it had
anything to do with it, the script is on an old box with an AMD 300
processor with maybe 256MB memory while the database is on an up to date
dual Pentium 4 processor with 1GB mem.

Of course, if I took the copy data file it is trying to COPY into
PostgreSQL and psql to bring it in on the server directly, no issues.
Not that it doesn't work with the busy check, just curious as to what is
causing the need for it since I spent many hours to finally find the
answer. No one on the PHP list seemed to know.

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to ma******* so that your
message can get through to the mailing list cleanly

Nov 23 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.