On Wed, 9 May 2012 11:40:20 +0100 Neil Morgenstern 
<[email protected]> wrote:

NM> This is becoming a discussion though in good programming design and not
NM> SOCI itself.

 Yes, but I'd actually prefer to avoid discussing the general design and
keep the discussion centered on just the SOCI-specific stuff. The example
was dramatically simplified just to make my point, there is really no sense
in reading too much into it, it was only meant to illustrate the question.

NM> You should use a member variable which should be private. Preferably
NM> users of your class will be calling a function not caring how it is
NM> implemented at all, so will have no idea that there is SOCI involved
NM> and possibly not even know it is writing to a database.

 Yes, absolutely. But, again, please let's not discuss this, this is really
not what my question was about.

NM> Incidentally you might wish to measure the performance before you try to
NM> optmise because rebinding a parameter is unlikely to be expensive in
NM> reality, it is just assigning a value to some local memory and will be
NM> trivial in the overall scheme of things.

 Yes, but the question is exactly about how to rebind it. Currently I don't
see any way to do it using SOCI API, hence I need to use some fixed address
(whether it's static, member or global is really irrelevant) and copy
values to/from it. And copying is really not attractive, not because of
performance considerations (which should be trivial), but just because it's
a lot of extra dumb code to write.

NM> The overhead of making the call is going to be the main expense and if it
NM> is called a lot and you don't need the results written instantly you could
NM> buffer a few values up then use the vector method of executing.

 Yes, all completely true. But there are still situations when I access a
table many times during the program life time selecting different elements
from it without knowing which ones in advance, so buffering is not
possible. Preparing the statement is, of course, not very expensive
compared to the cost of database call itself but I still thought that it
would be nice to avoid doing it repeatedly unnecessarily and would prefer
to prepare the statement just once. However doing this without being able
to rebind the variables used in the statement is too inconvenient to
consider.

 So, the question is/remains: is it somehow possible to rebind the
parameters used (in the sense of both "used()" and "into()") by an existing
prepared statement?

 Thanks again,
VZ

Attachment: pgpvqHs4DlGkC.pgp
Description: PGP signature

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Soci-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/soci-users

Reply via email to