Working on OCILIB C++ support


Hello all,

I finally decided to work on a C++ wrapper around OCILIB !

It will be implemented as a single C++ header file that will offer C++ classes wrapping the OCILIB C API…

If the results sounds good, the next OCILIB release will include this C++ header to simplify C++ developper’s life :)

If any of you are interested, drop me a email !!

Here is an example of my early basic implementation :

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
35
    
    #include "ocilib++"
    
    using namespace ocilib;
    
    int main(int argc, char* argv[])
    {
        Environment::Initialize(Environment::EnvironmentDefault);
    
        try
        {
            Connection con("db", "usr", "pwd", Connection::SessionDefault);
            std::cout << con.getServerVersion() << std::endl;
    
            Statement st(con);
            st.execute("select table_name from user_tables");
    
            Resultset rs(st);
            while (rs.fetchNext())
            {
                std::cout << rs.getString(1) << std::endl;
            }
    
            Lob lob(con, Lob::LobTypeClob); 
            std::cout << "char written " << lob.write("test") << std::endl;
            lob.seek(Lob::LobSeekSet, 0);        
            std::cout << lob.read(4) << std::endl;
        }
        catch(Exception &ex;)
        {
             std::cout << ex.what() << std::endl;
        }
            
        Environment::Cleanup();
    }