Skip to content

Biting the hand that feeds IT

The Register ®

Software:


Related Whitepapers

[Print][Mobile][Alerts]

The database abstraction framework strikes back

Part 2: C++ Generic Coding

Page: < Prev 1 2 3
Published Wednesday 22nd November 2006 10:33 GMT

The (potentially) finished framework starts here!

So, here's the code we've generated, complete with a makefile and a vc project file. If you're not convinced, then compile the associated code and run it against a database! If people are interested, this is an open source project (available on SourceForge.net here), as I've implied already; and if anyone wants to help with the transition from a prototype to a real tool then let me know.

The example implementations are in terms of the MySQL database, but they could equally well be implemented in terms of any other interface library, or a database independent interface library – the dependency on MySQL is hidden in the generated cpp files so the database dependency is localised. For the example project, we've submitted the generated code to cvs, but for a real project this would, of course, be questionable.

The link to the Dbi generated source files is here and to the library support code here.

There are some unanswered questions here because of space constraints, so if you find that any of the answers to those posed below would be interesting, please comment or email the author and let us know (comments are, usually, automatically published; emails to the author are only published with explicit permission). We'll probably make them part of future articles. Some possible issues are:

  • How do we ensure that there are no memory leaks given that all the objects are allocated on the heap?
  • Can we do this generically instead of polymorphically?
  • How can we expand this approach to many-to-many relationships?
  • How can we support late binding of objects associated by relationships?
  • How can we support the notion of a strong relationship so that one object exists if and only if another corresponding object exists?
  • How can we expand this approach so as to catch as many breaches of database constraints as possible at compile time? [A "proper" relational database will, of course, enforce such constraints automatically at every access; although some – many - implementations may not – Ed]
Page: < Prev 1 2 3
Track this type of story as a custom Atom/RSS feed or by email.
Previous Article Next Article
whitepaper title

The Register Guides : The status of iSCSI

Now that the hype's abated, have companies backing iSCSI have run out of energy and patience, or is the technology becoming commonplace and accepted?.
whitepaper title

How IT Management Can "Green" the Data Center

This Gartner research provides managers with an outline of the trends affecting datacenters and offers strategies with which to address these changes..
Whitepapers

The MSDN Developer Zone

Top 20 storiesAll The Week’s HeadlinesArchiveSearch