This is similar to cursor_all_tuples/4 except it works on difference list. It is designed to efficiently retrieve a buffer full of tuples for DBMS that support the retrieval of multiple tuples in its API. Otherwise, all the remaining tuples are retrieved one by one and the ResultTuples list constructed. Retrieved is unified with the number of retrieved result tuples. If no tuples match the query, Retrieved will be 0. Each element of the list is a single result tuple. Cursor is a cursor previously created with session_sql_query/4 or session_sql_prepare_query/5. Each tuple in ResultTuples is a structure with the same name and arity as defined by the tuple template when the cursor was created. The predicate converts the result to the type specified in the template, except that NULL values are returned as variables.
If the SQL query have not yet been executed, and it contains no parameters, then the SQL query will first be executed before retrieving the results.
MySQL specific note: MySQL does not support the retrieval of multiple tuples in one go, so for MySQL, this predicate is essentially equivalent to retrieving the results one by one.