Skip to content

Commit 6932e75

Browse files
committed
add support for constant_keyword type (#224)
This commit adds support for the newly introduced ES/SQL constant_keyword type. It also changes the installation location of zlib, for easier management of the local builds, to have the libcurl and zlib be managed (i.e. created and deleted) together. (cherry picked from commit 783b3a2)
1 parent 22fa668 commit 6932e75

File tree

3 files changed

+25
-10
lines changed

3 files changed

+25
-10
lines changed

CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,6 @@ set(LIBCURL_PATH_SRC ${CMAKE_SOURCE_DIR}/libs/curl CACHE PATH
200200
set(LIBCURL_BUILD_TYPE debug CACHE STRING
201201
"Lib curl build type: debug (default) or release")
202202

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-
209203
if (${LIBCURL_BUILD_TYPE} MATCHES [Dd][Ee][Bb][Uu][Gg])
210204
set(LIBCURL_DEBUG_ENABLED yes)
211205
set(LIBCURL_BUILD_TYPE debug)
@@ -232,6 +226,12 @@ set(LIBCURL_LD_PATH
232226
set(LIBCURL_INC_PATH ${LIBCURL_PATH_SRC}/include CACHE PATH
233227
"Lib curl include path")
234228

229+
# zlib paths
230+
set(ZLIB_PATH_SRC ${CMAKE_SOURCE_DIR}/libs/zlib CACHE PATH
231+
"Lib zlib source path")
232+
set(ZLIB_PATH_INST ${LIBCURL_PATH_SRC}/builds/zlib-${TARCH} CACHE PATH
233+
"Lib zlib install path")
234+
235235
# Build zlib, then libcurl.
236236
# Note: this happens at config time as a pre-requisite, for now. This might
237237
# be changed to a build target later (possibly as a CMake subproject: re-link
@@ -256,7 +256,7 @@ if (NOT IS_DIRECTORY ${LIBCURL_LD_PATH})
256256
endif (${CMD_RETURN})
257257
# libcurl expects a /lib and a /include folder under the location provided
258258
# 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.
259+
# we'll just cmake-install them (under libcurl's build folder).
260260
file(INSTALL ${ZLIB_PATH_SRC}/zlib.lib DESTINATION ${ZLIB_PATH_INST}/lib)
261261
file(GLOB ZLIB_H_FILES LIST_DIRECTORIES false ${ZLIB_PATH_SRC}
262262
${ZLIB_PATH_SRC}/*.h)

driver/connect.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@
6969
#define TYPE_UNSUPPORTED "UNSUPPORTED"
7070
/* 12 */
7171
#define TYPE_SCALED_FLOAT "SCALED_FLOAT"
72+
/* 16 */
73+
#define TYPE_CONSTANT_KEYWORD "CONSTANT_KEYWORD"
74+
7275
/*
7376
* intervals
7477
*/
@@ -2233,6 +2236,15 @@ static BOOL elastic_name2types(wstr_st *type_name,
22332236
return TRUE;
22342237
}
22352238
break;
2239+
2240+
/* 16: CONSTANT_KEYWORD */
2241+
case sizeof(TYPE_CONSTANT_KEYWORD) - 1:
2242+
if (! wmemncasecmp(type_name->str,
2243+
MK_WPTR(TYPE_CONSTANT_KEYWORD), type_name->cnt)) {
2244+
*c_sql = ES_CKEYWORD_TO_CSQL;
2245+
*sql = ES_CKEYWORD_TO_SQL;
2246+
return TRUE;
2247+
}
22362248
}
22372249

22382250
return elastic_intervals_name2types(type_name, c_sql, sql);

driver/connect.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,16 @@
4545
#define ES_BOOLEAN_TO_CSQL SQL_C_BIT
4646
#define ES_BOOLEAN_TO_SQL SQL_BIT
4747
/* 12: SQL_VARCHAR -> SQL_C_WCHAR */
48-
#define ES_KEYWORD_TO_CSQL SQL_C_WCHAR /* XXX: CBOR needs _CHAR */
48+
#define ES_KEYWORD_TO_CSQL SQL_C_WCHAR
4949
#define ES_KEYWORD_TO_SQL SQL_VARCHAR
5050
/* 12: SQL_VARCHAR -> SQL_C_WCHAR */
51-
#define ES_TEXT_TO_CSQL SQL_C_WCHAR /* XXX: CBOR needs _CHAR */
51+
#define ES_CKEYWORD_TO_CSQL SQL_C_WCHAR
52+
#define ES_CKEYWORD_TO_SQL SQL_VARCHAR
53+
/* 12: SQL_VARCHAR -> SQL_C_WCHAR */
54+
#define ES_TEXT_TO_CSQL SQL_C_WCHAR
5255
#define ES_TEXT_TO_SQL SQL_VARCHAR
5356
/* 12: SQL_VARCHAR -> SQL_C_WCHAR */
54-
#define ES_IP_TO_CSQL SQL_C_WCHAR /* XXX: CBOR needs _CHAR */
57+
#define ES_IP_TO_CSQL SQL_C_WCHAR
5558
#define ES_IP_TO_SQL SQL_VARCHAR
5659
/* 92: SQL_TYPE_TIME -> SQL_C_TYPE_TIME */
5760
#define ES_TIME_TO_CSQL SQL_C_TYPE_TIME

0 commit comments

Comments
 (0)