dimanche 29 août 2021

Why shoudl I resize a std::vector passed to SOCI for bulk fetching?

In the SOCI manual it mandates that the vector bound to the statement to populate data should be resized at every bulk fetch iteration. I guess this is analogous to a DB statement that cannot be read multiple times. By the time we finish reading the bound vector its size has become 0. My question is, since we are binding an std::vector to SOCI (a data structure capable of multiple reads in desired directions), does this have to be? Is SOCI trying to mimic the database statement behavior, or is this a technical requirement?

My question stems form the angle, if we could use this vector for processing the data we fetch, it will reduce one copy operation from the bound vector to program data structures. Since we are already talking about bulk operations, if this is a possibility, it will be a massive saving.

Aucun commentaire:

Enregistrer un commentaire