diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-12-22 19:29:04 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-01-08 18:26:00 +0200 |
commit | c715379c625935bd4b28bebb35f34721342cc7f3 (patch) | |
tree | 97e55364e786ab794514450e879006ee61ac8643 /brep/shared-database.cxx | |
parent | eb16296f88ce0fdb4a98a08950b58a346a6e2bd9 (diff) |
Source file names fixup
Diffstat (limited to 'brep/shared-database.cxx')
-rw-r--r-- | brep/shared-database.cxx | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/brep/shared-database.cxx b/brep/shared-database.cxx deleted file mode 100644 index 1389dab..0000000 --- a/brep/shared-database.cxx +++ /dev/null @@ -1,48 +0,0 @@ -// file : brep/shared-database.cxx -*- C++ -*- -// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd -// license : MIT; see accompanying LICENSE file - -#include <brep/shared-database> - -#include <stdexcept> // runtime_error - -#include <odb/pgsql/database.hxx> - -#include <brep/types> -#include <brep/utility> - -namespace brep -{ - shared_ptr<odb::database> - shared_database (const options::db& o) - { - using odb::pgsql::database; - static weak_ptr<database> db; - - // In C++11, function-static variable initialization is guaranteed to be - // thread-safe, thought this doesn't seem to be enough in our case - // (because we are re-initializing the weak pointer). - // - if (shared_ptr<database> d = db.lock ()) - { - if (o.db_user () != d->user () || - o.db_password () != d->password () || - o.db_name () != d->db () || - o.db_host () != d->host () || - o.db_port () != d->port ()) - throw std::runtime_error ("shared database host/port mismatch"); - - return d; - } - else - { - d = make_shared<database> (o.db_user (), - o.db_password (), - o.db_name (), - o.db_host (), - o.db_port ()); - db = d; - return d; - } - } -} |