修正在Visual Studio 2017下的编译错误。
处理连接池在连接失败时的异常。
2 files modified
38 ■■■■■ changed files
include/qtl_common.hpp 31 ●●●●● patch | view | raw | blame | history
include/qtl_database_pool.hpp 7 ●●●●● patch | view | raw | blame | history
include/qtl_common.hpp
@@ -79,6 +79,31 @@
    typedef StringT string_type;
    typedef typename string_type::value_type char_type;
    bind_string_helper(string_type&& value) : m_value(std::forward<string_type>(value)) { }
    bind_string_helper(const bind_string_helper& src)
        : m_value(std::forward<std::string>(src.m_value))
    {
    }
    bind_string_helper(bind_string_helper&& src)
        : m_value(std::forward<std::string>(src.m_value))
    {
    }
    bind_string_helper& operator=(const bind_string_helper& src)
    {
        if (this != &src)
        {
            m_value = std::forward<std::string>(src.m_value);
        }
        return *this;
    }
    bind_string_helper& operator=(bind_string_helper&& src)
    {
        if (this != &src)
        {
            m_value = std::forward<std::string>(src.m_value);
        }
        return *this;
    }
    void clear() { m_value.clear(); }
    char_type* alloc(size_t n) { m_value.resize(n); return (char_type*)m_value.data(); }
    void truncate(size_t n) { m_value.resize(n); }
@@ -859,17 +884,17 @@
    template<typename... ValueProc>
    void query_multi(const char* query_text, size_t text_length, ValueProc&&... proc)
    {
        query_multi_with_params<std::tuple<>>(query_text, text_length, std::make_tuple(), std::forward<ValueProc>(proc)...);
        query_multi_with_params<std::tuple<>, ValueProc...>(query_text, text_length, std::make_tuple(), std::forward<ValueProc>(proc)...);
    }
    template<typename... ValueProc>
    void query_multi(const char* query_text, ValueProc&&... proc)
    {
        query_multi_with_params<std::tuple<>>(query_text, strlen(query_text), std::make_tuple(), std::forward<ValueProc>(proc)...);
        query_multi_with_params<std::tuple<>, ValueProc...>(query_text, strlen(query_text), std::make_tuple(), std::forward<ValueProc>(proc)...);
    }
    template<typename... ValueProc>
    void query_multi(const std::string& query_text, ValueProc&&... proc)
    {
        query_multi_with_params<std::tuple<>>(query_text.data(), query_text.size(), std::make_tuple(), std::forward<ValueProc>(proc)...);
        query_multi_with_params<std::tuple<>, ValueProc...>(query_text.data(), query_text.size(), std::make_tuple(), std::forward<ValueProc>(proc)...);
    }
    template<typename Params, typename Values>
include/qtl_database_pool.hpp
@@ -29,8 +29,15 @@
        if(m_background_thread.joinable())
        {
            m_stop_thread=true;
            try
            {
            m_background_thread.join();
        }
            catch (std::system_error&)
            {
                //igore the error
            }
        }
        clear();
    }