Thanks for the quick reply
Sent from myMail for iOS
Wednesday, January 20, 2016, 6:37 AM -0700 from hauk@tildeslash.com hauk@tildeslash.com: I’m not sure what you mean by record number? If you mean the number of rows in a result set or the current row number, the answer is the same, this is not available. The reason is that Result Sets are not fetched in one operation, but row by row, at least in the API level. [1]
There are probably a few ways to solve this, in SQL you could do a count() or similar to get the number returned and in code you can maintain a counter like so:
uint64_t i; for (i = 0; ResultSet_next(result); i++) { const char *name = ResultSet_getString(result, 1); printf(“Row number: %lld\n”, i); } printf(“Total Rows: %lld\n”, i);
1. For MySQL, iterating over a result set is literarily done by fetching row-by-row. The idea is to save memory, but for large result sets, iterating can be detrimentally slow. We have two open issues, both addressing this https://bitbucket.org/tildeslash/libzdb/issues?status=new&status=open and I’m planing to change this so result sets are fetched in bulk and stored locally in memory to speed up the process.
On 20 Jan 2016, at 04:19, Chengyu Fan <chengyu.fan@hotmail.com/compose?To=chengyu.fan@hotmail.com> wrote:
Hi,
Does anyone know how to get the record number from the query results using libzdb? I did not find such API in the manual.
Thanks, Chengyu
-- To unsubscribe: http://www.tildeslash.com/mailman/listinfo/libzdb-general