On Saturday 18 March 2006 12:58, Florian G. Pflug wrote:
> Kevin Brown wrote:
> > So what you're saying is that my commits and rollbacks should be async,
> > correct?
>
> No, you should always use _async(), and never, ever use query() or exec()
> in a multi-threaded app.
>
> > I don't quite understand how a select can be an async call.... I need
> > the data to proceed. If you're saying on my inserts, deletes, etc, then
> > that I can understand.
>
> Don't be fooled by the word async()... It's still synchronous for the
> thread that calls it - the _thread_ is blocked until the query is done,
> and query_async() returns the result, just as query() does. The difference
> is only for all _other_ threads. All other threads can continue to run
> while the one thread waits for query results _only_ if the one thread
> used query_async(). If it used query(), then you _whole_ interpreter is
> blocked until the query is finished.
OH. Thank you! :-)
> The naming of these function is quite strange - I was fooled by this
> myself, and so was whoever wrote the DBD-module for pg, because he used the
> non-async functions too ;-)
Yeah, I only want the thread to wait, and async sounds like asynchronous or
something. :-)
> To rephrase - you don't usually need to change anything in your program
> when using query_async() instead of query(). It'll just work better ;-).
Makes sense now.
> greetings, Florian Pflug