diff options
-rw-r--r-- | odb/option-types.cxx | 44 | ||||
-rw-r--r-- | odb/option-types.hxx | 30 | ||||
-rw-r--r-- | odb/options.cli | 13 |
3 files changed, 87 insertions, 0 deletions
diff --git a/odb/option-types.cxx b/odb/option-types.cxx index da29793..cc4b28b 100644 --- a/odb/option-types.cxx +++ b/odb/option-types.cxx @@ -7,6 +7,7 @@ #include <istream> #include <ostream> #include <algorithm> // std::lower_bound +#include <sstream> // std::ostringstream #include <odb/option-types.hxx> @@ -94,3 +95,46 @@ operator<< (ostream& os, schema_format sf) { return os << sf.string (); } + +// oracle_version +// +istream& +operator>> (istream& is, oracle_version& v) +{ + unsigned short major, minor; + + // Extract the major version. + // + is >> major; + + if (!is.fail ()) + { + // Extract the decimal point. + // + char p; + is >> p; + + if (!is.fail () && p == '.') + { + // Extract the minor version. + // + is >> minor; + + if (!is.fail ()) + { + v.major_ = major; + v.minor_ = minor; + } + } + else + is.setstate (istream::failbit); + } + + return is; +} + +ostream& +operator<< (ostream& os, oracle_version v) +{ + return os << v.major_ << '.' << v.minor_; +} diff --git a/odb/option-types.hxx b/odb/option-types.hxx index 966f5cf..642c149 100644 --- a/odb/option-types.hxx +++ b/odb/option-types.hxx @@ -65,4 +65,34 @@ operator>> (std::istream&, schema_format&); std::ostream& operator<< (std::ostream&, schema_format); +// +// +struct oracle_version +{ + unsigned short + ver_major () const + { + return major_; + } + + unsigned short + ver_minor () const + { + return minor_; + } + + friend std::istream& operator>> (std::istream&, oracle_version&); + friend std::ostream& operator<< (std::ostream&, oracle_version); + +private: + unsigned short major_; + unsigned short minor_; +}; + +std::istream& +operator>> (std::istream&, oracle_version&); + +std::ostream& +operator<< (std::ostream&, oracle_version); + #endif // ODB_OPTION_TYPES_HXX diff --git a/odb/options.cli b/odb/options.cli index d837418..898d0d9 100644 --- a/odb/options.cli +++ b/odb/options.cli @@ -452,4 +452,17 @@ class options but may lead to automatically-assigned ids not being in a strictly ascending order. Refer to the SQLite documentation for details." }; + + // + // Oracle-specific options. + // + + ::oracle_version --oracle-client-version + { + "<v>", + "Specify the minimum Oracle client library (OCI) version with which the + generated C++ code will be linked. This information is used to enable + version-specific optimizations in the generated C++ code. The version + must be in the \c{\i{major}\b{.}\i{minor}} form, for example, \cb{11.2}." + }; }; |