473,386 Members | 1,743 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Using SELECT inside a COPY transaction with PHP

I tried posting this to PHP-DB list, but no answers since yesterday. I'm
thinking it is not possible, but just trying to confirm. I am using
pg_exec($dbh, "COPY sometable FROM stdin USING DELIMITERS"). Once this
the connectino is made and this line has been issued, my script begins
analyzing each line of the CSV file and needs to do a SELECT statement
using some of the fields in the line to find other related data before
calling pg_end_copy($dbh), which syncs the data. Can another pg_exec
call be made for a SELECT statement before the COPY is over? My script
seems to hang at the point of the first SELECT.

--
Robert
---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 23 '05 #1
1 1667
Robert Fitzpatrick <ro****@webtent.com> writes:
I tried posting this to PHP-DB list, but no answers since yesterday. I'm
thinking it is not possible, but just trying to confirm. I am using
pg_exec($dbh, "COPY sometable FROM stdin USING DELIMITERS"). Once this
the connectino is made and this line has been issued, my script begins
analyzing each line of the CSV file and needs to do a SELECT statement
using some of the fields in the line to find other related data before
calling pg_end_copy($dbh), which syncs the data. Can another pg_exec
call be made for a SELECT statement before the COPY is over? My script
seems to hang at the point of the first SELECT.


You'd have to open a second database connection to issue the SELECT on.
Your first one is tied up doing the COPY (the connection protocol is
not multi-threaded or anything like that).

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jonathan Bishop | last post by:
Hi. We are using MSDE2000 on a Point of Sale application. We need to keep a copy of a few key tables as up to date as possible for backup purposes. We are looking at using triggers over the...
4
by: jimh | last post by:
I'm not a SQL expert. I want to be able to write a stored procedure that will return 'people who bought this product also bought this...'. I have a user table that links to a transaction table...
4
by: banz | last post by:
Hello I have a problem to resolve: I wrote a Perlscript which caches data from a server (local on my machine) I would like to have a other connection to a remote server but I don't know how to...
1
by: Ryan | last post by:
Hello, I have a quick question (I hope). I have a form with a combo box and a multi-selection list box. The list box is based on a query. Users can select values from the cmbobox to add to...
6
by: ransoma22 | last post by:
I developing an application that receive SMS from a connected GSM handphone, e.g Siemens M55, Nokia 6230,etc through the data cable. The application(VB.NET) will receive the SMS automatically,...
1
by: Matik | last post by:
Hi to all, Probably I'm just doing something stupid, but I would like you to tell me that (if it is so), and point the solution. There ist the thing: I' having a sp, where I call other sp...
3
by: cachaco87 | last post by:
Hi, I'm new to this boards, and I need some help finishing a project for school. Im using nested if-statements inside a while loop to execute different actions. action C consist of printing the...
1
by: Caroline M | last post by:
Hi there, I am developing an XML-based messaging application that has to support several versions of the message specification. The way I am doing that is by using XSLT to transform messages...
9
by: shakilalig | last post by:
Hi All, I am writing an XSL to transform the XML to XML.Only change i need in xml is to add the value for the price element under book tag for which publisher location is "World". The...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.