From fdc551f283b2cb28366bf0a4cfe6ae6085894a4d Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 29 Jan 2025 04:19:07 +0100 Subject: [PATCH] Make it more clear that output vectors must have non-zero size Also mention that they need to be re-resized inside the loop every time before using them. Closes #1160. --- docs/binding.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/binding.md b/docs/binding.md index 5007520b..4ee77476 100644 --- a/docs/binding.md +++ b/docs/binding.md @@ -144,8 +144,7 @@ v.resize(100); sql << "select ...", into(v); ``` -In the latter case the initial size of the vector defines the maximum number of data elements that the user is willing to accept and after executing the query the vector will be automatically resized to reflect that actual number of rows that were read and transmitted. -That is, the vector will be automatically shrunk if the amount of data that was available was smaller than requested. +In the latter case the initial size of the vector defines the maximum number of data elements that the user is willing to accept, and so must be non-zero and, usually, relatively big for optimal performance. After executing the query the vector will be automatically resized to reflect that actual number of rows that were read and transmitted, i.e. the vector will be automatically shrunk if the amount of data that was available was smaller than requested. Note that this means that when performing a bulk operation in a loop, the vector needs to be resized during each loop iteration. It is also possible to operate on the chosen sub-range of the vector: