471,090 Members | 1,387 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,090 software developers and data experts.

COPY command with PHP

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*******@postgresql.org so that your
message can get through to the mailing list cleanly

Nov 23 '05 #1
0 2575

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Sarah | last post: by
2 posts views Thread by Steve Franks | last post: by
4 posts views Thread by Jon Asher | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.