Re: Stdio.Buffer.set_buffer_mode revisited
"Stephen R. van den Berg" <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <[email protected]> |
Stephen R. van den Berg wrote:
>The current driver supports things like:
>db=Sql.Sql("pgsql://...."); // returns immediately because the connect
> // and handshake happens in the background
>res1=db->big_query("SELECT 1..."); // returns immediately before the query
> // has even delivered the first row
>res2=db->big_query("SELECT 2..."); // As above
>res3=db->big_query("SELECT 3..."); // As above
> // The following statements will fetch rows from
> // the appropriate queries as soon as the row arrives
> // from the database; the resultset is never prefetched
> // from the database in full. The driver dynamically
> // determines how many resultrows to prefetch
>res3->fetch_row();
>res2->fetch_row();
>res1->fetch_row();
>res2->fetch_row();
>res3->fetch_row();
Ah yes, and I forgot to mention that the new driver supports running
all of the above commands in an arbitrary number of threads. I.e. you can
open the database in one thread, do big_query in others, and fetch rows on
a single object in multiple threads simultaneously (you'll only get every
row once). It all works over a single filedescriptor to the database.
--
Stephen.