mirror of
https://github.com/rbock/sqlpp11.git
synced 2026-01-08 22:21:00 -06:00
Replace -__cplusplus with CXX_STD_VER, because the latter works correctly with MSVC.
This commit is contained in:
committed by
Roland Bock
parent
b100ede72e
commit
f56564d632
@@ -26,9 +26,11 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sqlpp11/compat/cxx_std_ver.h>
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#if __cplusplus >= 201703L
|
||||
#if CXX_STD_VER >= 201703L
|
||||
#include <string_view>
|
||||
#endif
|
||||
#include <sqlpp11/type_traits.h>
|
||||
@@ -51,7 +53,7 @@ namespace sqlpp
|
||||
text_operand(_value_t t) : _t(std::move(t))
|
||||
{
|
||||
}
|
||||
#if __cplusplus >= 201703L
|
||||
#if CXX_STD_VER >= 201703L
|
||||
// allow construction from an std::string_view
|
||||
text_operand(std::string_view t) : _t(t)
|
||||
{
|
||||
|
||||
@@ -26,13 +26,15 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sqlpp11/compat/cxx_std_ver.h>
|
||||
|
||||
#include <sqlpp11/data_types/parameter_value.h>
|
||||
#include <sqlpp11/data_types/parameter_value_base.h>
|
||||
#include <sqlpp11/data_types/text/data_type.h>
|
||||
#include <sqlpp11/data_types/text/wrap_operand.h>
|
||||
#include <sqlpp11/data_types/text/operand.h>
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
#if CXX_STD_VER >= 201703L
|
||||
#include <string_view>
|
||||
#endif
|
||||
|
||||
@@ -51,7 +53,7 @@ namespace sqlpp
|
||||
target._bind_text_parameter(index, &_value, _is_null);
|
||||
}
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
#if CXX_STD_VER >= 201703L
|
||||
parameter_value_base& operator=(const std::string_view& val)
|
||||
{
|
||||
_value = val;
|
||||
|
||||
@@ -26,8 +26,10 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sqlpp11/compat/cxx_std_ver.h>
|
||||
|
||||
#include <utility>
|
||||
#if __cplusplus >= 201703L
|
||||
#if CXX_STD_VER >= 201703L
|
||||
#include <string_view>
|
||||
#endif
|
||||
#include <sqlpp11/type_traits.h>
|
||||
@@ -37,7 +39,7 @@ namespace sqlpp
|
||||
{
|
||||
struct text_operand;
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
#if CXX_STD_VER >= 201703L
|
||||
using checked_type = std::string_view;
|
||||
#else
|
||||
using checked_type = std::string;
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sqlpp11/compat/cxx_std_ver.h>
|
||||
|
||||
#include <functional>
|
||||
#include <iterator>
|
||||
#include <utility>
|
||||
@@ -81,7 +83,7 @@ namespace sqlpp
|
||||
class iterator
|
||||
{
|
||||
public:
|
||||
#if __cplusplus >= 202002L
|
||||
#if CXX_STD_VER >= 202002L
|
||||
using iterator_concept = std::input_iterator_tag;
|
||||
#else
|
||||
// LegacyInputIterator describes best our iterator's capabilities. However our iterator does not
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sqlpp11/compat/cxx_std_ver.h>
|
||||
|
||||
#include "compare.h"
|
||||
#include "Sample.h"
|
||||
#include <sqlpp11/sqlpp11.h>
|
||||
@@ -47,7 +49,7 @@ int Insert(int, char* [])
|
||||
"INSERT INTO tab_bar (beta,gamma) VALUES('cheesecake'," + getTrue() + ")");
|
||||
compare(__LINE__, insert_into(bar).set(bar.beta = ::sqlpp::null, bar.gamma = true),
|
||||
"INSERT INTO tab_bar (beta,gamma) VALUES(NULL," + getTrue() + ")");
|
||||
#if __cplusplus >= 201703L
|
||||
#if CXX_STD_VER >= 201703L
|
||||
// string_view argument
|
||||
std::string_view cheeseCake = "cheesecake";
|
||||
compare(__LINE__, insert_into(bar).set(bar.beta = cheeseCake, bar.gamma = true),
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sqlpp11/compat/cxx_std_ver.h>
|
||||
|
||||
#include "compare.h"
|
||||
#include "Sample.h"
|
||||
#include <sqlpp11/sqlpp11.h>
|
||||
@@ -68,7 +70,7 @@ int Where(int, char*[])
|
||||
compare(__LINE__, where(is_equal_to_or_null(bar.beta, ::sqlpp::value_or_null("SQL"))), " WHERE (tab_bar.beta='SQL')");
|
||||
compare(__LINE__, where(is_equal_to_or_null(bar.beta, ::sqlpp::value_or_null<sqlpp::text>(::sqlpp::null))),
|
||||
" WHERE tab_bar.beta IS NULL");
|
||||
#if __cplusplus >= 201703L
|
||||
#if CXX_STD_VER >= 201703L
|
||||
// string_view argument
|
||||
std::string_view sqlString = "SQL";
|
||||
compare(__LINE__, where(bar.beta == sqlString), " WHERE (tab_bar.beta='SQL')");
|
||||
|
||||
@@ -23,11 +23,13 @@
|
||||
* OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sqlpp11/compat/cxx_std_ver.h>
|
||||
|
||||
#include "MockDb.h"
|
||||
#include "Sample.h"
|
||||
#include "is_regular.h"
|
||||
#include <iostream>
|
||||
#if __cplusplus >= 201703L
|
||||
#if CXX_STD_VER >= 201703L
|
||||
#include <string_view>
|
||||
#endif
|
||||
#include <sqlpp11/functions.h>
|
||||
@@ -109,7 +111,7 @@ int Insert(int, char*[])
|
||||
prepared_insert.params.delta = sqlpp::value_or_null(17);
|
||||
db(prepared_insert);
|
||||
|
||||
#if __cplusplus >= 201703L
|
||||
#if CXX_STD_VER >= 201703L
|
||||
auto prepared_insert_sv = db.prepare(insert_into(t).set(t.gamma = parameter(t.gamma), t.delta = parameter(t.delta), t.beta = parameter(t.beta)));
|
||||
prepared_insert_sv.params.gamma = true;
|
||||
prepared_insert_sv.params.delta = 17;
|
||||
|
||||
Reference in New Issue
Block a user