From 72af90041a94e9806819255254b2d093d2a2a72d Mon Sep 17 00:00:00 2001
From: znone <glyc@sina.com.cn>
Date: Fri, 01 Dec 2017 07:50:16 +0000
Subject: [PATCH] 修正在某些情况下不能绑定字段到左值的问题。
---
include/qtl_common.hpp | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/include/qtl_common.hpp b/include/qtl_common.hpp
index 5015d9c..6966a07 100644
--- a/include/qtl_common.hpp
+++ b/include/qtl_common.hpp
@@ -14,6 +14,8 @@
#include <type_traits>
#include <tuple>
#include <memory>
+#include <string>
+#include <vector>
#include <functional>
#include "apply_tuple.h"
@@ -98,6 +100,12 @@
inline void bind_param(Command& command, size_t index, const T& param)
{
command.bind_param(index, param);
+}
+
+template<typename Command, typename T>
+inline void bind_field(Command& command, size_t index, T& value)
+{
+ bind_field(command, index, std::forward<T>(value));
}
template<typename Command, typename T>
@@ -490,7 +498,7 @@
{
inline void operator()(Command& command, T&& value) const
{
- bind_field(command, 0, std::forward<T>(value));
+ bind_field(command, 0, std::forward<typename std::remove_reference<T>::type>(value));
}
};
@@ -671,7 +679,7 @@
}
template<typename Params>
- uint64_t insert_direct(const std::string& query_text, const Params& params)
+ uint64_t insert(const std::string& query_text, const Params& params)
{
return insert(query_text.data(), query_text.length(), params);
}
--
Gitblit v1.9.3