|
Boost : |
From: Corwin Joy (cjoy_at_[hidden])
Date: 2005-08-22 22:49:13
>> On Behalf Of Caleb Epstein
>> * Binding. Some vendors provide APIs whereby query results can be
>> directly bound to program variables. The general workflow would be
>> something like:
>>
>> double price;
>> std::string name;
>>
>> row_set results = database.execute (query);
>>
>> results.bind ("name", &name);
>> results.bind ("price", &price);
>>
>> for (row_set::iterator i = results.begin (), e = results.end ();
>> i != e && results.fetch (); ++i) {
>> std::cout << "name=" << name << ", price=" << price <<
> std::endl;
>> }
>>
>> This saves the variant<> conversion overhead and can be extended to
>> include user-defined types and conversions. Would you be open to
>> including this in the implementation?
>
> I don't know if this would need to be wired into the implementation; I
> think we could easily build it on top of our interface though.
If you are careful about how you do the bindings class and you keep it
independent of what kind of row object you are binding to then you can have
it easily bind to either a statically defined struct to hold the row or a
variant_type row that holds dynamic types. Either way, I think it is
definitely important to have not variant type binding because:
1. You often want to bind to a particular type to hold your result to the
correct precision.
2. Speed. It has not been mentioned yet but an important feature to have is
bulk operations since these can often be 100x faster than operating
row-by-row. To do this, drivers typically bind to a block of known types.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk