Commit d58e2388 authored by Tobias Frost's avatar Tobias Frost

Imported Upstream version 0.3.1+dfsg

parents
cmake_minimum_required(VERSION 2.6)
project(cppdb)
set(CPPDB_MAJOR 0)
set(CPPDB_MINOR 3)
set(CPPDB_PATCH 1)
set(CPPDB_VERSION ${CPPDB_MAJOR}.${CPPDB_MINOR}.${CPPDB_PATCH})
set(CPPDB_SOVERSION ${CPPDB_MAJOR})
add_definitions(
-DCPPDB_MAJOR=${CPPDB_MAJOR}
-DCPPDB_MINOR=${CPPDB_MINOR}
-DCPPDB_PATCH=${CPPDB_PATCH}
-DCPPDB_VERSION="${CPPDB_MAJOR}.${CPPDB_MINOR}.${CPPDB_PATCH}"
)
option(DISABLE_SQLITE "Link sqlite3 backend into the libcppdb" OFF)
option(DISABLE_PQ "Link postgresql backend into the libcppdb" OFF)
option(DISABLE_MYSQL "Link mysql backend into the libcppdb" OFF)
option(DISABLE_ODBC "Link odbc backend into the libcppdb" OFF)
option(SQLITE_BACKEND_INTERNAL "Link sqlite3 backend into the libcppdb" OFF)
option(PQ_BACKEND_INTERNAL "Link postgresql backend into the libcppdb" OFF)
option(MYSQL_BACKEND_INTERNAL "Link mysql backend into the libcppdb" OFF)
option(ODBC_BACKEND_INTERNAL "Link odbc backend into the libcppdb" ON)
if(NOT LIBDIR)
set(LIBDIR lib CACHE STRING "Library installation directory" FORCE)
endif()
# General settings
include_directories(.)
add_definitions(-DCPPDB_LIBRARY_PREFIX="${CMAKE_SHARED_LIBRARY_PREFIX}")
add_definitions(-DCPPDB_LIBRARY_SUFFIX="${CMAKE_SHARED_LIBRARY_SUFFIX}")
add_definitions(-DCPPDB_SOVERSION="${CPPDB_SOVERSION}")
# Basic common configuration
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif(NOT CMAKE_BUILD_TYPE)
include(CheckLibraryExists)
include(CheckCXXSourceCompiles)
if(NOT WIN32)
find_library(DL_LIB dl)
find_library(PTHREAD_LIB pthread NAMES thr kse)
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
set(CXX_FLAGS "-Wall -Wextra")
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
set(CXX_FLAGS "${CXX_FLAGS} -pthreads")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(CXX_FLAGS "-Wall")
elseif(MSVC)
set(CXX_FLAGS "/EHsc /W3")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
set(CXX_FLAGS "${CXX_FLAGS} -mt")
endif()
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_FLAGS}")
check_cxx_source_compiles(
"int main() { volatile int v=0; return __sync_bool_compare_and_swap(&v,0,1); }"
CPPDB_HAS_GCC_SYNC)
if(CPPDB_HAS_GCC_SYNC)
add_definitions(-DCPPDB_HAS_GCC_SYNC)
endif()
check_cxx_source_compiles(
"#include <bits/atomicity.h>
using __gnu_cxx::__exchange_and_add;
int main(){ volatile int x=0; return __exchange_and_add(&x,1);}"
CPPDB_HAVE_GCC_BITS_EXCHANGE_AND_ADD)
if(CPPDB_HAVE_GCC_BITS_EXCHANGE_AND_ADD)
add_definitions(-DCPPDB_HAVE_GCC_BITS_EXCHANGE_AND_ADD)
endif()
check_cxx_source_compiles(
"#include <ext/atomicity.h>
using __gnu_cxx::__exchange_and_add;
int main(){ volatile int x=0; return __exchange_and_add(&x,1);}"
CPPDB_HAVE_GCC_EXT_EXCHANGE_AND_ADD)
if(CPPDB_HAVE_GCC_EXT_EXCHANGE_AND_ADD)
add_definitions(-DCPPDB_HAVE_GCC_EXT_EXCHANGE_AND_ADD)
endif()
check_cxx_source_compiles(
"#include <sys/types.h>
#include <machine/atomic.h>
int main() { volatile unsigned v=0; return atomic_cmpset_int(&v,1,0); }"
CPPDB_HAVE_FREEBSD_ATOMIC)
if(CPPDB_HAVE_FREEBSD_ATOMIC)
add_definitions(-DCPPDB_HAVE_FREEBSD_ATOMIC)
endif()
check_cxx_source_compiles(
"#include <atomic.h>
int main() { volatile unsigned v=0; return atomic_add_int_nv(&v,1); }"
CPPDB_HAVE_SOLARIS_ATOMIC)
if(CPPDB_HAVE_SOLARIS_ATOMIC)
add_definitions(-DCPPDB_HAVE_SOLARIS_ATOMIC)
endif()
check_cxx_source_compiles(
"#include <libkern/OSAtomic.h>
int main() { volatile int v=0; return OSAtomicAdd32(1,&v); }"
CPPDB_HAVE_MAC_OS_X_ATOMIC)
if(CPPDB_HAVE_MAC_OS_X_ATOMIC)
add_definitions(-DCPPDB_HAVE_MAC_OS_X_ATOMIC)
endif()
# Backend configuration
set(INTERNAL_SOURCES)
set(INTERNAL_LIBRARIES)
set(BACKEND_LIBRARIES)
if(NOT DISABLE_ODBC)
find_library(ODBC_LIB odbc NAMES odbc32)
find_path(ODBC_PATH sqlext.h)
if(ODBC_LIB AND ODBC_PATH)
include_directories(${ODBC_PATH})
if(ODBC_BACKEND_INTERNAL)
set(INTERNAL_SOURCES ${INTERNAL_SOURCES} drivers/odbc_backend.cpp)
set(INTERNAL_LIBRARIES ${INTERNAL_LIBRARIES} ${ODBC_LIB})
add_definitions(-DCPPDB_WITH_ODBC)
else()
add_library(cppdb_odbc SHARED drivers/odbc_backend.cpp)
target_link_libraries(cppdb_odbc ${ODBC_LIB})
add_library(cppdb_odbc-static STATIC drivers/odbc_backend.cpp)
set(BACKEND_LIBRARIES ${BACKEND_LIBRARIES} cppdb_odbc)
endif()
else()
message("-- odbc library was not found, disabling odbc backend")
endif()
endif()
if(NOT DISABLE_SQLITE)
find_library(SQLITE3_LIB sqlite3)
find_path(SQLITE3_PATH sqlite3.h)
if(SQLITE3_LIB AND SQLITE3_PATH)
include_directories(${SQLITE3_PATH})
if(SQLITE_BACKEND_INTERNAL)
add_definitions(-DCPPDB_WITH_SQLITE3)
set(INTERNAL_SOURCES ${INTERNAL_SOURCES} drivers/sqlite3_backend.cpp)
set(INTERNAL_LIBRARIES ${INTERNAL_LIBRARIES} ${SQLITE3_LIB})
else()
add_library(cppdb_sqlite3 SHARED drivers/sqlite3_backend.cpp)
target_link_libraries(cppdb_sqlite3 ${SQLITE3_LIB})
add_library(cppdb_sqlite3-static STATIC drivers/sqlite3_backend.cpp)
set(BACKEND_LIBRARIES ${BACKEND_LIBRARIES} cppdb_sqlite3)
endif()
else()
message("-- sqlite3 library was not found, disabling sqlite3 backend")
endif()
endif()
if(NOT DISABLE_PQ)
find_library(PQ_LIB pq)
find_path(PQ_PATH libpq-fe.h PATH_SUFFIXES postgresql pgsql)
if(PQ_LIB AND PQ_PATH)
include_directories(${PQ_PATH})
if(PQ_BACKEND_INTERNAL)
set(INTERNAL_SOURCES ${INTERNAL_SOURCES} drivers/postgres_backend.cpp)
set(INTERNAL_LIBRARIES ${INTERNAL_LIBRARIES} ${PQ_LIB})
add_definitions(-DCPPDB_WITH_PQ)
else()
add_library(cppdb_postgresql SHARED drivers/postgres_backend.cpp)
add_library(cppdb_postgresql-static STATIC drivers/postgres_backend.cpp)
target_link_libraries(cppdb_postgresql ${PQ_LIB})
set(BACKEND_LIBRARIES ${BACKEND_LIBRARIES} cppdb_postgresql)
endif()
else()
message("-- libpq not found, disableing postgresql backend")
endif()
endif()
if(NOT DISABLE_MYSQL)
find_library(MYSQL_LIB mysqlclient)
find_path(MYSQL_PATH mysql.h PATH_SUFFIXES mysql)
if(MYSQL_LIB AND MYSQL_PATH)
include_directories(${MYSQL_PATH})
if(MYSQL_BACKEND_INTERNAL)
set(INTERNAL_SOURCES ${INTERNAL_SOURCES} drivers/mysql_backend.cpp)
set(INTERNAL_LIBRARIES ${INTERNAL_LIBRARIES} ${MYSQL_LIB})
add_definitions(-DCPPDB_WITH_MYSQL)
else()
add_library(cppdb_mysql SHARED drivers/mysql_backend.cpp)
add_library(cppdb_mysql-static STATIC drivers/mysql_backend.cpp)
target_link_libraries(cppdb_mysql ${MYSQL_LIB})
set(BACKEND_LIBRARIES ${BACKEND_LIBRARIES} cppdb_mysql)
endif()
else()
message("-- mysqlclient not found, disableing mysql backend")
endif()
endif()
# Main library configuration
set(CPPDB_SRC
src/utils.cpp
src/mutex.cpp
src/driver_manager.cpp
src/conn_manager.cpp
src/shared_object.cpp
src/pool.cpp
src/backend.cpp
src/frontend.cpp
src/atomic_counter.cpp
${INTERNAL_SOURCES}
)
add_library(cppdb SHARED ${CPPDB_SRC})
add_library(cppdb-static STATIC ${CPPDB_SRC})
set_target_properties(cppdb PROPERTIES COMPILE_DEFINITIONS CPPDB_EXPORTS)
if(NOT WIN32)
if(DL_LIB)
target_link_libraries(cppdb ${DL_LIB})
endif()
target_link_libraries(cppdb ${PTHREAD_LIB})
endif()
# Link and backends configuration
set(INST_LIBS)
foreach(LIB ${BACKEND_LIBRARIES} cppdb)
set(INST_LIBS ${INST_LIBS} ${LIB} ${LIB}-static)
if(WIN32)
set_target_properties(${LIB} PROPERTIES VERSION ${CPPDB_SOVERSION} SOVERSION ${CPPDB_SOVERSION})
else()
set_target_properties(${LIB} PROPERTIES VERSION ${CPPDB_VERSION} SOVERSION ${CPPDB_SOVERSION})
endif()
set_target_properties(${LIB} PROPERTIES CLEAN_DIRECT_OUTPUT 1)
set_target_properties(${LIB} PROPERTIES OUTPUT_NAME "${LIB}")
set_target_properties(${LIB}-static PROPERTIES CLEAN_DIRECT_OUTPUT 1)
set_target_properties(${LIB}-static PROPERTIES OUTPUT_NAME "${LIB}")
set_target_properties(${LIB}-static PROPERTIES PREFIX "lib") # Make sure import and normal library do not collide
endforeach()
foreach(LIB ${BACKEND_LIBRARIES})
set_target_properties(${LIB} PROPERTIES COMPILE_DEFINITIONS CPPDB_DRIVER_EXPORTS)
target_link_libraries(${LIB} cppdb)
endforeach()
foreach(LIB ${INTERNAL_LIBRARIES})
target_link_libraries(cppdb ${LIB})
endforeach()
# tests
add_executable(test_perf test/test_perf.cpp)
add_executable(test_basic test/test_basic.cpp)
add_executable(test_backend test/test_backend.cpp)
add_executable(test_caching test/test_caching.cpp)
add_executable(example examples/example1.cpp)
set_target_properties( test_perf test_backend test_basic test_caching example
PROPERTIES
COMPILE_DEFINITIONS CPPDB_EXPORTS)
target_link_libraries(test_perf cppdb)
target_link_libraries(test_basic cppdb)
target_link_libraries(test_backend cppdb)
target_link_libraries(test_caching cppdb)
target_link_libraries(example cppdb)
install(TARGETS ${INST_LIBS}
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${LIBDIR}
ARCHIVE DESTINATION ${LIBDIR}
PUBLIC_HEADER DESTINATION include/cppdb)
install(DIRECTORY cppdb DESTINATION include
PATTERN ".svn" EXCLUDE)
This diff is collapsed.
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
Copyright (c) 2010-2011 Artyom Beilis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-------------------------------
CppDB - SQL Connectivity Library
--------------------------------
Copyright (C) 2010-2011 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
----------------------------------------------------------------------
Distributed under:
the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
or (at your opinion) under:
The MIT License
(See accompanying file MIT.txt or a copy at
http://www.opensource.org/licenses/mit-license.php)
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2010-2011 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
//
// Distributed under:
//
// the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// or (at your opinion) under:
//
// The MIT License
// (See accompanying file MIT.txt or a copy at
// http://www.opensource.org/licenses/mit-license.php)
//
///////////////////////////////////////////////////////////////////////////////
#ifndef CPPDB_ATOMIC_COUNT_H
#define CPPDB_ATOMIC_COUNT_H
#include <cppdb/defs.h>
namespace cppdb {
///
/// \brief Atomic counter is a class that allows perform counting in thread safe way.
///
/// It is mainly used for reference counting. Under Windows it uses Interlocked API, under
/// other platforms it used built-in atomic operations or fails back to pthreads locking implementation.
///
/// Notes:
///
/// - This counter is not safe for use in process shared memory, when pthreads fall-back is used
/// - Under POSIX platform pthread_mutex_t is always present in order to make sure that we can implement
/// or remove pthread fall-back at any point not affecting ABI
///
class CPPDB_API atomic_counter {
public:
///
/// Create a counter with initial value v
///
explicit atomic_counter( long v);
~atomic_counter();
///
/// Increment and return the result after increment atomically
///
long operator++()
{
return inc();
}
///
/// Decrement and return the result after decrement atomically
///
long operator--()
{
return dec();
}
///
/// Return current value - atomically
///
operator long() const
{
return get();
}
private:
long inc();
long dec();
long get() const;
atomic_counter(atomic_counter const &);
atomic_counter & operator=(atomic_counter const &);
mutable union {
int i;
unsigned ui;
long l;
unsigned long ul;
long long ll;
unsigned long long ull;
} value_;
// Is actually used for platforms without lock
// it would not be used when atomic operations
// available
void *mutex_;
};
} // cppdb
#endif
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2010-2011 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
//
// Distributed under:
//
// the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// or (at your opinion) under:
//
// The MIT License
// (See accompanying file MIT.txt or a copy at
// http://www.opensource.org/licenses/mit-license.php)
//
///////////////////////////////////////////////////////////////////////////////
#ifndef CPPDB_CONN_MANAGER_H
#define CPPDB_CONN_MANAGER_H
#include <cppdb/defs.h>
#include <cppdb/ref_ptr.h>
#include <cppdb/mutex.h>
#include <map>
#include <string>
#include <memory>
namespace cppdb {
class pool;
class connection_info;
namespace backend {
class connection;
}
///
/// \brief This class is the major gateway to new connections
///
/// It handles connection pools and forwards request to the drivers.
///
/// This class member functions are thread safe
///
class CPPDB_API connections_manager {
connections_manager();
// Borland erros on hidden destructors in classes without only static methods.
#ifndef __BORLANDC__
~connections_manager();
#endif
connections_manager(connections_manager const &);
void operator = (connections_manager const &);
public:
///
/// Get a singleton instance of the class
///
static connections_manager &instance();
///
/// Create a new connection using connection string \a cs
///
ref_ptr<backend::connection> open(std::string const &cs);
///
/// Create a new connection using parsed connection string \a ci
///
ref_ptr<backend::connection> open(connection_info const &ci);
///
/// Collect all connections that were not used for long time and close them.
///
void gc();
private:
struct data;
std::auto_ptr<data> d;
mutex lock_;
typedef std::map<std::string,ref_ptr<pool> > connections_type;
connections_type connections_;
};
} // cppdb
#endif
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2010-2011 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
//
// Distributed under:
//
// the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// or (at your opinion) under:
//
// The MIT License
// (See accompanying file MIT.txt or a copy at
// http://www.opensource.org/licenses/mit-license.php)
//
///////////////////////////////////////////////////////////////////////////////
#ifndef CPPDB_CONNECTION_SPECIFIC_H
#define CPPDB_CONNECTION_SPECIFIC_H
#include <cppdb/defs.h>
#include <memory>
namespace cppdb {
///
/// \brief Special abstract object that holds a connection specific data
///
/// The user is expected to derive its own object from this class
/// and save them withing the connection
///
class CPPDB_API connection_specific_data {
connection_specific_data(connection_specific_data const &);
void operator=(connection_specific_data const &);
public:
connection_specific_data();
virtual ~connection_specific_data();
private:
struct data;
std::auto_ptr<data> d;
};
} // cppdb
#endif
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2010-2011 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
//
// Distributed under:
//
// the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// or (at your opinion) under:
//
// The MIT License
// (See accompanying file MIT.txt or a copy at
// http://www.opensource.org/licenses/mit-license.php)
//
///////////////////////////////////////////////////////////////////////////////
#ifndef CPPDB_DEFS_H
#define CPPDB_DEFS_H
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32) || defined(__CYGWIN__)
# if defined(DLL_EXPORT) || defined(CPPDB_EXPORTS) || defined(CPPDB_DRIVER_EXPORTS)
# ifdef CPPDB_SOURCE
# define CPPDB_API __declspec(dllexport)
# else
# define CPPDB_API __declspec(dllimport)
# endif
# endif
# if defined(DLL_EXPORT) || defined(CPPDB_DRIVER_EXPORTS)
# ifdef CPPDB_DRIVER_SOURCE
# define CPPDB_DRIVER_API __declspec(dllexport)
# else
# define CPPDB_DRIVER_API __declspec(dllimport)
# endif
# endif
#endif
#ifndef CPPDB_API
# define CPPDB_API
#endif
#ifndef CPPDB_DRIVER_API
# define CPPDB_DRIVER_API
#endif
#endif
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2010-2011 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
//
// Distributed under:
//
// the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// or (at your opinion) under:
//
// The MIT License
// (See accompanying file MIT.txt or a copy at
// http://www.opensource.org/licenses/mit-license.php)
//
///////////////////////////////////////////////////////////////////////////////
#ifndef CPPDB_DRIVER_MANAGER_H
#define CPPDB_DRIVER_MANAGER_H
#include <cppdb/defs.h>
#include <cppdb/ref_ptr.h>
#include <cppdb/mutex.h>
#include <map>
#include <string>
#include <vector>
namespace cppdb {
namespace backend {
class connection;
class driver;
}
class connection_info;
///
/// \brief this class is used to handle all drivers, loading them, unloading them etc.
///
/// All its member functions are thread safe
///
class CPPDB_API driver_manager {
public:
///
/// Get the singleton instance of the class
///
static driver_manager &instance();
///
/// Install new driver \a drv named \a name to the manager.
///
void install_driver(std::string const &name,ref_ptr<backend::driver> drv);
///
/// Unload all drivers that have no more open connections.
///
void collect_unused();
///
/// Add a path were the driver should search for loadable modules
///
void add_search_path(std::string const &);
///
/// Clear previously added a paths
///
void clear_search_paths();
///
/// Search the library under default directory (i.e. empty path prefix) or not, default is true
///
void use_default_search_path(bool v);
///
/// Create a new connection object using parsed connection string \a ci
///
backend::connection *connect(connection_info const &ci);
///
/// Create a new connection object using connection string \a connectoin_string
///
backend::connection *connect(std::string const &connectoin_string);
private:
driver_manager(driver_manager const &);
void operator=(driver_manager const &);
// Borland erros on hidden destructors in classes without only static methods.
#ifndef __BORLANDC__
~driver_manager();
#endif
driver_manager();
ref_ptr<backend::driver> load_driver(connection_info const &ci);
typedef std::map<std::string,ref_ptr<backend::driver> > drivers_type;
std::vector<std::string> search_paths_;
bool no_default_directory_;
drivers_type drivers_;
mutex lock_;
};
}
#endif
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2010-2011 Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>
//
// Distributed under:
//
// the Boost Software License, Version 1.0.