diff --git a/include/SQLiteCpp/Database.h b/include/SQLiteCpp/Database.h index 8842026..6f8e637 100644 --- a/include/SQLiteCpp/Database.h +++ b/include/SQLiteCpp/Database.h @@ -12,7 +12,9 @@ #include -#if (__cplusplus >= 201703L) || ( defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L)) // c++17: Visual Studio 2017 version 15.7 +// c++17: MinGW GCC version > 8 +// c++17: Visual Studio 2017 version 15.7 +#if ((__cplusplus >= 201703L) && ((!defined(__MINGW32__) && !defined(__MINGW64__)) || (__GNUC__ > 8))) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L)) #include #endif // c++17 @@ -155,12 +157,15 @@ public: { } - #if (__cplusplus >= 201703L) || ( defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L)) // c++17: Visual Studio 2017 version 15.7 + // c++17: MinGW GCC version > 8 + // c++17: Visual Studio 2017 version 15.7 + #if ((__cplusplus >= 201703L) && ((!defined(__MINGW32__) && !defined(__MINGW64__)) || (__GNUC__ > 8))) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L)) + /** * @brief Open the provided database std::filesystem::path. * * @note This feature requires std=C++17 - * + * * Uses sqlite3_open_v2() with readonly default flag, which is the opposite behavior * of the old sqlite3_open() function (READWRITE+CREATE). * This makes sense if you want to use it on a readonly filesystem @@ -179,7 +184,8 @@ public: const int aFlags = SQLite::OPEN_READONLY, const int aBusyTimeoutMs = 0, const std::string& aVfs = "") : - Database(apFilename.c_str(), aFlags, aBusyTimeoutMs, aVfs.empty() ? nullptr : aVfs.c_str()) + Database(reinterpret_cast(apFilename.u8string().c_str()), + aFlags, aBusyTimeoutMs, aVfs.empty() ? nullptr : aVfs.c_str()) { } @@ -280,7 +286,7 @@ public: * @see exec() to execute, returning number of rows modified * * @param[in] aQueries one or multiple UTF-8 encoded, semicolon-separate SQL statements - * + * * @return the sqlite result code. */ int tryExec(const char* apQueries) noexcept; @@ -296,7 +302,7 @@ public: * @see exec() to execute, returning number of rows modified * * @param[in] aQueries one or multiple UTF-8 encoded, semicolon-separate SQL statements - * + * * @return the sqlite result code. */ int tryExec(const std::string aQueries) noexcept @@ -510,7 +516,7 @@ public: * This function reads the first 100 bytes of a SQLite database file * and reconstructs groups of individual bytes into the associated fields * in a Header object. - * + * * @param[in] aFilename path/uri to a file * * @return Header object containing file data