Mercurial > dovecot > core-2.2
diff src/lib-sql/sql-api-private.h @ 22354:b9a2a6135419
lib-sql: Add API support for asynchronously iterating over rows.
sql_query() can already do an async lookup, but the full result needs
to be available immediately. This can be inefficient for large results.
Add a new SQL_RESULT_NEXT_MORE return value and sql_result_more() for
asynchronously requesting more results.
This changes the API a bit, but isn't done by default by any drivers yet.
Also callers that can't handle this are hopefully checking for "ret < 0",
which allows them to handle such an async-more request as an error
instead.
sql_result_next_row() will be changed to return enum in a separate commit to
keep backwards compatibility in v2.2.x.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Mon, 17 Jul 2017 14:22:35 +0300 |
parents | b885fee56a82 |
children | 7d189977dfe3 |
line wrap: on
line diff
--- a/src/lib-sql/sql-api-private.h Thu Jul 06 12:40:33 2017 +0300 +++ b/src/lib-sql/sql-api-private.h Mon Jul 17 14:22:35 2017 +0300 @@ -126,6 +126,8 @@ const char *const *(*get_values)(struct sql_result *result); const char *(*get_error)(struct sql_result *result); + void (*more)(struct sql_result **result, bool async, + sql_query_callback_t *callback, void *context); }; struct sql_field_map {