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.hxx | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) (limited to 'odb/option-types.hxx') diff --git a/odb/option-types.hxx b/odb/option-types.hxx index 2f8825d..f078d3c 100644 --- a/odb/option-types.hxx +++ b/odb/option-types.hxx @@ -173,6 +173,78 @@ operator>> (std::istream&, name_case&); // // +struct pgsql_version +{ + pgsql_version (unsigned short major, unsigned short minor) + : major_ (major), minor_ (minor) + { + } + + unsigned short + ver_major () const + { + return major_; + } + + unsigned short + ver_minor () const + { + return minor_; + } + +private: + unsigned short major_; + unsigned short minor_; +}; + +inline bool +operator== (const pgsql_version& x, const pgsql_version& y) +{ + return x.ver_major () == y.ver_major (); +} + +inline bool +operator!= (const pgsql_version& x, const pgsql_version& y) +{ + return !(x == y); +} + +inline bool +operator< (const pgsql_version& x, const pgsql_version& y) +{ + return x.ver_major () < y.ver_major () || + (x.ver_major () == y.ver_major () && + x.ver_minor () < y.ver_minor ()); +} + +inline bool +operator> (const pgsql_version& x, const pgsql_version& y) +{ + return x.ver_major () > y.ver_major () || + (x.ver_major () == y.ver_major () && + x.ver_minor () > y.ver_minor ()); +} + +inline bool +operator<= (const pgsql_version& x, const pgsql_version& y) +{ + return !(x > y); +} + +inline bool +operator>= (const pgsql_version& x, const pgsql_version& y) +{ + return !(x < y); +} + +std::istream& +operator>> (std::istream&, pgsql_version&); + +std::ostream& +operator<< (std::ostream&, pgsql_version); + +// +// struct oracle_version { oracle_version (unsigned short major, unsigned short minor) -- cgit v1.1