|
| 1 | +#include "driver/statement.h" |
1 | 2 | #include "driver/platform/platform.h" |
2 | 3 | #include "driver/test/client_utils.h" |
3 | 4 | #include "driver/test/client_test_base.h" |
@@ -150,6 +151,31 @@ TEST_F(MiscellaneousTest, NullableNothing) { |
150 | 151 | EXPECT_EQ(nullable, SQL_NULLABLE); |
151 | 152 | } |
152 | 153 |
|
| 154 | +TEST_F(MiscellaneousTest, CompressionMatchesConfiguration) { |
| 155 | + // Get version directly by calling `select version()` |
| 156 | + auto query = fromUTF8<PTChar>("select version()"); |
| 157 | + ODBC_CALL_ON_STMT_THROW(hstmt, SQLExecDirect(hstmt, ptcharCast(query.data()), SQL_NTS)); |
| 158 | + ODBC_CALL_ON_STMT_THROW(hstmt, SQLFetch(hstmt)); |
| 159 | + std::basic_string<PTChar> query_version(256, '\0'); |
| 160 | + SQLLEN query_version_len = 0; |
| 161 | + ODBC_CALL_ON_STMT_THROW(hstmt, SQLGetData( |
| 162 | + hstmt, |
| 163 | + 1, |
| 164 | + getCTypeFor<SQLTCHAR*>(), |
| 165 | + query_version.data(), |
| 166 | + query_version.size(), |
| 167 | + &query_version_len |
| 168 | + )); |
| 169 | + |
| 170 | + Statement & statement = getStatement(); |
| 171 | + Connection & connection = statement.getParent(); |
| 172 | + |
| 173 | + if (connection.enable_http_compression) |
| 174 | + EXPECT_EQ(statement.getContentEncoding(), "zstd"); |
| 175 | + else |
| 176 | + EXPECT_TRUE(statement.getContentEncoding().empty()); |
| 177 | +} |
| 178 | + |
153 | 179 | enum class FailOn { |
154 | 180 | Connect, |
155 | 181 | Execute, |
@@ -369,7 +395,7 @@ TEST_P(CustomClientName, UserAgentTest) { |
369 | 395 | SQLLEN sql_type = SQL_TYPE_NULL; |
370 | 396 | ODBC_CALL_ON_STMT_THROW(hstmt, SQLColAttribute(hstmt, 1, SQL_DESC_TYPE, NULL, 0, NULL, &sql_type)); |
371 | 397 |
|
372 | | - const auto query_id = getQueryId(); |
| 398 | + const auto query_id = getStatement().getQueryId(); |
373 | 399 |
|
374 | 400 | ResultSetReader reader{hstmt}; |
375 | 401 | while (reader.fetch()) |
|
0 commit comments