|
Boost : |
From: Hajo Kirchhoff (mailinglists_at_[hidden])
Date: 2005-07-27 07:52:43
Hi,
> What I don't like in your approach is that you require that there is a
> type (my_table above) for each different rowset traversal "profile" -
I don't. This is not required, this is merely an example. For small
tables and simple queries its the fastest way. But not the only way.
> interested in only some of the columns - from 2 to 5, typically. Do you
> require that the application always retrieves all columns?
Absolutely not.
odbc::statement s("SELECT column1,column2,etc... FROM ...");
is supported of course.
> Just imagine a single table with 4 columns - there are 15 different
> subsets of columns there (not counting the queries with no columns).
Also there does not have to be a 1:1 relationship between the members in
my_table and the columns of the table. Subsets are fine. In fact, if you
have a table with 150 columns and want to select only a subset of
columns, you have a couple of options with my approach.
a) write a struct ... containing only a few member variables for those
columns you want to select.
b) use individual variables to bind them.
c) all of the above
Another example:
odbc::statement s("SELECT one([bindto]a), two([bindto b), sixteen,
seventeen, eighteen FROM huge_table");
long a, b;
struct some_struct; // has members m_sixteen, ...
some_struct data;
s.bind(a, "a"); // bind variable a to column one
s.bind(b, "b"); // bind variable b to column b
// bind all member variables of 'data' to columns
// of the same name ... if they exist
s.bind(data);
> You does your approach scale in this aspect?
It does.
>
> In my humble opinion, a DB library needs to be usable also with the
> assumption that each query in a program can potentially retrieve a
> *different* set of attributes (columns).
Absolutely.
> http://soci.sourceforge.net/
Interesting approach. I'll probably steal ideas from it.
Thanks for your comments
Hajo
-- -------------------------------------------- Lit Window Library - Speed up GUI coding 10x http://www.litwindow.com/library?src=ml wxVisualSetup - integrate wxWidgets into Visual Studio .NET http://www.litwindow.com/Products/products.html?src=ml BugLister - Defect Tracker http://www.litwindow.com/buglister?src=ml Tips & Tricks for wxWidgets & MS Visual Studio http://www.litwindow.com/Knowhow/knowhow.html?src=ml
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk