Re: Non-blocking queries in postgresql
Re: Non-blocking queries in postgresql
От:
Bruce Momjian <maillist@candle.pha.pa.us>
Дата:
> > > 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
Re: [HACKERS] Re: Non-blocking queries in postgresql
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
>>>>>> 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