Skip to content

Commit fd10c15

Browse files
committed
Enable payload compression (#201)
* enable HTTP payload compression with zlib This commit adds the option to compress the HTTP/REST payload (CBOR/JSON): - zlib is added as a build dependency, libcurl is now compiled against zlib and zlib is statically linked into the driver DLL; - a new connection string "Compress" controls the addition of the Accept-Encoding HTTP header, with possible values "on", "off" and "auto" (which adds the header if encryption is not enabled); - the possibility to build and ship libcurl as a dynamic library along the driver has been removed. Additionally, this commit switches the default payload format to CBOR. * add zlib license files add zlib license files * fix outdated comment Update comment about installing zlib files. * fix another c&p wrong comment Correct code comment (copy&paste error). (cherry picked from commit eb04bae)
1 parent 45ddf63 commit fd10c15

File tree

14 files changed

+145
-42
lines changed

14 files changed

+145
-42
lines changed

CMakeLists.txt

Lines changed: 58 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -193,37 +193,46 @@ set(CTIMESTAMP_PATH_SRC ${CMAKE_SOURCE_DIR}/libs/c-timestamp CACHE PATH
193193
aux_source_directory(${CTIMESTAMP_PATH_SRC}/ DRV_SRC)
194194

195195
#
196-
# add libcurl to the project
196+
# add libcurl (and zlib) to the project
197197
#
198198
set(LIBCURL_PATH_SRC ${CMAKE_SOURCE_DIR}/libs/curl CACHE PATH
199199
"Lib curl source path")
200-
set(LIBCURL_LINK_MODE static CACHE STRING
201-
"Lib curl linking mode: static (default) or dll")
202200
set(LIBCURL_BUILD_TYPE debug CACHE STRING
203201
"Lib curl build type: debug (default) or release")
204202

203+
# zlib paths
204+
set(ZLIB_PATH_SRC ${CMAKE_SOURCE_DIR}/libs/zlib CACHE PATH
205+
"Lib zlib source path")
206+
set(ZLIB_PATH_INST ${CMAKE_BINARY_DIR}/zlib CACHE PATH
207+
"Lib zlib install path")
208+
205209
if (${LIBCURL_BUILD_TYPE} MATCHES [Dd][Ee][Bb][Uu][Gg])
206210
set(LIBCURL_DEBUG_ENABLED yes)
207211
set(LIBCURL_BUILD_TYPE debug)
208212
set(LIBCURL_BUILD_SUFFIX _debug)
213+
# zlib's nmake-based "win32" build system contains a default,
214+
# non-modifiable "-MD". Setting ZLIB_LOC will override it, which will
215+
# issue a compiler warning (that can be ignored, can't be supressed).
216+
set(ZLIB_LOC -MDd)
209217
else (${LIBCURL_BUILD_TYPE} MATCHES [Dd][Ee][Bb][Uu][Gg])
210218
set(LIBCURL_DEBUG_ENABLED no)
211219
set(LIBCURL_BUILD_TYPE release)
212220
# empty LIBCURL_BUILD_SUFFIX
221+
# empty ZLIB_LOC
213222
endif (${LIBCURL_BUILD_TYPE} MATCHES [Dd][Ee][Bb][Uu][Gg])
214223

215224
set(LIBCURL_LD_PATH
216225
# Curl "installs" the .dll and .lib in different directories -> use the
217226
# build dir to find both files in same directory instead of installing.
218227
# Curl's win build root directory is not configurable.
219-
# The path built below is only constant for the subtree tag (current:
220-
# 7.61.0) and default/below nmake options (only with: IPv6, SSPI, WinSSL).
221-
${LIBCURL_PATH_SRC}/builds/libcurl-vc-${TARCH}-${LIBCURL_BUILD_TYPE}-${LIBCURL_LINK_MODE}-ipv6-sspi-winssl-obj-lib/
228+
# The path built below is only constant for the subtree tag and the nmake
229+
# options below: ZLIB, IPv6, SSPI, WinSSL, plus IDN, not echoed in name.
230+
${LIBCURL_PATH_SRC}/builds/libcurl-vc-${TARCH}-${LIBCURL_BUILD_TYPE}-static-zlib-static-ipv6-sspi-winssl-obj-lib/
222231
CACHE PATH "Lib curl load library path")
223232
set(LIBCURL_INC_PATH ${LIBCURL_PATH_SRC}/include CACHE PATH
224233
"Lib curl include path")
225234

226-
# Build libcurl.
235+
# Build zlib, then libcurl.
227236
# Note: this happens at config time as a pre-requisite, for now. This might
228237
# be changed to a build target later (possibly as a CMake subproject: re-link
229238
# only if out-of-date, skip building the .exe, allow disabling non-HTTP
@@ -232,14 +241,38 @@ set(LIBCURL_INC_PATH ${LIBCURL_PATH_SRC}/include CACHE PATH
232241
# entire build "single-config", since the build type (rel/dbg) is decided at
233242
# CMake-generation, not along the MSBuild invocation.
234243
if (NOT IS_DIRECTORY ${LIBCURL_LD_PATH})
244+
# build zlib first.
245+
message("Building zlib library in ${ZLIB_PATH_SRC}")
246+
execute_process(COMMAND
247+
# zlib's "win32" makefile builds in situ => always clean before
248+
# building, potentially removing builds of different architecture than
249+
# current's build.
250+
nmake /f win32/Makefile.msc clean zlib.lib LOC=${ZLIB_LOC}
251+
RESULT_VARIABLE CMD_RETURN
252+
WORKING_DIRECTORY "${ZLIB_PATH_SRC}"
253+
)
254+
if (${CMD_RETURN})
255+
message(FATAL_ERROR "Building zlib failed.")
256+
endif (${CMD_RETURN})
257+
# libcurl expects a /lib and a /include folder under the location provided
258+
# as the path to zlib. zlib/win32's makefile has no install target, so
259+
# we'll just cmake-install them under the building dir.
260+
file(INSTALL ${ZLIB_PATH_SRC}/zlib.lib DESTINATION ${ZLIB_PATH_INST}/lib)
261+
file(GLOB ZLIB_H_FILES LIST_DIRECTORIES false ${ZLIB_PATH_SRC}
262+
${ZLIB_PATH_SRC}/*.h)
263+
file(INSTALL ${ZLIB_H_FILES} DESTINATION ${ZLIB_PATH_INST}/include)
264+
265+
# build libcurl second: config first, build afterwards..
266+
message("Building curl library in ${LIBCURL_PATH_SRC}")
235267
execute_process(COMMAND buildconf.bat
236268
RESULT_VARIABLE CMD_RETURN
237269
WORKING_DIRECTORY "${LIBCURL_PATH_SRC}"
238270
)
239271
if (NOT ${CMD_RETURN})
240272
execute_process(COMMAND
241-
nmake /f Makefile.vc mode=${LIBCURL_LINK_MODE} MACHINE=${TARCH}
273+
nmake /f Makefile.vc mode=static MACHINE=${TARCH}
242274
ENABLE_WINSSL=yes ENABLE_IDN=yes ENABLE_IPV6=yes ENABLE_SSPI=yes
275+
WITH_ZLIB=static ZLIB_PATH=${ZLIB_PATH_INST}
243276
# build type needs to be synchronized (to link in the same CRT)
244277
DEBUG=${LIBCURL_DEBUG_ENABLED}
245278
# This "sneaks in" a define to disable all other protocols than
@@ -260,32 +293,31 @@ endif(NOT IS_DIRECTORY ${LIBCURL_LD_PATH})
260293

261294
# add libcurl as dependency
262295
if (${WIN32})
263-
if (${LIBCURL_LINK_MODE} MATCHES [Dd][Ll][Ll])
264-
add_library(libcurl SHARED IMPORTED)
265-
set_property(TARGET libcurl PROPERTY IMPORTED_LOCATION
266-
${LIBCURL_LD_PATH}/libcurl${LIBCURL_BUILD_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX})
267-
set_property(TARGET libcurl PROPERTY IMPORTED_IMPLIB
268-
${LIBCURL_LD_PATH}/libcurl${LIBCURL_BUILD_SUFFIX}${CMAKE_IMPORT_LIBRARY_SUFFIX})
269-
# empty LIBCURL_WIN_LIBS
270-
else (${LIBCURL_LINK_MODE} MATCHES [Dd][Ll][Ll])
271-
add_library(libcurl STATIC IMPORTED)
272-
set_property(TARGET libcurl PROPERTY IMPORTED_LOCATION
273-
${LIBCURL_LD_PATH}/libcurl_a${LIBCURL_BUILD_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX})
274-
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /DCURL_STATICLIB")
275-
# Libraries that libcurl/WinSSL links against.
276-
# Removed: wldap32 advapi32 gdi32 user32 (unused with current config)
277-
set(LIBCURL_WIN_LIBS ws2_32 crypt32 normaliz)
278-
endif (${LIBCURL_LINK_MODE} MATCHES [Dd][Ll][Ll])
296+
add_library(zlib STATIC IMPORTED)
297+
set_property(TARGET zlib PROPERTY IMPORTED_LOCATION
298+
${ZLIB_PATH_INST}/lib/zlib.lib)
299+
300+
add_library(libcurl STATIC IMPORTED)
301+
set_property(TARGET libcurl PROPERTY IMPORTED_LOCATION
302+
${LIBCURL_LD_PATH}/libcurl_a${LIBCURL_BUILD_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX})
303+
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /DCURL_STATICLIB")
304+
# Libraries that libcurl/WinSSL links against.
305+
# Removed: wldap32 advapi32 gdi32 user32 (unused with current config)
306+
set(LIBCURL_WIN_LIBS ws2_32 crypt32 normaliz)
279307
else (${WIN32})
280308
set_property(TARGET libcurl PROPERTY IMPORTED_LOCATION
281309
${LIBCURL_LD_PATH}/libcurl${CMAKE_SHARED_LIBRARY_SUFFIX})
282310
endif (${WIN32})
283311

284312
add_custom_target(curlclean
285-
COMMAND nmake /f Makefile.vc mode=${LIBCURL_LINK_MODE} clean
313+
COMMAND nmake /f Makefile.vc mode=static clean
286314
COMMAND ../buildconf.bat -clean
287315
WORKING_DIRECTORY "${LIBCURL_PATH_SRC}/winbuild"
288316
)
317+
add_custom_target(zlibclean
318+
COMMAND nmake /f win32/Makefile.msc clean
319+
WORKING_DIRECTORY "${ZLIB_PATH_SRC}"
320+
)
289321

290322
#
291323
# add tinycbor to the project
@@ -376,7 +408,7 @@ include_directories(${ODBC_INC} ${DRV_SRC_DIR} ${LIBCURL_INC_PATH}
376408
${DSNEDITOR_INC_PATH})
377409
target_link_libraries(${DRV_NAME} odbccp32 legacy_stdio_definitions
378410
${DSNBND_LIB_BIN_DIR_BASE}-$<CONFIG>/esdsnbnd${BARCH}${CMAKE_IMPORT_LIBRARY_SUFFIX}
379-
libcurl ${LIBCURL_WIN_LIBS})
411+
zlib libcurl ${LIBCURL_WIN_LIBS})
380412

381413

382414
#
@@ -405,12 +437,6 @@ install(FILES
405437
LICENSE.rtf LICENSE.txt ${CMAKE_BINARY_DIR}/NOTICE.txt
406438
DESTINATION ${INSTALL_DIR})
407439
# add libcurl if build dynamically
408-
if (${LIBCURL_LINK_MODE} MATCHES [Dd][Ll][Ll])
409-
install(FILES
410-
# need to use FILE : https://public.kitware.com/Bug/view.php?id=14311
411-
${LIBCURL_LD_PATH}/libcurl${LIBCURL_BUILD_SUFFIX}${CMAKE_SHARED_LIBRARY_SUFFIX}
412-
DESTINATION ${INSTALL_DIR})
413-
endif (${LIBCURL_LINK_MODE} MATCHES [Dd][Ll][Ll])
414440
# add editor DLLs
415441
install(FILES
416442
${DSNBND_LIB_BIN_DIR_BASE}-$<CONFIG>/esdsnedt${CMAKE_SHARED_LIBRARY_SUFFIX}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ The required libraries are added as subtrees to the project, in the libs directo
6161
|_libs
6262
|_ODBC-Specification
6363
|_curl
64+
|_zlib
6465
|_c-timestamp
6566
|_ujson4c
6667
|_tinycbor

build.bat

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,6 @@ REM USAGE function: output a usage message
297297
echo Extra development arguments:
298298
echo nobuild : skip project building (the default is to build^).
299299
echo genonly : generate project/make files, but don't build.
300-
echo curldll : link libcurl dynamically.
301300
echo exports : dump the exported symbols in the DLL after building.
302301
echo depends : dump the dependents libs of the build DLL.
303302
echo install[:D] : install the driver files. D, the target directory
@@ -335,6 +334,9 @@ REM CTESTS function: run CI testing
335334
REM PROPER function: clean up the build and libs dir.
336335
:PROPER
337336
echo %~nx0: cleaning libs.
337+
if exist %BUILD_DIR%\zlibclean.vcxproj (
338+
MSBuild %BUILD_DIR%\zlibclean.vcxproj
339+
)
338340
if exist %BUILD_DIR%\curlclean.vcxproj (
339341
MSBuild %BUILD_DIR%\curlclean.vcxproj
340342
)
@@ -502,9 +504,6 @@ REM BUILD function: build various targets
502504
REM no explicit x86 generator and is the default (MSVC2017 only?).
503505
set CMAKE_ARGS=!CMAKE_ARGS! -DCMAKE_GENERATOR_PLATFORM=%TARCH:x86=%
504506

505-
if /i not [%ARG:curldll=%] == [%ARG%] (
506-
set CMAKE_ARGS=!CMAKE_ARGS! -DLIBCURL_LINK_MODE=dll
507-
)
508507
if /i [!BUILD_TYPE!] == [Debug] (
509508
set CMAKE_ARGS=!CMAKE_ARGS! -DLIBCURL_BUILD_TYPE=debug
510509
) else (
@@ -621,7 +620,7 @@ REM TESTS_SUITE_S function: run the compiled unit tests
621620

622621
goto:eof
623622

624-
REM INSTALL_DO function: copy DLLs (libcurl, odbc) into the install
623+
REM INSTALL_DO function: copy DLLs into the install
625624
:INSTALL_DO
626625
echo %~nx0: installing the driver files.
627626
MSBuild INSTALL.vcxproj !MSBUILD_ARGS!
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
name,version,revision,url,license,copyright
2+
zlib,1.2.11,,https://www.zlib.net,zlib License,"Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
2+
3+
This software is provided 'as-is', without any express or implied
4+
warranty. In no event will the authors be held liable for any damages
5+
arising from the use of this software.
6+
7+
Permission is granted to anyone to use this software for any purpose,
8+
including commercial applications, and to alter it and redistribute it
9+
freely, subject to the following restrictions:
10+
11+
1. The origin of this software must not be misrepresented; you must not
12+
claim that you wrote the original software. If you use this software
13+
in a product, an acknowledgment in the product documentation would be
14+
appreciated but is not required.
15+
2. Altered source versions must be plainly marked as such, and must not be
16+
misrepresented as being the original software.
17+
3. This notice may not be removed or altered from any source distribution.
18+
19+
Jean-loup Gailly Mark Adler
20+
21+

devtools/3rd_party/licenses/zlib-NOTICE.txt

Whitespace-only changes.

driver/connect.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ static SQLRETURN dbc_curl_init(esodbc_dbc_st *dbc)
437437
{
438438
CURL *curl;
439439
SQLRETURN ret;
440+
BOOL compress;
440441

441442
assert(! dbc->curl);
442443

@@ -473,6 +474,16 @@ static SQLRETURN dbc_curl_init(esodbc_dbc_st *dbc)
473474
goto err;
474475
}
475476

477+
/* set the accepted encoding (compression) header */
478+
compress = dbc->compression == ESODBC_CMPSS_ON ||
479+
(dbc->compression == ESODBC_CMPSS_AUTO && !dbc->secure);
480+
dbc->curl_err = curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING,
481+
compress ? "" : NULL);
482+
if (dbc->curl_err != CURLE_OK) {
483+
ERRH(dbc, "libcurl: failed to set HTTP headers list.");
484+
goto err;
485+
}
486+
476487
if (dbc->secure) {
477488
dbc->curl_err = curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER,
478489
ESODBC_SEC_CHECK_CA <= dbc->secure ? 1L : 0L);
@@ -513,6 +524,13 @@ static SQLRETURN dbc_curl_init(esodbc_dbc_st *dbc)
513524
* (CURLOPT_SSL_FALSESTART), CURLOPT_SSL_VERIFYSTATUS,
514525
* CURLOPT_PROXY_*
515526
*/
527+
528+
/* TLS has its own compression options (RFC3749), so doing it twice
529+
* will likelyl be detrimental, but there's also the security
530+
* implication (CVE-2012-4929). */
531+
if (compress) {
532+
WARNH(dbc, "compression and encryption are both enabled.");
533+
}
516534
}
517535

518536
/* set authentication parameters */
@@ -1361,6 +1379,18 @@ SQLRETURN config_dbc(esodbc_dbc_st *dbc, esodbc_dsn_attrs_st *attrs)
13611379
}
13621380
INFOH(dbc, "pack JSON: %s.", dbc->pack_json ? "true" : "false");
13631381

1382+
/*
1383+
* set the compression option: auto/on/off
1384+
*/
1385+
if (EQ_CASE_WSTR(&attrs->compression, &MK_WSTR(ESODBC_DSN_CMPSS_AUTO))) {
1386+
dbc->compression = ESODBC_CMPSS_AUTO;
1387+
} else {
1388+
dbc->compression = wstr2bool(&attrs->compression) ?
1389+
ESODBC_CMPSS_ON : ESODBC_CMPSS_OFF;
1390+
}
1391+
INFOH(dbc, "compression: %d (" LWPDL ").", dbc->compression,
1392+
LWSTR(&attrs->compression));
1393+
13641394
/* "apply TZ" param for time conversions */
13651395
dbc->apply_tz = wstr2bool(&attrs->apply_tz);
13661396
INFOH(dbc, "apply TZ: %s.", dbc->apply_tz ? "true" : "false");

driver/defs.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,9 @@
164164
/* don't follow redirection from the server */
165165
#define ESODBC_DEF_FOLLOW "yes"
166166
/* packing of REST bodies (JSON or CBOR) */
167-
#define ESODBC_DEF_PACKING ESODBC_DSN_PACK_JSON
167+
#define ESODBC_DEF_PACKING ESODBC_DSN_PACK_CBOR
168+
/* zlib compression of REST bodies (auto/true/false) */
169+
#define ESODBC_DEF_COMPRESSION ESODBC_DSN_CMPSS_AUTO
168170
/* default tracing activation */
169171
#define ESODBC_DEF_TRACE_ENABLED "0"
170172
/* default tracing level */

driver/dsn.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ int assign_dsn_attr(esodbc_dsn_attrs_st *attrs,
7272
{&MK_WSTR(ESODBC_DSN_FOLLOW), &attrs->follow},
7373
{&MK_WSTR(ESODBC_DSN_CATALOG), &attrs->catalog},
7474
{&MK_WSTR(ESODBC_DSN_PACKING), &attrs->packing},
75+
{&MK_WSTR(ESODBC_DSN_COMPRESSION), &attrs->compression},
7576
{&MK_WSTR(ESODBC_DSN_MAX_FETCH_SIZE), &attrs->max_fetch_size},
7677
{&MK_WSTR(ESODBC_DSN_MAX_BODY_SIZE_MB), &attrs->max_body_size},
7778
{&MK_WSTR(ESODBC_DSN_APPLY_TZ), &attrs->apply_tz},
@@ -406,6 +407,7 @@ long TEST_API write_00_list(esodbc_dsn_attrs_st *attrs,
406407
{&MK_WSTR(ESODBC_DSN_FOLLOW), &attrs->follow},
407408
{&MK_WSTR(ESODBC_DSN_CATALOG), &attrs->catalog},
408409
{&MK_WSTR(ESODBC_DSN_PACKING), &attrs->packing},
410+
{&MK_WSTR(ESODBC_DSN_COMPRESSION), &attrs->compression},
409411
{&MK_WSTR(ESODBC_DSN_MAX_FETCH_SIZE), &attrs->max_fetch_size},
410412
{&MK_WSTR(ESODBC_DSN_MAX_BODY_SIZE_MB), &attrs->max_body_size},
411413
{&MK_WSTR(ESODBC_DSN_APPLY_TZ), &attrs->apply_tz},
@@ -657,6 +659,10 @@ BOOL write_system_dsn(esodbc_dsn_attrs_st *new_attrs,
657659
&MK_WSTR(ESODBC_DSN_PACKING), &new_attrs->packing,
658660
old_attrs ? &old_attrs->packing : NULL
659661
},
662+
{
663+
&MK_WSTR(ESODBC_DSN_COMPRESSION), &new_attrs->compression,
664+
old_attrs ? &old_attrs->packing : NULL
665+
},
660666
{
661667
&MK_WSTR(ESODBC_DSN_MAX_FETCH_SIZE), &new_attrs->max_fetch_size,
662668
old_attrs ? &old_attrs->max_fetch_size : NULL
@@ -776,6 +782,7 @@ long TEST_API write_connection_string(esodbc_dsn_attrs_st *attrs,
776782
{&attrs->follow, &MK_WSTR(ESODBC_DSN_FOLLOW)},
777783
{&attrs->catalog, &MK_WSTR(ESODBC_DSN_CATALOG)},
778784
{&attrs->packing, &MK_WSTR(ESODBC_DSN_PACKING)},
785+
{&attrs->compression, &MK_WSTR(ESODBC_DSN_COMPRESSION)},
779786
{&attrs->max_fetch_size, &MK_WSTR(ESODBC_DSN_MAX_FETCH_SIZE)},
780787
{&attrs->max_body_size, &MK_WSTR(ESODBC_DSN_MAX_BODY_SIZE_MB)},
781788
{&attrs->apply_tz, &MK_WSTR(ESODBC_DSN_APPLY_TZ)},
@@ -863,6 +870,9 @@ void assign_dsn_defaults(esodbc_dsn_attrs_st *attrs)
863870
res |= assign_dsn_attr(attrs,
864871
&MK_WSTR(ESODBC_DSN_PACKING), &MK_WSTR(ESODBC_DEF_PACKING),
865872
/*overwrite?*/FALSE);
873+
res |= assign_dsn_attr(attrs,
874+
&MK_WSTR(ESODBC_DSN_COMPRESSION), &MK_WSTR(ESODBC_DEF_COMPRESSION),
875+
/*overwrite?*/FALSE);
866876
res |= assign_dsn_attr(attrs,
867877
&MK_WSTR(ESODBC_DSN_MAX_FETCH_SIZE),
868878
&MK_WSTR(ESODBC_DEF_FETCH_SIZE),

driver/dsn.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#define ESODBC_DSN_FOLLOW "Follow"
3232
#define ESODBC_DSN_CATALOG "Catalog"
3333
#define ESODBC_DSN_PACKING "Packing"
34+
#define ESODBC_DSN_COMPRESSION "Compression"
3435
#define ESODBC_DSN_MAX_FETCH_SIZE "MaxFetchSize"
3536
#define ESODBC_DSN_MAX_BODY_SIZE_MB "MaxBodySizeMB"
3637
#define ESODBC_DSN_APPLY_TZ "ApplyTZ"
@@ -46,6 +47,10 @@
4647
/* Packing values */
4748
#define ESODBC_DSN_PACK_JSON "JSON"
4849
#define ESODBC_DSN_PACK_CBOR "CBOR"
50+
/* Compression values */
51+
#define ESODBC_DSN_CMPSS_AUTO "auto"
52+
#define ESODBC_DSN_CMPSS_ON "on"
53+
#define ESODBC_DSN_CMPSS_OFF "off"
4954
/* VersionChecking values */
5055
#define ESODBC_DSN_VC_STRICT "strict"
5156
#define ESODBC_DSN_VC_MAJOR "major"
@@ -73,6 +78,7 @@ typedef struct {
7378
wstr_st follow;
7479
wstr_st catalog;
7580
wstr_st packing;
81+
wstr_st compression;
7682
wstr_st max_fetch_size;
7783
wstr_st max_body_size;
7884
wstr_st apply_tz;
@@ -84,7 +90,7 @@ typedef struct {
8490
wstr_st trace_enabled;
8591
wstr_st trace_file;
8692
wstr_st trace_level;
87-
#define ESODBC_DSN_ATTRS_COUNT 27
93+
#define ESODBC_DSN_ATTRS_COUNT 28
8894
SQLWCHAR buff[ESODBC_DSN_ATTRS_COUNT * ESODBC_DSN_MAX_ATTR_LEN];
8995
/* DSN reading/writing functions are passed a SQLSMALLINT lenght param */
9096
#if SHRT_MAX < ESODBC_DSN_ATTRS_COUNT * ESODBC_DSN_MAX_ATTR_LEN

0 commit comments

Comments
 (0)