Re: Non-blocking queries in postgresql
Bruce Momjian wrote:
Thank you very much for the response of the other mail i`ve sent.
I want to make you a very important question. This is criticalfor
my pourposes and i cannot find a clear answer in the documentation
of
postgres.
There is a capability in Oracle that allows you to make
"non-blocking queries". That`s it. The normal query from a program,
throw an API to the DBMS, opens a socket, and waits untill theresponse
comes. But the other way, returns the control inmediatly and the
user
must poll on this socket to know when the answer comes.
My english is poor, but i hope you`ve understood what i`mtalking
about. If it is not allowed in postgres i cannot use it as my
database.
I have to make queries to other machines, and i cannot wait untill
the
connection is made, and the response comes.
There is PQexec and i want to know how i could make a PQexecNB
(non-blocking). In Oracle this is the diference of the two funcioncalls
to the API.
New feature in 6.4.*. See the libpq manual under async. You can send
a
query and poll to see when the result is ready. See PQsendQuery() C
function call. Also mention in the manuals in the docs directory.
You
can also use C function select() to wait for data from any number of
concurrent backend sockets.-- Bruce Momjian | http://www.op.net/~candle maillist@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026Thank you very much!!!
But I have a llitle problem. I`m afraid that the lipq++ interface
doesn't have this funcion call. Is it true?
Have you got any examples of the using of PQsendQuery and Non Blocking
queries using this interface lipq or libpq++? I will be very usefull for
me. Just simply attach it on the response.It would be very appreciated. Thank you again.
Maybe it hasn't been added to libpq++ yet.
--
Bruce Momjian | http://www.op.net/~candle
maillist@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Import Notes
Reply to msg id not found: 36AD687B.9D2D2615@tcpsi.es
But I have a llitle problem. I`m afraid that the lipq++ interface
doesn't have this funcion call. Is it true?
Have you got any examples of the using of PQsendQuery and Non Blocking
queries using this interface lipq or libpq++? I will be very usefull for
me. Just simply attach it on the response.It would be very appreciated. Thank you again.
Maybe it hasn't been added to libpq++ yet.
OK!!! NO PROBLEM!!! BUT I`AM VERY INTERESTED ON FINDING EXAMPLES OF USING
NON-BLOCKING QUERIES with libpq. Do you know where it could be? Have you got
some ones?I`m sorry for asking you too much. Thanks a lot.
Not sure. Forwarding to hackers list.
--
Bruce Momjian | http://www.op.net/~candle
maillist@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Import Notes
Reply to msg id not found: 36AE92FA.907DCE0C@tcpsi.es | Resolved by subject fallback
But I have a llitle problem. I`m afraid that the lipq++ interface
doesn't have this funcion call. Is it true?
Have you got any examples of the using of PQsendQuery and Non Blocking
queries using this interface lipq or libpq++? I will be very usefull for
me. Just simply attach it on the response.Maybe it hasn't been added to libpq++ yet.
Indeed it has not been added to libpq++. (libpq++ desperately needs to
be adopted by some caring soul. None of the current contributors to
Postgres seem to use it, so it's not getting maintained. As long as it
keeps compiling we just ignore it...)
BUT I`AM VERY INTERESTED ON FINDING EXAMPLES OF USING
NON-BLOCKING QUERIES with libpq.
The trouble is that applications that need to do this are usually
non-trivial; I doubt you'll find any simple readily-available examples.
The only such application I've built myself is a C++/Tcl/Tk app
in which the Tcl user interface remains "live" during SQL query execution,
rather than freezing up during each query as it does with libpgtcl's
pg_exec. The idea is to enter a nested Tcl event loop after firing off
a query with PQsendQuery. Checking for the response is done by a Tcl
file handler that creates a special event type when the query is
complete, and execution of that event type sets a flag to get out of the
nested event loop. Meanwhile, regular Tcl events such as keypresses
and mouse actions are responded to by the nested event loop.
It'd be difficult to explain it more fully than that without showing you
large chunks of the application code, which I can't really do because
it's proprietary software :-(.
regards, tom lane
Import Notes
Reply to msg id not found: YourmessageofWed27Jan1999092852-0500199901271428.JAA04708@candle.pha.pa.us | Resolved by subject fallback