Files
soci/tests/odbc/test-odbc-mysql.cpp
Vadim Zeitlin b0ecbca57a Extract common tests in soci_tests_common library
This allows to compile them once, instead of doing it for every backend:
while this doesn't matter for the CI builds, recompiling common-tests.h
a dozen times enormously slowed down local builds using all backends.

Now it is compiled only once, as test-common.cpp, and all the other
tests (except for the "empty" one) just link with the resulting library.

Also extract some parts of this file into separate headers, that can be
included only by the tests that actually need them.

Note that the entire test-common.cpp probably ought to be split into
multiple files, to speed up its build too, but this can be done later.
2024-10-23 13:54:01 +02:00

51 lines
1.4 KiB
C++

//
// Copyright (C) 2004-2006 Maciej Sobczak, Stephen Hutton, David Courtney
// 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)
//
#include "soci/soci.h"
#include "soci/odbc/soci-odbc.h"
#include <iostream>
#include <string>
#include <ctime>
#include <cmath>
#include "mysql/test-mysql.h"
#include <catch.hpp>
std::string connectString;
backend_factory const &backEnd = *soci::factory_odbc();
class test_context_odbc : public test_context
{
public:
using test_context::test_context;
std::string get_example_connection_string() const override
{
return "FILEDSN=./test-mysql.dsn";
}
bool truncates_uint64_to_int64() const override
{
// The ODBC driver of MySQL truncates values bigger then INT64_MAX.
// There are open bugs related to this issue:
// - https://bugs.mysql.com/bug.php?id=95978
// - https://bugs.mysql.com/bug.php?id=61114
// Driver version 8.0.31 seems to have fixed this (https://github.com/mysql/mysql-connector-odbc/commit/e78da1344247752f76a082de51cfd36d5d2dd98f),
// but we use an older version in the AppVeyor builds.
return true;
}
table_creator_base* table_creator_blob(soci::session&) const override
{
// Blobs are not supported
return nullptr;
}
};
test_context_odbc tc_odbc_mysql;