From 2a0f39b29c1bea6a4497c0f1826052ffa453af9e Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 21 Apr 2016 16:05:13 +0200 Subject: Move module implementation from brep/ to mod/ --- brep/database.cxx | 60 ------------------------------------------------------- 1 file changed, 60 deletions(-) delete mode 100644 brep/database.cxx (limited to 'brep/database.cxx') diff --git a/brep/database.cxx b/brep/database.cxx deleted file mode 100644 index 4b56c37..0000000 --- a/brep/database.cxx +++ /dev/null @@ -1,60 +0,0 @@ -// file : brep/database.cxx -*- C++ -*- -// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd -// license : MIT; see accompanying LICENSE file - -#include - -#include - -#include -#include - -namespace brep -{ - namespace options - { - bool - operator< (const db& x, const db& y) - { - int r; - if ((r = x.db_user ().compare (y.db_user ())) != 0 || - (r = x.db_password ().compare (y.db_password ())) != 0 || - (r = x.db_name ().compare (y.db_name ())) != 0 || - (r = x.db_host ().compare (y.db_host ()))) - return r < 0; - - return x.db_port () < y.db_port (); - } - } - - using namespace odb; - - shared_ptr - shared_database (const options::db& o) - { - static std::map> databases; - - auto i (databases.find (o)); - if (i != databases.end ()) - { - if (shared_ptr d = i->second.lock ()) - return d; - } - - unique_ptr - f (new pgsql::connection_pool_factory (o.db_max_connections ())); - - shared_ptr d ( - make_shared ( - o.db_user (), - o.db_password (), - o.db_name (), - o.db_host (), - o.db_port (), - "options='-c default_transaction_isolation=serializable'", - move (f))); - - databases[o] = d; - return d; - } -} -- cgit v1.1