pike.git / lib / modules / __builtin.pmod / Sql.pmod / Connection.pike

version» Context lines:

pike.git/lib/modules/__builtin.pmod/Sql.pmod/Connection.pike:1226:      //! Sends a typed query to the database asynchronously.   //!   //! @returns   //! An @[Sql.Promise] object which can be used to obtain   //! an @[Sql.FutureResult] object to evaluate the query.   //!   //! @seealso   //! @[big_typed_query()], @[Sql.Promise], @[Sql.FutureResult]   //! + //! @param map_cb + //! + //! Callback function which is called for every row returned. + //! First parameter is the row, second parameter is the result object + //! being processed, and the third parameter is the array of result rows + //! already collected so far. The function should return the modified + //! version of the row that needs to be stored, or it should return + //! @expr{0@} to discard the row. + //!   //! @example   //! @code   //!   //! Sql.Connection db = Sql.Connection("...");   //! Sql.Promise q1 = db->promise_query("SELECT 42")->max_records(10);   //! Sql.Promise q2 = db->promise_query("SELECT :foo::INT", (["foo":2]));   //!   //! array(Concurrent.Future) all = ({ q1, q2 })->future();   //!   //! // To get a callback for each of the requests
pike.git/lib/modules/__builtin.pmod/Sql.pmod/Connection.pike:1258:   //! Concurrent.Future all2 = Concurrent.results(all);   //!   //! all2->on_success(lambda (array(Sql.FutureResult) resp) {   //! 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->status_command_complete);   //! });   //! @endcode - public .Promise promise_query(string q, -  void|mapping(string|int:mixed) bindings) { -  return __builtin.Sql.Promise(this, q, bindings); + public variant .Promise promise_query(string q, +  void|mapping(string|int:mixed) bindings, +  void|function(array, .Result, array :array) map_cb) { +  return __builtin.Sql.Promise(this, q, bindings, map_cb);   } -  + public variant .Promise promise_query(string q, +  function(array, .Result, array :array) map_cb) { +  return __builtin.Sql.Promise(this, q, 0, map_cb); + }