Skip to content

Commit

Permalink
add support for constant_keyword type (#224)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
bpintea committed Mar 18, 2020
1 parent 22fa668 commit 6932e75
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 10 deletions.
14 changes: 7 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,6 @@ set(LIBCURL_PATH_SRC ${CMAKE_SOURCE_DIR}/libs/curl CACHE PATH
set(LIBCURL_BUILD_TYPE debug CACHE STRING
"Lib curl build type: debug (default) or release")

# zlib paths
set(ZLIB_PATH_SRC ${CMAKE_SOURCE_DIR}/libs/zlib CACHE PATH
"Lib zlib source path")
set(ZLIB_PATH_INST ${CMAKE_BINARY_DIR}/zlib CACHE PATH
"Lib zlib install path")

if (${LIBCURL_BUILD_TYPE} MATCHES [Dd][Ee][Bb][Uu][Gg])
set(LIBCURL_DEBUG_ENABLED yes)
set(LIBCURL_BUILD_TYPE debug)
Expand All @@ -232,6 +226,12 @@ set(LIBCURL_LD_PATH
set(LIBCURL_INC_PATH ${LIBCURL_PATH_SRC}/include CACHE PATH
"Lib curl include path")

# zlib paths
set(ZLIB_PATH_SRC ${CMAKE_SOURCE_DIR}/libs/zlib CACHE PATH
"Lib zlib source path")
set(ZLIB_PATH_INST ${LIBCURL_PATH_SRC}/builds/zlib-${TARCH} CACHE PATH
"Lib zlib install path")

# Build zlib, then libcurl.
# Note: this happens at config time as a pre-requisite, for now. This might
# be changed to a build target later (possibly as a CMake subproject: re-link
Expand All @@ -256,7 +256,7 @@ if (NOT IS_DIRECTORY ${LIBCURL_LD_PATH})
endif (${CMD_RETURN})
# libcurl expects a /lib and a /include folder under the location provided
# as the path to zlib. zlib/win32's makefile has no install target, so
# we'll just cmake-install them under the building dir.
# we'll just cmake-install them (under libcurl's build folder).
file(INSTALL ${ZLIB_PATH_SRC}/zlib.lib DESTINATION ${ZLIB_PATH_INST}/lib)
file(GLOB ZLIB_H_FILES LIST_DIRECTORIES false ${ZLIB_PATH_SRC}
${ZLIB_PATH_SRC}/*.h)
Expand Down
12 changes: 12 additions & 0 deletions driver/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
#define TYPE_UNSUPPORTED "UNSUPPORTED"
/* 12 */
#define TYPE_SCALED_FLOAT "SCALED_FLOAT"
/* 16 */
#define TYPE_CONSTANT_KEYWORD "CONSTANT_KEYWORD"

/*
* intervals
*/
Expand Down Expand Up @@ -2233,6 +2236,15 @@ static BOOL elastic_name2types(wstr_st *type_name,
return TRUE;
}
break;

/* 16: CONSTANT_KEYWORD */
case sizeof(TYPE_CONSTANT_KEYWORD) - 1:
if (! wmemncasecmp(type_name->str,
MK_WPTR(TYPE_CONSTANT_KEYWORD), type_name->cnt)) {
*c_sql = ES_CKEYWORD_TO_CSQL;
*sql = ES_CKEYWORD_TO_SQL;
return TRUE;
}
}

return elastic_intervals_name2types(type_name, c_sql, sql);
Expand Down
9 changes: 6 additions & 3 deletions driver/connect.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,16 @@
#define ES_BOOLEAN_TO_CSQL SQL_C_BIT
#define ES_BOOLEAN_TO_SQL SQL_BIT
/* 12: SQL_VARCHAR -> SQL_C_WCHAR */
#define ES_KEYWORD_TO_CSQL SQL_C_WCHAR /* XXX: CBOR needs _CHAR */
#define ES_KEYWORD_TO_CSQL SQL_C_WCHAR
#define ES_KEYWORD_TO_SQL SQL_VARCHAR
/* 12: SQL_VARCHAR -> SQL_C_WCHAR */
#define ES_TEXT_TO_CSQL SQL_C_WCHAR /* XXX: CBOR needs _CHAR */
#define ES_CKEYWORD_TO_CSQL SQL_C_WCHAR
#define ES_CKEYWORD_TO_SQL SQL_VARCHAR
/* 12: SQL_VARCHAR -> SQL_C_WCHAR */
#define ES_TEXT_TO_CSQL SQL_C_WCHAR
#define ES_TEXT_TO_SQL SQL_VARCHAR
/* 12: SQL_VARCHAR -> SQL_C_WCHAR */
#define ES_IP_TO_CSQL SQL_C_WCHAR /* XXX: CBOR needs _CHAR */
#define ES_IP_TO_CSQL SQL_C_WCHAR
#define ES_IP_TO_SQL SQL_VARCHAR
/* 92: SQL_TYPE_TIME -> SQL_C_TYPE_TIME */
#define ES_TIME_TO_CSQL SQL_C_TYPE_TIME
Expand Down

0 comments on commit 6932e75

Please sign in to comment.