Branch: Tag:

2017-11-23

2017-11-23 11:16:20 by Stephen R. van den Berg <srb@cuci.nl>

Sql.FutureResult: Polish docs and internals; uses status_command_complete instead of exception.

1224:    return res;   }    - //! Sends a query to the database asynchronously, discards all query result - //! records. + //! Sends a typed query to the database asynchronously, discards all query + //! result records.   //!   //! @returns   //! A @[Concurrent.Future] object which on failure/success passes
1241:    return p->future();   }    - //! Sends a query to the database asynchronously, expects at least - //! a single record from the database; will discard any further - //! records. + //! Sends a typed query to the database asynchronously, expects at least + //! a single record from the database (will fail otherwise); + //! will discard any further records.   //!   //! @returns   //! A @[Concurrent.Future] object which on failure/success passes
1259:    return p->future();   }    - //! Sends a query to the database asynchronously, expects at least - //! a single record from the database. + //! Sends a typed query to the database asynchronously, expects at least + //! a single record from the database (will fail otherwise).   //!   //! @returns   //! A @[Concurrent.Future] object which on failure/success passes
1276:    return p->future();   }    - //! Sends a query to the database asynchronously. + //! Sends a typed query to the database asynchronously.   //!   //! @returns   //! A @[Concurrent.Future] object which on failure/success passes
1290:   //! @code   //!   //! Sql.Connection db = Sql.Connection("..."); - //! Concurrent.Future q1 = db->promise_query("SELECT :bar::INT", (["bar":1])); + //! Concurrent.Future q1 = db->promise_query("SELECT 42");   //! Concurrent.Future q2 = db->promise_query("SELECT :foo::INT", (["foo":2]));   //!   //! array(Concurrent.Future) all = ({ q1, q2 });   //! - //! /* - //! To get a callback for each of the requests - //! */ + //! // To get a callback for each of the requests   //!   //! all->on_success(lambda (Sql.FutureResult resp) {   //! werror("Got result %O from %O\n", resp->data, resp->query);   //! });   //! all->on_failure(lambda (Sql.FutureResult resp) { - //! werror("Request %O failed: %O\n", resp->query, resp->exception); + //! werror("Request %O failed: %O\n", resp->query, + //! resp->status_command_complete);   //! });   //! - //! /* - //! To get a callback when all of the requests are done. In this case - //! on_failure will be called if any of the request fails. - //! */ + //! // To get a callback when all of the requests are done. In this case + //! // on_failure will be called if any of the requests fails.   //!   //! Concurrent.Future all2 = Concurrent.results(all);   //!
1317:   //! werror("All requests were successful: %O\n", resp);   //! });   //! all->on_failure(lambda (Sql.FutureResult resp) { - //! werror("Requests %O failed with %O.\n", resp->query, resp->exception); + //! werror("Requests %O failed with %O.\n", resp->query, + //! resp->status_command_complete);   //! });   //! @endcode   public Concurrent.Future promise_query(string q,