
Hi, I'd like to solicit interest in the following brief proposals for inclusion in the Boost library. cla (Command-Line Arguments) - A generic C++ framework for parsing command-line arguments. The library design would be based on the popt (http://www.rpm.org/dark_corners/popt/) library. uom (Units Of Measure) - A generic C++ framework for arithmetic calculations and conversions between different units of measure. The library design would be based on The Units Of Measure Library (http://tuoml.sourceforge.net/). Questions and comments welcomed. Thanks, Eric.

On Wed, 6 Oct 2004 11:50:28 -0700, Lemings, Eric B. <eric.lemings@ngc.com> wrote:
I'd like to solicit interest in the following brief proposals for inclusion in the Boost library.
cla (Command-Line Arguments) - A generic C++ framework for parsing command-line arguments. The library design would be based on the popt (http://www.rpm.org/dark_corners/popt/) library.
There is a program_options library which will be in Boost 1.32
uom (Units Of Measure) - A generic C++ framework for arithmetic calculations and conversions between different units of measure. The library design would be based on The Units Of Measure Library (http://tuoml.sourceforge.net/).
I also keep reading about a "physical quantities" library floating around... -- Caleb Epstein caleb.epstein@gmail.com

"Caleb Epstein" <caleb.epstein@gmail.com> wrote
uom (Units Of Measure) - A generic C++ framework for arithmetic calculations and conversions between different units of measure. The library design would be based on The Units Of Measure Library (http://tuoml.sourceforge.net/).
I also keep reading about a "physical quantities" library floating around...
Maybe you mean mine? info: http://www.servocomm.freeserve.co.uk/Cpp/physical_quantity/index.html New version pqs-2-00-02 . (Documentation getting better, though still some way to go). download: http://www.servocomm.freeserve.co.uk/Cpp/pqs-2-00-02/download.html (includes WTL 'Canvas' *app* which is err...hmm a bit Rough! :-) ). regards Andy Little

I have been working on a library for database programming. It currently wraps only ODBC API, though the same interface will be able to be created over the ADO API as well. It appears that the MySQL and PostgreSQL would be fairly straight forward to wrap as well, though I do not know those API's (yet). The core goal is to reduce the amount of overhead and boilerplate code that database programming currently requires. I wanted the type safety and speed of statically typed recordsets without resorting to "each recordset is a whole new class" that is so common typesafe ODBC and IADORecordBinding (ADO) based recordsets. On the other hand, latebound "variant" based recordsets (ADO) are somewhat painful to use in a strongly typed language like C++, and inevitably result in quite a bit of code. Common relational database concepts apply across all of the various database API's, and it should be possible to encapsulate them all in a way that allows flexibility in what is used underneath, with few in client code. The core of the interesting piece is the recordset/statement, as connection and such are pretty standard. The implementation uses mpl and tuples to avoid the need to create a ton of new classes and complicated bindings. It also uses traits to directly map C++ types to the correct ODBC bindings without any extra work for the client. The syntax for declaring the a statement is: odbc_statement< mpl_typelist, (query/stored procedure parameter types) mpl_typelist, (recordset column types) mpl_typelist (options typelist (optional template parameter) ) > Some sample code: odbc_statement< mpl::list0<>, // same semantics with mpl::void_ or tuples::null_type mpl::list< int, char[50] > > my_stmt ; std::string sql_stmt_text = "SELECT employeeID, lastName from Employees " "ORDER BY employeeID " ; my_stmt.open( my_connection, sql_stmt_text ) ; while ( my_stmt.move_next() ) { // do stuff } odbc_statement< mpl::list< int, char[50] >, mpl::void_ > my_stmt ; std::string sql_stmt_text = "INSERT INTO Employees (employeeID,lastName) VALUES( ?, ? )" my_stmt.parameter<0>() = 50 ; my_stmt.parameter<1>() = "Jones" ; my_stmt.open( my_connection, sql_stmt_text ) ; odbc_statement< mpl::list< int, int >, mpl::list< int, char[50] >, mpl::list< forward_only, read_only, bulk_row<10> > > my_stmt ; std::string sql_stmt_text = "SELECT employeeID, lastName from Employees " "WHERE employeeID BETWEEN ? AND ? " "ORDER BY employeeID " ; my_stmt.parameters() = tuples::make_tuple( 1, 10 ) ; my_stmt.open( my_connection, sql_stmt_text ) ; odbc_statement< mpl::list< int, out_param<char[50]> >, mpl::void_ > my_stmt ; std::string sql_stmt_text = "{ CALL GetLastNameByID( ?, ? ) }" my_stmt.parameter<0>() = 50 ; my_stmt.open( my_connection, sql_stmt_text ) ; std::string last_name = my_stmt.parameter<1>() ; Would there be any interest in including this in boost? Thanks, Tito Villalobos

"Tito Villalobos" wrote:
I have been working on a library for database programming. It currently wraps only ODBC API,...
Can you compae it with Database Template Library http://dtemplatelib.sourceforge.net/index.htm ? /Pavel

On Tue, 12 Oct 2004 21:54:21 -0400, Tito Villalobos wrote
I have been working on a library for database programming. It currently wraps only ODBC API, though the same interface will be able to be created over the ADO API as well. It appears that the MySQL and PostgreSQL would be fairly straight forward to wrap as well, though I do not know those API's (yet).
Their are ODBC drivers for mysql available and I think Postgres as well. http://dev.mysql.com/downloads/connector/odbc/3.51.html So I think ODBC is clearly the right first target.
The core goal is to reduce the amount of overhead and boilerplate code that database programming currently requires. I wanted the type safety and speed of statically typed recordsets without resorting to "each recordset is a whole new class" that is so common typesafe ODBC and IADORecordBinding (ADO) based recordsets. On the other hand, latebound "variant" based recordsets (ADO) are somewhat painful to use in a strongly typed language like C++, and inevitably result in quite a bit of code. Common relational database concepts apply across all of the various database API's, and it should be possible to encapsulate them all in a way that allows flexibility in what is used underneath, with few in client code.
Yes, agreed.
The core of the interesting piece is the recordset/statement, as connection and such are pretty standard. The implementation uses mpl and tuples to avoid the need to create a ton of new classes and complicated bindings. It also uses traits to directly map C++ types to the correct ODBC bindings without any extra work for the client.
The syntax for declaring the a statement is:
...snip code...
The one concern I have is that many db applications require runtime schema discovery as well as data returns -- so I think the compile time approach is limited to a particular class of applications that can be fully specified at compile time. DTL has dynamic views and integrates well with STL collections, so at some level they are setting the standard on this currently. Another interesting area of exploration for this would be integration with boost.multi_index.
Would there be any interest in including this in boost?
Yes, we really need a standard well thought out approach to accessing databases in C++. Jeff

Lemings, Eric B. wrote:
Hi,
I'd like to solicit interest in the following brief proposals for inclusion in the Boost library.
cla (Command-Line Arguments) - A generic C++ framework for parsing command-line arguments. The library design would be based on the popt (http://www.rpm.org/dark_corners/popt/) library.
uom (Units Of Measure) - A generic C++ framework for arithmetic calculations and conversions between different units of measure. The library design would be based on The Units Of Measure Library (http://tuoml.sourceforge.net/).
You might also want to look at the extensible UCAR udunits C-library for ideas/possibilities et al. The benifit here is that it's extensible by users using a text database of relations. On the downside, it's cumbersome to use. Nonetheless, here's a URL of the manpage: http://my.unidata.ucar.edu/content/software/udunits/man.php?udunits+3 This library can be downloaded with source code.
Questions and comments welcomed.
Thanks, Eric.
-- Manfred Doudar MetOcean Engineers
participants (7)
-
Andy Little
-
Caleb Epstein
-
Jeff Garland
-
Lemings, Eric B.
-
Manfred Doudar
-
Pavel Vozenilek
-
Tito Villalobos