Home | My Gallery | Jacob's Gallery | Ora++ | Ruby9i | Launchpad
Note: Links on this page have been broken for a while, but they have been fixed. I apologize for the problems that everyone has been having.
Ora++ is a set of C++ classes wrapped around the Oracle Call Interface (OCI). They provide an object-oriented interface to Oracle similar to other OO interfaces like JDBC or PERL.
A simple query using Ora++ looks like this:
Connection db("user/pass@db");
Varchar name("Fred");
Select_Stmt st(db);
st << "SELECT City, State \
FROM Friends \
WHERE Name = " << bind(name);
while(st.fetch())
cout << st["CITY"] << ", " << st["STATE"] << endl; |
Here is a slightly more elaborate--but no less contrived--example:
// create connection
Connection db("/");
// prepare billing query
Select_Stmt sel_billing(db, "\
SELECT Customer_ID, Amount \
FROM Billings \
WHERE Status = 'PAID'");
Rowtype row;
sel_billing.bind_col(row);
// prepare update to account
Non_Sel_Stmt upd_account(db);
upd_account << "\
UPDATE Account \
SET Paid_To_Date = NVL(Paid_To_Date, 0) + " << bind(row["AMOUNT"]) << " \
WHERE Customer_ID = " << bind(row["CUSTOMER_ID"]);
// for each billing record that is paid...
while (sel_billing.fetch())
// ...update the customer record
upd_account.exec(); |
I wrote the initial version of this library over a weekend after wrangling with Pro*C in a C++ environment. Being somewhat of an idealist, I was frustrated by being forced into an anti-OO way of doing things. Since I could not find something similar on the Internet, I decided to write my own.
This library is currently in use in a production environment at a major insurance provider.
If you would like more information about how to use Ora++, see the user guide. It has been updated for version 1.2.0 but is still missing some details, such as information about the bind() manipulator's support classes and functions. I also plan to add example code as time allows.
The Ora++ Library is licensed under the GNU Lesser General Public License, and the documentation is licensed under the GNU Free Documentation License.
You may view the current change log.
| Version | Release Date |
|---|---|
| 1.2.1 | 24-Mar-2001 |
| 1.2.0 | 16-Mar-2001 |
| 1.1.0 | 3-Jan-2001 |
| 1.0.0 | 2-Oct-2000 |
You may download the source code above or the documentation as HTML or SGML (DocBook DTD). I would appreciate any feedback you might have.
Last modified August 19, 2002 11:50 pm GMT. Send comments to webmaster@jimcain.us.