SOCI / soci

Official repository of the SOCI - The C++ Database Access Library
http://soci.sourceforge.net/
Boost Software License 1.0
1.37k stars 472 forks source link

Backend Oracle C++ Call Interface (OCCI) #1030

Open lucas29252 opened 1 year ago

lucas29252 commented 1 year ago

We are migrating a quite large project (>1M LOC) to use SOCI. It has tight dependencies with Oracle C++ Call Interface (OCCI) and due to the project architecture the same oracle::occi::Session object has to be used in the whole request lifecycle. We could replace it with soci::session, but since we want to make small changes and gradually move to SOCI we need to make a OCCI backend.

So we forked this repo and made changes in release/4.0 branch (the project is based on C++11 and we have no plans to upgrade it). It is not a backend fully based on OCCI. Only session-level classes provides native access to OCCI's oracle::occi::Environment and oracle::occi::Session classes. statement_backend is not based on OCCI, so there is no access to OCCI's oracle::occi::Statement class. It only uses the minimum from OCCI which allow us to start replacing its connections. Hopefully, at the end of the project, there would be no need to this new backend and it will be replaced by Oracle backend.

Because of the temporary nature of this backend we think there is no need to merge changes in main SOCI repo, but at the same time I wanted everyone to know, just in case there is someone facing the same problem than us.

Thanks for this amazing library! ❤️

vadz commented 1 year ago

Thanks for letting us know, I think it might make sense to make a PR adding support for providing the "external" session object rather than creating it in oracle_session_backend, but I am not really sure about it.

In any case, please don't hesitate to report issues/make PRs if you find other problems or possible enhancements in the Oracle backend, in spite of the name of the library it's one of the lesser used ones, so any extra testing and contributions to it would be even more welcome than usual (and any other contributions are already very welcome!).

lucas29252 commented 1 year ago

Yes, support for providing external session objects (OCIEnv, OCISession, OCIServer and OCISvcCtx) would also be a good solution for our use case.

We'll give it some thought and if it fits our use case we'll make a PR.