1212
1313#include < SQLiteCpp/Column.h>
1414
15- #if (__cplusplus >= 201703L) || ( defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L)) // c++17: Visual Studio 2017 version 15.7
15+ // c++17: MinGW GCC version > 8
16+ // c++17: Visual Studio 2017 version 15.7
17+ #if ((__cplusplus >= 201703L) && ((!defined(__MINGW32__) && !defined(__MINGW64__)) || (__GNUC__ > 8))) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L))
1618#include < filesystem>
1719#endif // c++17
1820
@@ -155,12 +157,15 @@ class Database
155157 {
156158 }
157159
158- #if (__cplusplus >= 201703L) || ( defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L)) // c++17: Visual Studio 2017 version 15.7
160+ // c++17: MinGW GCC version > 8
161+ // c++17: Visual Studio 2017 version 15.7
162+ #if ((__cplusplus >= 201703L) && ((!defined(__MINGW32__) && !defined(__MINGW64__)) || (__GNUC__ > 8))) || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L))
163+
159164 /* *
160165 * @brief Open the provided database std::filesystem::path.
161166 *
162167 * @note This feature requires std=C++17
163- *
168+ *
164169 * Uses sqlite3_open_v2() with readonly default flag, which is the opposite behavior
165170 * of the old sqlite3_open() function (READWRITE+CREATE).
166171 * This makes sense if you want to use it on a readonly filesystem
@@ -179,7 +184,8 @@ class Database
179184 const int aFlags = SQLite::OPEN_READONLY,
180185 const int aBusyTimeoutMs = 0 ,
181186 const std::string& aVfs = " " ) :
182- Database(apFilename.c_str(), aFlags, aBusyTimeoutMs, aVfs.empty() ? nullptr : aVfs.c_str())
187+ Database(reinterpret_cast <const char *>(apFilename.u8string().c_str()),
188+ aFlags, aBusyTimeoutMs, aVfs.empty() ? nullptr : aVfs.c_str())
183189 {
184190 }
185191
@@ -280,7 +286,7 @@ class Database
280286 * @see exec() to execute, returning number of rows modified
281287 *
282288 * @param[in] aQueries one or multiple UTF-8 encoded, semicolon-separate SQL statements
283- *
289+ *
284290 * @return the sqlite result code.
285291 */
286292 int tryExec (const char * apQueries) noexcept ;
@@ -296,7 +302,7 @@ class Database
296302 * @see exec() to execute, returning number of rows modified
297303 *
298304 * @param[in] aQueries one or multiple UTF-8 encoded, semicolon-separate SQL statements
299- *
305+ *
300306 * @return the sqlite result code.
301307 */
302308 int tryExec (const std::string aQueries) noexcept
@@ -510,7 +516,7 @@ class Database
510516 * This function reads the first 100 bytes of a SQLite database file
511517 * and reconstructs groups of individual bytes into the associated fields
512518 * in a Header object.
513- *
519+ *
514520 * @param[in] aFilename path/uri to a file
515521 *
516522 * @return Header object containing file data
0 commit comments