On Tue, 26 Jun 2012 11:10:14 +0100 Neil Morgenstern <neil.morgenstern.2...@gmail.com> wrote:
NM> On Mon, Jun 25, 2012 at 3:29 PM, Vadim Zeitlin <vz-s...@zeitlins.org> wrote: NM> NM> > NM> Definitely not, out parameters are part of the parameter set, not part NM> > of NM> > NM> the result set. NM> > NM> > Sorry, "definitely not" what? NM> > NM> NM> output or input/output parameters should not be implemented with "into" as NM> an into represents a column in a result set, whereas a "use" represents a NM> parameter. I agree that into() is a bad choice for input/output parameters. It's just that I think that use() is a bad choice too. NM> > NM> The ideal way would be use() variations that take (non-const) pointers. NM> > NM> > IMHO this is not ideal at all. When you have a local (hence non-const) NM> > variable that you're writing to the database you absolutely don't expect it NM> > to be modified in the process of being saved. NM> NM> An output parameter is intended to be written to. Non-const references NM> would conflict with a lot of the current code. There is currently no use() NM> that takes a pointer so it would be an addition to the code and not break NM> anything that works now. Formally you're right but I think the difference between use(T&) and use(T*) is not significant enough to use them for two very different behaviours. NM> > Ideal would be to clearly distinguish between input and input/output NM> > parameters and this would require a new syntax. NM> > NM> We used an additional flag to indicate if it is input/output rather than NM> just output. In our case though I don't think it ever was. use() could be NM> implemented to take more than one parameter so something like: NM> NM> use( T * x, bool isInOut = false, bool isNull = false ) Sorry but I think this is horrible syntax. First of all, it's completely unreadable: what does "use(x, false, true)" mean, quickly? And are sure you didn't mix it up with "use(x, true, false)"? Second, it's inconsistent: SOCI (quite nicely, IMHO) uses indicators instead of boolean isNull parameters and this is just fine and I don't see any reason to change it. Anyhow, once again, I don't have any plans to implement this but I still believe that the cleanest way would be to add a new inout() function. It's perfectly backwards compatible and "inout(x, indicator)" is immediately understandable, unlike "use(x, true, true)". Regards, VZ
pgpFcnO0x03bq.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 Soci-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/soci-users