[OT] Re: Binding rvalues to const ref in D
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Thu Oct 20 06:33:31 PDT 2016
On 10/20/16 2:38 AM, Nick Sabalausky wrote:
> On 10/19/2016 07:04 PM, Chris Wright wrote:
>>
>> Right. For instance, binding query parameters with mysql-native. The
>> thing you're binding is passed by reference and I'm not sure why.
>>
>
> It's been like that since mysql-native's original release, by the
> original author, some years ago.
>
> I suspect the idea was a rudimentary ORM-like approach: to have the
> prepared statement params semi-permanently tied to actual variables (ie,
> "bound" to them). Ie, so you could re-exectute the same prepared
> statement with different values just by changing the values and calling
> `execPrepared` again, without calling any of the bind functions again.
>
> I'd have to check whether or not that usage pattern currently works though.
>
Yes, it does work. However, one thing that I *sorely* miss is the
ability to simply bind an individual value.
At the moment, in order to bind a value, you have to pass an array of
Variant for all the values. I currently have a whole wrapper around this
library to make it more palatable, and to fix the lifetime issues.
-Steve
More information about the Digitalmars-d
mailing list