C++ and object databases

This example uses the ODMG C++ Binding and the ODMG Object Query Language (OQL). Other C++ bindings and query languages for object databases would be similar. Notice that all the code is C++, with the exception of the query string. You will not find a database sub-language in this example. The part in blue relates to the animation of transparent persistence (new window). More information on the ODMG specification (new window). Note that the same code would used for object-relational mapping products (new window). Transparent persistent interfaces work with both object database or object-relational mapping products.

d_Database db;
d_Transaction txn;
try {
    db.open("addressDB");
    txn.begin();
    // perform query
     d_OQL_Query query(
         "select x from Person x where x.name = \"Doug Barry\"");
    d_Bag<d_Ref<Person> >   allDougBarrys;
    d_oql_execute(query, allDougBarrys);
    d_Iterator<d_Ref<Person> > iter = allDougBarrys.create_iterator();
    // iterate over the results
    d_Ref<Person> p;
    while( iter.next(p) ){
       // do some addition processing on the person (not shown)
       // now traverse to the address object and update its value
       p->address.street = "13504 4th Avenue South";
    }
    txn.commit();
    db.close();
}
//exception handling would go here ...

 

Web Services and Service-Oriented Architectures
Online articles>
Consulting
Mentoring
Speaking
Suggested programs
Stencils for the Savvy Manager's Guide
Links
Mail list
Privacy policy
Sitemap
Contact
Web Services articles
XML standards and vocabularies
Application server articles
Database concepts and standards
Object database articles>
Relational database articles
Object-relational mapping articles
XML database articles
XML middleware articles
Article Sponsorship
Reprint policy
Object-oriented database management system (OODBMS) definition>
When an object database should be used
ODBMS FAQ
Caching for object database management systems
Architectures that use object database products
Everyday uses of object databases
ODBMS myths
Object database problems?
Article suggestions
Transparent persistence
Lack of impedance mismatch
How to access data in an object database>
Navigation with an object database
Java and object databases
JDO and object databases
C++ and object databases>

Related recent articles from Google News


ReadWriteWeb

The American Dream: 17 Years of Engineering Software
ReadWriteWeb, CA - Apr 13, 2008
The program would process quotes from the exchange and write them to an object database called Object Store at the rate of 2000 per second. ...

Programming languages and "lock-in"
Free Software Magazine - Apr 17, 2008
However, Gnome is written mostly in C, using the GTK+ library, while KDE is written in C++, using the Qt library. This distinction, more than any cultural ...

More related news: C++ "object database" OR "object-oriented database" - Google News

 

Copyright © 2000-2008 Barry & Associates, Inc. All Rights Reserved.
You can use this material for your work or classes. Click here for our reprint policy.
www.service-architecture.com

 

 Information on becoming a sponsor

 

 

Google

 

Barry & Associates, Inc.