summaryrefslogtreecommitdiff
path: root/odb
diff options
context:
space:
mode:
authorConstantin Michael <constantin@codesynthesis.com>2011-10-06 08:58:43 +0200
committerConstantin Michael <constantin@codesynthesis.com>2011-10-21 11:47:12 +0200
commit3d1aa62e7f6dfeba4b81ea4716598fe680f1fffb (patch)
tree269833f53585612e72ba1facc0b4b997ddd936dc /odb
parent03fbd42bd45c30875f1a5c3c52062550e4a8a7f9 (diff)
Add --oracle-client-version option and its associated C++ type oracle_version
Diffstat (limited to 'odb')
-rw-r--r--odb/option-types.cxx44
-rw-r--r--odb/option-types.hxx30
-rw-r--r--odb/options.cli13
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}."
+ };
};