Explicitly defining handle_first/4 and handle_next/4 is deprecated
because callback implementations that are required to differentiate also
need to track cursors in their state. A single fetch/4 is cleaner to use
and these callbacks forward to handle_fetch/4 on use DBConnection.
For first/next/fetch the return value is {:cont | :halt, result, state}
where :cont is continue (same as :ok) and:haltmeans both that the cursor has finished enumerating results and the cursor is deallocated. Therefore:haltdoes not require adeallocatecall. This API is chosen to avoid an extra roundtrip that current adapters do. handle_first/4 and handle_next/4 still support:okand:deallocate`
tuples.
A callback implementation may need to deallocate if the transaction ends
without a cursor being deallocated (via fetch/4 or deallocate/4).
Explicitly defining handle_first/4 and handle_next/4 is deprecated because callback implementations that are required to differentiate also need to track cursors in their state. A single fetch/4 is cleaner to use and these callbacks forward to handle_fetch/4 on
use DBConnection
.For first/next/fetch the return value is
{:cont | :halt, result, state}
where:cont
is continue (same as :ok) and
:haltmeans both that the cursor has finished enumerating results and the cursor is deallocated. Therefore
:haltdoes not require a
deallocatecall. This API is chosen to avoid an extra roundtrip that current adapters do. handle_first/4 and handle_next/4 still support
:okand
:deallocate` tuples.A callback implementation may need to deallocate if the transaction ends without a cursor being deallocated (via
fetch/4
ordeallocate/4
).