File: test-odbc-mysql.cpp

package info (click to toggle)
soci 4.1.2-2~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 17,968 kB
  • sloc: ansic: 169,887; cpp: 54,198; javascript: 12,258; ada: 1,973; sh: 36; makefile: 12; xml: 2
file content (55 lines) | stat: -rw-r--r-- 1,522 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//
// 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
// https://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";
    }

    std::string get_backend_name() const override
    {
        return "odbc";
    }

    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;