Using a DB with C++ is a real mess and it was refreshing when I moved to Java to be able to use a unified system to abstract the whole layer away (aka Hibernate).
There
There is now a completely in C++ written Hibernate layer. You can find it at github at edwig/CXHibernate. It comes with full written documentation.