Skip to content

Commit 1aaf128

Browse files
[tests] SqlDataDiff: use bracketed Windows ODBC driver name for SQLite
The Windows ODBC Driver Manager registers the SQLite driver as "SQLite3 ODBC Driver" — a name with spaces that must be wrapped in braces in a connection string. The unixODBC convention used on Linux/macOS keeps a bare "SQLite3" identifier. Pick the right form per platform so SqliteConn produces a string the local driver manager actually accepts. Signed-off-by: Christian Parpart <christian@parpart.family>
1 parent 9f9f8e2 commit 1aaf128

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/tests/SqlDataDiffTests.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,14 @@ struct ScopedTempFile
4343

4444
[[nodiscard]] SqlConnectionString SqliteConn(std::filesystem::path const& path)
4545
{
46-
return SqlConnectionString { std::format("DRIVER=SQLite3;Database={}", path.string()) };
46+
// The Windows ODBC driver name has spaces and must be wrapped in braces; the
47+
// unixODBC convention used on Linux/macOS keeps a bare identifier.
48+
#if defined(_WIN32) || defined(_WIN64)
49+
constexpr auto driverName = "{SQLite3 ODBC Driver}";
50+
#else
51+
constexpr auto driverName = "SQLite3";
52+
#endif
53+
return SqlConnectionString { std::format("DRIVER={};Database={}", driverName, path.string()) };
4754
}
4855

4956
/// Creates a `users(id PK, name, email)` table and inserts the given rows.

0 commit comments

Comments
 (0)