cpdo  Update of "cpdopp"

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview

Artifact ID: 50cea121708f13d4cff0e3493ef404feb3338f5d
Page Name:cpdopp
Date: 2011-05-17 18:39:29
Original User: stephan
Parent: 696186b5cf7fa6ed52f8b3f8e9663f5c5e8ad445
Content

ACHTUNG: THE CPDO WIKI IS NOW (AS OF 2011-May-17) MAINTAINED ON A DEDICATED WIKI SITE: http://whiki.wanderinghorse.net/wikis/cpdo/?page=cpdopp

As of 20110210, cpdo includes a C++ wrapper API. It is really easy to use...

#include "wh/cpdo/cpdo.hpp"
...

cpdo::driver * drv = new cpdo::driver("sqlite3:/path/to/db.sqlite3");
...
cpdo::stmt st( drv->prepare("SELECT * FROM t") );
// Note that cpdo::stmt is a std::auto_ptr-like convenience class
// for managing cpdo::statement pointer lifetime, and thus we
// use the '->' operator even though 'st' isn't a pointer...
while( st->step() ) {
   std::cout << st->get_int32(0) << '\n';
}
st.finalize(); // might not be necessary: see the API docs.
               // We use it here because the statement must be
               // finalized before we do this:
delete drv;

The main usage difference between the C and C++ APIs is that the C++ wrapper throws exceptions (cpdo::exception, which derives from std::exception) for the vast majority of error cases. See the API docs for the details and the small handful of functions which do not throw.