From 8554cd89897f9cbd1705592cf0318b3ef4e42665 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 25 Apr 2013 07:35:45 +0200 Subject: Add support for schema version table --- odb/option-types.cxx | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'odb/option-types.cxx') diff --git a/odb/option-types.cxx b/odb/option-types.cxx index 841c513..405a512 100644 --- a/odb/option-types.cxx +++ b/odb/option-types.cxx @@ -218,6 +218,48 @@ operator>> (istream& is, name_case& v) } // +// pgsql_version +// + +istream& +operator>> (istream& is, pgsql_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 = pgsql_version (major, minor); + } + else + is.setstate (istream::failbit); + } + + return is; +} + +ostream& +operator<< (ostream& os, pgsql_version v) +{ + return os << v.ver_major () << '.' << v.ver_minor (); +} + +// // oracle_version // -- cgit v1.1