OCILIB C++ API coming soon !
Hello all !
OCILIB C++ API is coming soon ! Thus OCILIB will become a C and C++ driver for Oracle Code is already available from the OCILIB SVN repository. It is a single C++ header file that wraps the entire OCILIB C API . It uses and exposes C++ objects and is based on the standard library and templates. No usage of new or delete, just objects that automatically handle the lifetime of OCILIB handles :) Automatic and built-in object scope management ! I’m still working on the documentation C main demo application and various C demos have been ported to C++.
Just have a look and try it :)
here is a basic example :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "ocilib.hpp"
using namespace ocilib;
int main(void)
{
try
{
Environment::Initialize();
Connection con("db", "usr", "pwd");
Statement st(con);
st.Execute("select * from products");
Resultset rs = st.GetResultset();
while (rs.Next())
{
std::cout << "code:" << rs.Get<int>(1) << " name: " << rs.Get<dstring>(2) << std::endl;
}
std::cout << "=> Total fetched rows : " << rs.GetCount() << std::endl;
}
catch(Exception &ex;)
{
std::cout << ex.GetMessage() << std::endl;
}
Environment::Cleanup();
return EXIT_SUCCESS;
}