Bug #13432 C API: sending a group of rows at a time
Submitted: 23 Sep 2005 16:05 Modified: 13 Oct 2005 18:37
Reporter: Jacek Becla Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S4 (Feature request)
Version:ANY OS:Any (ANY)
Assigned to: CPU Architecture:Any

[23 Sep 2005 16:05] Jacek Becla
Description:
Currently one can either send one row at a time via C API from server to client, or all the rows in one chunk (mysql_store_result()). For larger data volumes that is not sufficient: sending one row at a time is inefficient, and sending all rows at a time is not an option because the result is too big. It would be useful to be able to send a group of rows at a time (size of the group should be configurable).

How to repeat:
N/A
[23 Sep 2005 16:14] Andrey Hristov
That's already possible with Server-side cursors. A SS cursor is a prepared statement which has special attribute - cursors. Cursors support parallel execution of several queries as well as fetching in bunches.
Use mysql_stmt_attr_set() on a PS to make it cursor STMT_ATTR_CURSOR_TYPE, with value CURSOR_TYPE_READ_ONLY. Number of prefetched rows with STMT_ATTR_PREFETCH_ROWS.

(libmysql.c)
[13 Oct 2005 18:37] Paul DuBois
See:

http://dev.mysql.com/doc/refman/5.0/en/mysql-stmt-attr-set.html

For an example program that uses this feature, see
tests/mysql_client_test.c in a MySQL 5.0 source distribution.