diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2010-09-10 12:58:24 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2010-09-10 12:58:24 +0200 |
commit | 49148af30f42baf101e32581c48acdf4540b6442 (patch) | |
tree | 0e1a3d5a0524abc2ca985a3cb984a1c198ffaff7 /libcommon/common/common.cxx | |
parent | ed24158b4d247dff58162c97f04cbc4011579600 (diff) |
Allow the test to specify max number of connections
Use this in common/threads.
Diffstat (limited to 'libcommon/common/common.cxx')
-rw-r--r-- | libcommon/common/common.cxx | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/libcommon/common/common.cxx b/libcommon/common/common.cxx index d68d579..960a946 100644 --- a/libcommon/common/common.cxx +++ b/libcommon/common/common.cxx @@ -12,6 +12,7 @@ #ifdef DB_ID_MYSQL # include <odb/mysql/database.hxx> +# include <odb/mysql/connection-factory.hxx> #endif #include <common/common.hxx> @@ -21,7 +22,7 @@ using namespace std; using namespace odb; auto_ptr<database> -create_database (int argc, char* argv[]) +create_database (int argc, char* argv[], size_t max_connections) { #ifdef DB_ID_MYSQL cli::argv_file_scanner scan (argc, argv, "--options-file"); @@ -35,6 +36,11 @@ create_database (int argc, char* argv[]) exit (0); } + auto_ptr<mysql::connection_factory> f; + + if (max_connections != 0) + f.reset (new mysql::connection_pool_factory (max_connections)); + return auto_ptr<database> ( new mysql::database ( ops.user (), @@ -42,7 +48,9 @@ create_database (int argc, char* argv[]) ops.db_name (), ops.host (), ops.port (), - ops.socket_specified () ? &ops.socket () : 0)); + ops.socket_specified () ? &ops.socket () : 0, + 0, + f)); #else return auto_ptr<database> (0); #endif |