diff options
Diffstat (limited to 'odb/option-types.cxx')
-rw-r--r-- | odb/option-types.cxx | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/odb/option-types.cxx b/odb/option-types.cxx index 715577d..fcd7b88 100644 --- a/odb/option-types.cxx +++ b/odb/option-types.cxx @@ -12,8 +12,10 @@ using namespace std; +// // database // + static const char* database_[] = { "mssql", @@ -55,8 +57,10 @@ operator<< (ostream& os, database db) return os << db.string (); } +// // schema_format // + static const char* schema_format_[] = { "embedded", @@ -95,8 +99,10 @@ operator<< (ostream& os, schema_format sf) return os << sf.string (); } +// // oracle_version // + istream& operator>> (istream& is, oracle_version& v) { @@ -134,3 +140,45 @@ operator<< (ostream& os, oracle_version v) { return os << v.ver_major () << '.' << v.ver_minor (); } + +// +// mssql_version +// + +istream& +operator>> (istream& is, mssql_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 = mssql_version (major, minor); + } + else + is.setstate (istream::failbit); + } + + return is; +} + +ostream& +operator<< (ostream& os, mssql_version v) +{ + return os << v.ver_major () << '.' << v.ver_minor (); +} |